| | |
| | | import com.oying.modules.pc.product.service.ProductService; |
| | | import com.oying.modules.pc.store.domain.Store; |
| | | import com.oying.modules.pc.store.domain.dto.StoreQueryCriteria; |
| | | import com.oying.modules.pc.store.domain.enums.StoreStatusEnum; |
| | | import com.oying.modules.pc.store.service.StoreQualificationService; |
| | | import com.oying.modules.pc.store.service.StoreQueryService; |
| | | import com.oying.modules.pc.store.service.StoreService; |
| | |
| | | @GetMapping(value = "/page") |
| | | @ApiOperation("查询店铺") |
| | | public ResponseEntity<?> getStoresByPage(StoreQueryCriteria criteria) { |
| | | criteria.setLimit(1000); |
| | | criteria.setBusinessStatus(StoreStatusEnum.OPEN.getValue()); |
| | | PageResult<Store> pagedStores = storeQueryService.findPagedStores(criteria); |
| | | List<Store> stores = pagedStores.getContent(); |
| | | for (Store store : stores) { |
| | | store.setProducts(this.getProductsByStoreId(store.getStoreId())); |
| | | } |
| | | pagedStores.getContent().forEach(store -> store.setProducts(this.getProductsByStoreId(store.getStoreId()))); |
| | | return ResponseEntity.ok(R.success(pagedStores)); |
| | | } |
| | | |
| | |
| | | public ResponseEntity<?> getStoreDetailsById(@PathVariable("storeId") Long storeId) { |
| | | Store store = storeService.getById(storeId); |
| | | if (ObjUtil.isNotEmpty(store)) { |
| | | store.setQualifications(storeQualificationService.queryByStoreId(storeId)); |
| | | store.setQualifications(storeQualificationService.getByStoreId(storeId)); |
| | | } |
| | | return ResponseEntity.ok(R.success(store)); |
| | | } |