xin
13 hours ago c67c3be16c4a9aa7c6617d43da886850d717a009
oying-system/src/main/java/com/oying/modules/pc/product/rest/ProductMerchantController.java
@@ -5,12 +5,10 @@
import cn.hutool.core.util.ObjUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.oying.annotation.Log;
import com.oying.annotation.rest.AnonymousGetMapping;
import com.oying.modules.pc.product.domain.Product;
import com.oying.modules.pc.product.domain.ProductLabel;
import com.oying.modules.pc.product.domain.dto.ProductImageCreateRequest;
import com.oying.modules.pc.product.domain.dto.ProductMerchantCreateRequest;
import com.oying.modules.pc.product.domain.dto.ProductMerchantUpdateRequest;
import com.oying.modules.pc.product.domain.dto.ProductQueryCriteria;
import com.oying.modules.pc.product.domain.dto.*;
import com.oying.modules.pc.product.service.ProductImageService;
import com.oying.modules.pc.product.service.ProductLabelService;
import com.oying.modules.pc.product.service.ProductMerchantService;
@@ -42,15 +40,12 @@
@RequestMapping("/api/pc/merchant/store/{storeId}/product")
public class ProductMerchantController {
    private final int MAX_IMAGES = 5;
    private final int MAX_LABELS = 10;
    private final ProductService productService;
    private final ProductMerchantService productMerchantService;
    private final ProductImageService productImageService;
    private final ProductLabelService productLabelService;
    @GetMapping(value = "/page")
    @AnonymousGetMapping(value = "/page")
    @ApiOperation("获取指定商户店铺的商品列表(支持分页)")
    /*@PreAuthorize("@el.check('merchant:product:page') " +
            "and @storeMerchantOwnershipService.check(#storeId)")*/
@@ -98,7 +93,7 @@
    public ResponseEntity<?> createProduct(@PathVariable Long storeId,
                                           @Validated @RequestBody ProductMerchantCreateRequest request) {
        request.setStoreId(ObjectUtils.defaultIfNull(request.getStoreId(), storeId));
        productMerchantService.create(request);
        productMerchantService.createWithAudit(request);
        return ResponseEntity.status(HttpStatus.CREATED).build();
    }
@@ -114,6 +109,16 @@
        return ResponseEntity.noContent().build();
    }
    @PutMapping(value = "/{productId}/price")
    @Log("修改价格")
    @ApiOperation("修改价格")
    public ResponseEntity<?> updateProductPrice(@PathVariable Long productId,
                                           @Validated @RequestBody ProductPriceUpdateRequest request) {
        request.setProductId(ObjectUtils.defaultIfNull(request.getProductId(), productId));
        productMerchantService.updatePrice(request);
        return ResponseEntity.noContent().build();
    }
    @DeleteMapping
    @Log("批量删除商品")
    @ApiOperation("批量删除商品")
@@ -124,6 +129,16 @@
        return ResponseEntity.noContent().build();
    }
    @PostMapping(value = "/delete")
    @Log("批量删除商品")
    @ApiOperation("批量删除商品")
    //@PreAuthorize("@el.check('merchant:product:batchDel') " +
    //        "and @storeMerchantOwnershipService.check(#storeId)")
    public ResponseEntity<?> delProduct(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) {
        productMerchantService.batchDelete(ids);
        return ResponseEntity.noContent().build();
    }
    @PutMapping(value = "/{productId}/on")
    @Log("上架商品")
    @ApiOperation("上架商品")