| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.oying.modules.pc.store.domain.dto.StoreUpdateRequest; |
| | | import com.oying.modules.pc.store.service.StoreQualificationService; |
| | | import com.oying.utils.R; |
| | | import com.oying.modules.pc.store.domain.Store; |
| | | import com.oying.modules.pc.store.domain.dto.StoreCreateRequest; |
| | |
| | | |
| | | private final StoreService storeService; |
| | | private final StoreCreateService storeCreateService; |
| | | private final StoreQualificationService storeQualificationService; |
| | | |
| | | @GetMapping(value = "/list") |
| | | @ApiOperation("查询所有店铺") |
| | |
| | | @GetMapping(value = "/{storeId}") |
| | | @ApiOperation("查询店铺") |
| | | //@PreAuthorize("@el.check('merchant:store:getById')") |
| | | public ResponseEntity<?> getById(@PathVariable Long storeId) { |
| | | public ResponseEntity<?> getStoreById(@PathVariable Long storeId) { |
| | | Store store = storeService.getById(storeId); |
| | | StoreMerchantView view = new StoreMerchantView(); |
| | | BeanUtils.copyProperties(store, view); |
| | | return ResponseEntity.ok(R.success(view)); |
| | | } |
| | | |
| | | @GetMapping(value = "/{storeId}/details") |
| | | @ApiOperation("查询店铺") |
| | | //@PreAuthorize("@el.check('merchant:store:getById')") |
| | | public ResponseEntity<?> getStoreDetailsById(@PathVariable Long storeId) { |
| | | Store store = storeService.getById(storeId); |
| | | if (ObjUtil.isNotEmpty(store)) { |
| | | store.setQualifications(storeQualificationService.queryByStoreId(storeId)); |
| | | } |
| | | return ResponseEntity.ok(R.success(store)); |
| | | } |
| | | |
| | | @PostMapping |
| | | @ApiOperation("创建店铺") |
| | | //@PreAuthorize("@el.check('merchant:store:create')") |
| | | public ResponseEntity<?> create(@RequestBody StoreCreateRequest request) { |
| | | storeCreateService.create(request); |
| | | return ResponseEntity.status(HttpStatus.CREATED).build(); |
| | | return ResponseEntity.status(HttpStatus.CREATED).body(storeCreateService.create(request)); |
| | | } |
| | | |
| | | /** |