From eb5bdda3442fb7aa7856a2374bafb122fc4287b4 Mon Sep 17 00:00:00 2001 From: franky <16621167566@163.com> Date: Tue, 31 May 2022 18:39:44 +0800 Subject: [PATCH] =?UTF-8?q?SPU=E5=90=8D=E5=AD=97=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...troller.java => ProductSkuController.java} | 46 ++++----- .../{SkuBaseVO.java => ProductSkuBaseVO.java} | 10 +- ...eReqVO.java => ProductSkuCreateReqVO.java} | 2 +- ...SkuExcelVO.java => ProductSkuExcelVO.java} | 9 +- ...tReqVO.java => ProductSkuExportReqVO.java} | 2 +- ...ageReqVO.java => ProductSkuPageReqVO.java} | 2 +- .../{SkuRespVO.java => ProductSkuRespVO.java} | 2 +- ...eReqVO.java => ProductSkuUpdateReqVO.java} | 2 +- ...troller.java => ProductSpuController.java} | 28 +++--- .../{SpuBaseVO.java => ProductSpuBaseVO.java} | 4 +- ...eReqVO.java => ProductSpuCreateReqVO.java} | 2 +- .../controller/admin/spu/vo/SpuExcelVO.java | 2 +- .../admin/spu/vo/SpuExportReqVO.java | 2 +- .../controller/admin/spu/vo/SpuRespVO.java | 2 +- .../admin/spu/vo/SpuUpdateReqVO.java | 2 +- .../convert/sku/ProductSkuConvert.java | 34 +++++++ .../product/convert/sku/SkuConvert.java | 34 ------- .../convert/spu/ProductSpuConvert.java | 34 +++++++ .../product/convert/spu/SpuConvert.java | 34 ------- .../sku/{SkuDO.java => ProductSkuDO.java} | 13 ++- .../spu/{SpuDO.java => ProductSpuDO.java} | 6 +- .../dal/mysql/sku/ProductSkuMapper.java | 48 ++++++++++ .../product/dal/mysql/sku/SkuMapper.java | 48 ---------- .../dal/mysql/spu/ProductSpuMapper.java | 52 ++++++++++ .../product/dal/mysql/spu/SpuMapper.java | 52 ---------- ...SkuService.java => ProductSkuService.java} | 16 ++-- .../service/sku/ProductSkuServiceImpl.java | 82 ++++++++++++++++ .../product/service/sku/SkuServiceImpl.java | 82 ---------------- ...SpuService.java => ProductSpuService.java} | 14 +-- ...ceImpl.java => ProductSpuServiceImpl.java} | 40 ++++---- .../service/sku/SkuServiceImplTest.java | 94 +++++++++---------- ...st.java => ProductSpuServiceImplTest.java} | 86 ++++++++--------- 32 files changed, 454 insertions(+), 432 deletions(-) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/{SkuController.java => ProductSkuController.java} (60%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/{SkuBaseVO.java => ProductSkuBaseVO.java} (89%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/{SkuCreateReqVO.java => ProductSkuCreateReqVO.java} (83%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/{SkuExcelVO.java => ProductSkuExcelVO.java} (83%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/{SkuExportReqVO.java => ProductSkuExportReqVO.java} (97%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/{SkuPageReqVO.java => ProductSkuPageReqVO.java} (96%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/{SkuRespVO.java => ProductSkuRespVO.java} (88%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/{SkuUpdateReqVO.java => ProductSkuUpdateReqVO.java} (87%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/{SpuController.java => ProductSpuController.java} (77%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/{SpuBaseVO.java => ProductSpuBaseVO.java} (95%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/{SpuCreateReqVO.java => ProductSpuCreateReqVO.java} (83%) create mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/ProductSkuConvert.java delete mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/SkuConvert.java create mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java delete mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/SpuConvert.java rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/{SkuDO.java => ProductSkuDO.java} (86%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/{SpuDO.java => ProductSpuDO.java} (93%) create mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java delete mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/SkuMapper.java create mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java delete mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/SpuMapper.java rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/{SkuService.java => ProductSkuService.java} (69%) create mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java delete mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImpl.java rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/{SpuService.java => ProductSpuService.java} (73%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/{SpuServiceImpl.java => ProductSpuServiceImpl.java} (50%) rename yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/{SpuServiceImplTest.java => ProductSpuServiceImplTest.java} (64%) diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/SkuController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/ProductSkuController.java similarity index 60% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/SkuController.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/ProductSkuController.java index 49f5159ef..878318f78 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/SkuController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/ProductSkuController.java @@ -22,31 +22,31 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; -import cn.iocoder.yudao.module.product.convert.sku.SkuConvert; -import cn.iocoder.yudao.module.product.service.sku.SkuService; +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; +import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; +import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; @Api(tags = "管理后台 - 商品sku") @RestController @RequestMapping("/product/sku") @Validated -public class SkuController { +public class ProductSkuController { @Resource - private SkuService skuService; + private ProductSkuService ProductSkuService; @PostMapping("/create") @ApiOperation("创建商品sku") @PreAuthorize("@ss.hasPermission('product:sku:create')") - public CommonResult createSku(@Valid @RequestBody SkuCreateReqVO createReqVO) { - return success(skuService.createSku(createReqVO)); + public CommonResult createSku(@Valid @RequestBody ProductSkuCreateReqVO createReqVO) { + return success(ProductSkuService.createSku(createReqVO)); } @PutMapping("/update") @ApiOperation("更新商品sku") @PreAuthorize("@ss.hasPermission('product:sku:update')") - public CommonResult updateSku(@Valid @RequestBody SkuUpdateReqVO updateReqVO) { - skuService.updateSku(updateReqVO); + public CommonResult updateSku(@Valid @RequestBody ProductSkuUpdateReqVO updateReqVO) { + ProductSkuService.updateSku(updateReqVO); return success(true); } @@ -55,7 +55,7 @@ public class SkuController { @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Integer.class) @PreAuthorize("@ss.hasPermission('product:sku:delete')") public CommonResult deleteSku(@RequestParam("id") Integer id) { - skuService.deleteSku(id); + ProductSkuService.deleteSku(id); return success(true); } @@ -63,38 +63,38 @@ public class SkuController { @ApiOperation("获得商品sku") @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class) @PreAuthorize("@ss.hasPermission('product:sku:query')") - public CommonResult getSku(@RequestParam("id") Integer id) { - SkuDO sku = skuService.getSku(id); - return success(SkuConvert.INSTANCE.convert(sku)); + public CommonResult getSku(@RequestParam("id") Integer id) { + ProductSkuDO sku = ProductSkuService.getSku(id); + return success(ProductSkuConvert.INSTANCE.convert(sku)); } @GetMapping("/list") @ApiOperation("获得商品sku列表") @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) @PreAuthorize("@ss.hasPermission('product:sku:query')") - public CommonResult> getSkuList(@RequestParam("ids") Collection ids) { - List list = skuService.getSkuList(ids); - return success(SkuConvert.INSTANCE.convertList(list)); + public CommonResult> getSkuList(@RequestParam("ids") Collection ids) { + List list = ProductSkuService.getSkuList(ids); + return success(ProductSkuConvert.INSTANCE.convertList(list)); } @GetMapping("/page") @ApiOperation("获得商品sku分页") @PreAuthorize("@ss.hasPermission('product:sku:query')") - public CommonResult> getSkuPage(@Valid SkuPageReqVO pageVO) { - PageResult pageResult = skuService.getSkuPage(pageVO); - return success(SkuConvert.INSTANCE.convertPage(pageResult)); + public CommonResult> getSkuPage(@Valid ProductSkuPageReqVO pageVO) { + PageResult pageResult = ProductSkuService.getSkuPage(pageVO); + return success(ProductSkuConvert.INSTANCE.convertPage(pageResult)); } @GetMapping("/export-excel") @ApiOperation("导出商品sku Excel") @PreAuthorize("@ss.hasPermission('product:sku:export')") @OperateLog(type = EXPORT) - public void exportSkuExcel(@Valid SkuExportReqVO exportReqVO, + public void exportSkuExcel(@Valid ProductSkuExportReqVO exportReqVO, HttpServletResponse response) throws IOException { - List list = skuService.getSkuList(exportReqVO); + List list = ProductSkuService.getSkuList(exportReqVO); // 导出 Excel - List datas = SkuConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "商品sku.xls", "数据", SkuExcelVO.class, datas); + List datas = ProductSkuConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "商品sku.xls", "数据", ProductSkuExcelVO.class, datas); } } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java similarity index 89% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuBaseVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java index b91be42c9..9f351e9b7 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuBaseVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java @@ -10,7 +10,7 @@ import javax.validation.constraints.*; * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 */ @Data -public class SkuBaseVO { +public class ProductSkuBaseVO { @ApiModelProperty(value = "spu编号", required = true) @NotNull(message = "spu编号不能为空") @@ -18,7 +18,7 @@ public class SkuBaseVO { @ApiModelProperty(value = "规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]", required = true) @NotNull(message = "规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]不能为空") - private String properties; + private List properties; @ApiModelProperty(value = "销售价格,单位:分", required = true) @NotNull(message = "销售价格,单位:分不能为空") @@ -43,4 +43,10 @@ public class SkuBaseVO { @ApiModelProperty(value = "状态: 0-正常 1-禁用") private Integer status; + @Data + public static class Property { + private Integer propertyId; + private Integer valueId; + } + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuCreateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateReqVO.java similarity index 83% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuCreateReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateReqVO.java index 0de3632a3..e01c272a4 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuCreateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateReqVO.java @@ -9,6 +9,6 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SkuCreateReqVO extends SkuBaseVO { +public class ProductSkuCreateReqVO extends ProductSkuBaseVO { } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExcelVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExcelVO.java similarity index 83% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExcelVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExcelVO.java index 60382739f..0f31b4f23 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExcelVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExcelVO.java @@ -12,7 +12,7 @@ import com.alibaba.excel.annotation.ExcelProperty; * @author 芋道源码 */ @Data -public class SkuExcelVO { +public class ProductSkuExcelVO { @ExcelProperty("主键") private Integer id; @@ -21,7 +21,7 @@ public class SkuExcelVO { private Long spuId; @ExcelProperty("规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]") - private String properties; + private List properties; @ExcelProperty("销售价格,单位:分") private Integer price; @@ -44,4 +44,9 @@ public class SkuExcelVO { @ExcelProperty("创建时间") private Date createTime; + @Data + public static class Property { + private Integer propertyId; + private Integer valueId; + } } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExportReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExportReqVO.java similarity index 97% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExportReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExportReqVO.java index d934bc64e..76847a28f 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExportReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExportReqVO.java @@ -10,7 +10,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @ApiModel(value = "管理后台 - 商品sku Excel 导出 Request VO", description = "参数和 SkuPageReqVO 是一致的") @Data -public class SkuExportReqVO { +public class ProductSkuExportReqVO { @ApiModelProperty(value = "spu编号") private Long spuId; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuPageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuPageReqVO.java similarity index 96% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuPageReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuPageReqVO.java index 5536240aa..fcf8b95fc 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuPageReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuPageReqVO.java @@ -12,7 +12,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SkuPageReqVO extends PageParam { +public class ProductSkuPageReqVO extends PageParam { @ApiModelProperty(value = "spu编号") private Long spuId; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java similarity index 88% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuRespVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java index 220e6bad6..cf5e83fb7 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java @@ -8,7 +8,7 @@ import io.swagger.annotations.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SkuRespVO extends SkuBaseVO { +public class ProductSkuRespVO extends ProductSkuBaseVO { @ApiModelProperty(value = "主键", required = true) private Integer id; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuUpdateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuUpdateReqVO.java similarity index 87% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuUpdateReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuUpdateReqVO.java index cdf4e8557..ec79a09e9 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuUpdateReqVO.java @@ -9,7 +9,7 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SkuUpdateReqVO extends SkuBaseVO { +public class ProductSkuUpdateReqVO extends ProductSkuBaseVO { @ApiModelProperty(value = "主键", required = true) @NotNull(message = "主键不能为空") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/SpuController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java similarity index 77% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/SpuController.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java index 700d04fa4..742ffd83e 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/SpuController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java @@ -22,23 +22,23 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; -import cn.iocoder.yudao.module.product.convert.spu.SpuConvert; -import cn.iocoder.yudao.module.product.service.spu.SpuService; +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; +import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; +import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; @Api(tags = "管理后台 - 商品spu") @RestController @RequestMapping("/product/spu") @Validated -public class SpuController { +public class ProductSpuController { @Resource - private SpuService spuService; + private ProductSpuService spuService; @PostMapping("/create") @ApiOperation("创建商品spu") @PreAuthorize("@ss.hasPermission('product:spu:create')") - public CommonResult createSpu(@Valid @RequestBody SpuCreateReqVO createReqVO) { + public CommonResult createSpu(@Valid @RequestBody ProductSpuCreateReqVO createReqVO) { return success(spuService.createSpu(createReqVO)); } @@ -64,8 +64,8 @@ public class SpuController { @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class) @PreAuthorize("@ss.hasPermission('product:spu:query')") public CommonResult getSpu(@RequestParam("id") Integer id) { - SpuDO spu = spuService.getSpu(id); - return success(SpuConvert.INSTANCE.convert(spu)); + ProductSpuDO spu = spuService.getSpu(id); + return success(ProductSpuConvert.INSTANCE.convert(spu)); } @GetMapping("/list") @@ -73,16 +73,16 @@ public class SpuController { @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) @PreAuthorize("@ss.hasPermission('product:spu:query')") public CommonResult> getSpuList(@RequestParam("ids") Collection ids) { - List list = spuService.getSpuList(ids); - return success(SpuConvert.INSTANCE.convertList(list)); + List list = spuService.getSpuList(ids); + return success(ProductSpuConvert.INSTANCE.convertList(list)); } @GetMapping("/page") @ApiOperation("获得商品spu分页") @PreAuthorize("@ss.hasPermission('product:spu:query')") public CommonResult> getSpuPage(@Valid SpuPageReqVO pageVO) { - PageResult pageResult = spuService.getSpuPage(pageVO); - return success(SpuConvert.INSTANCE.convertPage(pageResult)); + PageResult pageResult = spuService.getSpuPage(pageVO); + return success(ProductSpuConvert.INSTANCE.convertPage(pageResult)); } @GetMapping("/export-excel") @@ -91,9 +91,9 @@ public class SpuController { @OperateLog(type = EXPORT) public void exportSpuExcel(@Valid SpuExportReqVO exportReqVO, HttpServletResponse response) throws IOException { - List list = spuService.getSpuList(exportReqVO); + List list = spuService.getSpuList(exportReqVO); // 导出 Excel - List datas = SpuConvert.INSTANCE.convertList02(list); + List datas = ProductSpuConvert.INSTANCE.convertList02(list); ExcelUtils.write(response, "商品spu.xls", "数据", SpuExcelVO.class, datas); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java similarity index 95% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuBaseVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java index 442fd34ba..65a5f2a0e 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuBaseVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java @@ -10,7 +10,7 @@ import javax.validation.constraints.*; * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 */ @Data -public class SpuBaseVO { +public class ProductSpuBaseVO { @ApiModelProperty(value = "商品名称") private String name; @@ -29,7 +29,7 @@ public class SpuBaseVO { @ApiModelProperty(value = "商品主图地址,* 数组,以逗号分隔,最多上传15张", required = true) @NotNull(message = "商品主图地址,* 数组,以逗号分隔,最多上传15张不能为空") - private String picUrls; + private List picUrls; @ApiModelProperty(value = "排序字段", required = true) @NotNull(message = "排序字段不能为空") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuCreateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuCreateReqVO.java similarity index 83% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuCreateReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuCreateReqVO.java index 53cbea5b8..fb24fbdcf 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuCreateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuCreateReqVO.java @@ -9,6 +9,6 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SpuCreateReqVO extends SpuBaseVO { +public class ProductSpuCreateReqVO extends ProductSpuBaseVO { } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExcelVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExcelVO.java index 3a8816111..9e90acd3d 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExcelVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExcelVO.java @@ -30,7 +30,7 @@ public class SpuExcelVO { private Long categoryId; @ExcelProperty("商品主图地址,* 数组,以逗号分隔,最多上传15张") - private String picUrls; + private List picUrls; @ExcelProperty("排序字段") private Integer sort; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExportReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExportReqVO.java index 93e390510..c5658a67e 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExportReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExportReqVO.java @@ -25,7 +25,7 @@ public class SpuExportReqVO { private Long categoryId; @ApiModelProperty(value = "商品主图地址,* 数组,以逗号分隔,最多上传15张") - private String picUrls; + private List picUrls; @ApiModelProperty(value = "排序字段") private Integer sort; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuRespVO.java index 2b5c90744..826b68a74 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuRespVO.java @@ -8,7 +8,7 @@ import io.swagger.annotations.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SpuRespVO extends SpuBaseVO { +public class SpuRespVO extends ProductSpuBaseVO { @ApiModelProperty(value = "主键", required = true) private Integer id; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuUpdateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuUpdateReqVO.java index c1222a168..6faac6586 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuUpdateReqVO.java @@ -9,7 +9,7 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SpuUpdateReqVO extends SpuBaseVO { +public class SpuUpdateReqVO extends ProductSpuBaseVO { @ApiModelProperty(value = "主键", required = true) @NotNull(message = "主键不能为空") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/ProductSkuConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/ProductSkuConvert.java new file mode 100755 index 000000000..3d6e4bd2b --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/ProductSkuConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.product.convert.sku; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; + +/** + * 商品sku Convert + * + * @author 芋道源码 + */ +@Mapper +public interface ProductSkuConvert { + + ProductSkuConvert INSTANCE = Mappers.getMapper(ProductSkuConvert.class); + + ProductSkuDO convert(ProductSkuCreateReqVO bean); + + ProductSkuDO convert(ProductSkuUpdateReqVO bean); + + ProductSkuRespVO convert(ProductSkuDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/SkuConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/SkuConvert.java deleted file mode 100755 index 62684692e..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/SkuConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.yudao.module.product.convert.sku; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; -import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; - -/** - * 商品sku Convert - * - * @author 芋道源码 - */ -@Mapper -public interface SkuConvert { - - SkuConvert INSTANCE = Mappers.getMapper(SkuConvert.class); - - SkuDO convert(SkuCreateReqVO bean); - - SkuDO convert(SkuUpdateReqVO bean); - - SkuRespVO convert(SkuDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java new file mode 100755 index 000000000..fb01e2dc2 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.product.convert.spu; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; + +/** + * 商品spu Convert + * + * @author 芋道源码 + */ +@Mapper +public interface ProductSpuConvert { + + ProductSpuConvert INSTANCE = Mappers.getMapper(ProductSpuConvert.class); + + ProductSpuDO convert(ProductSpuCreateReqVO bean); + + ProductSpuDO convert(SpuUpdateReqVO bean); + + SpuRespVO convert(ProductSpuDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/SpuConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/SpuConvert.java deleted file mode 100755 index bd3e05928..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/SpuConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.yudao.module.product.convert.spu; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; -import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; - -/** - * 商品spu Convert - * - * @author 芋道源码 - */ -@Mapper -public interface SpuConvert { - - SpuConvert INSTANCE = Mappers.getMapper(SpuConvert.class); - - SpuDO convert(SpuCreateReqVO bean); - - SpuDO convert(SpuUpdateReqVO bean); - - SpuRespVO convert(SpuDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/SkuDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java similarity index 86% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/SkuDO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java index f07184339..bf5866b77 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/SkuDO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java @@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; +import java.util.List; + /** * 商品sku DO * @@ -19,7 +21,7 @@ import lombok.*; @Builder @NoArgsConstructor @AllArgsConstructor -public class SkuDO extends BaseDO { +public class ProductSkuDO extends BaseDO { /** * 主键 @@ -34,7 +36,7 @@ public class SkuDO extends BaseDO { * 规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }] */ // TODO franky:可以定义一个内部的 Property 类,然后 List - private String properties; + private List properties; /** * 销售价格,单位:分 */ @@ -60,4 +62,11 @@ public class SkuDO extends BaseDO { */ private Integer status; + @Data + public static class Property { + private Integer propertyId; + private Integer valueId; + } + } + diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/SpuDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java similarity index 93% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/SpuDO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java index defd6799a..1486290ce 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/SpuDO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java @@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; +import java.util.List; + /** * 商品spu DO * @@ -19,7 +21,7 @@ import lombok.*; @Builder @NoArgsConstructor @AllArgsConstructor -public class SpuDO extends BaseDO { +public class ProductSpuDO extends BaseDO { /** * 主键 @@ -46,7 +48,7 @@ public class SpuDO extends BaseDO { * 商品主图地址,* 数组,以逗号分隔,最多上传15张 */ // TODO franky:List - private String picUrls; + private List picUrls; /** * 排序字段 */ diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java new file mode 100755 index 000000000..23fc2e1bd --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java @@ -0,0 +1,48 @@ +package cn.iocoder.yudao.module.product.dal.mysql.sku; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; + +/** + * 商品sku Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface ProductSkuMapper extends BaseMapperX { + + default PageResult selectPage(ProductSkuPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ProductSkuDO::getSpuId, reqVO.getSpuId()) + .eqIfPresent(ProductSkuDO::getProperties, reqVO.getProperties()) + .eqIfPresent(ProductSkuDO::getPrice, reqVO.getPrice()) + .eqIfPresent(ProductSkuDO::getOriginalPrice, reqVO.getOriginalPrice()) + .eqIfPresent(ProductSkuDO::getCostPrice, reqVO.getCostPrice()) + .eqIfPresent(ProductSkuDO::getBarCode, reqVO.getBarCode()) + .eqIfPresent(ProductSkuDO::getPicUrl, reqVO.getPicUrl()) + .eqIfPresent(ProductSkuDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(ProductSkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc(ProductSkuDO::getId)); + } + + default List selectList(ProductSkuExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(ProductSkuDO::getSpuId, reqVO.getSpuId()) + .eqIfPresent(ProductSkuDO::getProperties, reqVO.getProperties()) + .eqIfPresent(ProductSkuDO::getPrice, reqVO.getPrice()) + .eqIfPresent(ProductSkuDO::getOriginalPrice, reqVO.getOriginalPrice()) + .eqIfPresent(ProductSkuDO::getCostPrice, reqVO.getCostPrice()) + .eqIfPresent(ProductSkuDO::getBarCode, reqVO.getBarCode()) + .eqIfPresent(ProductSkuDO::getPicUrl, reqVO.getPicUrl()) + .eqIfPresent(ProductSkuDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(ProductSkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc(ProductSkuDO::getId)); + } + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/SkuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/SkuMapper.java deleted file mode 100755 index 15b2468eb..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/SkuMapper.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.iocoder.yudao.module.product.dal.mysql.sku; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; -import org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; - -/** - * 商品sku Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface SkuMapper extends BaseMapperX { - - default PageResult selectPage(SkuPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(SkuDO::getSpuId, reqVO.getSpuId()) - .eqIfPresent(SkuDO::getProperties, reqVO.getProperties()) - .eqIfPresent(SkuDO::getPrice, reqVO.getPrice()) - .eqIfPresent(SkuDO::getOriginalPrice, reqVO.getOriginalPrice()) - .eqIfPresent(SkuDO::getCostPrice, reqVO.getCostPrice()) - .eqIfPresent(SkuDO::getBarCode, reqVO.getBarCode()) - .eqIfPresent(SkuDO::getPicUrl, reqVO.getPicUrl()) - .eqIfPresent(SkuDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(SkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc(SkuDO::getId)); - } - - default List selectList(SkuExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .eqIfPresent(SkuDO::getSpuId, reqVO.getSpuId()) - .eqIfPresent(SkuDO::getProperties, reqVO.getProperties()) - .eqIfPresent(SkuDO::getPrice, reqVO.getPrice()) - .eqIfPresent(SkuDO::getOriginalPrice, reqVO.getOriginalPrice()) - .eqIfPresent(SkuDO::getCostPrice, reqVO.getCostPrice()) - .eqIfPresent(SkuDO::getBarCode, reqVO.getBarCode()) - .eqIfPresent(SkuDO::getPicUrl, reqVO.getPicUrl()) - .eqIfPresent(SkuDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(SkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc(SkuDO::getId)); - } - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java new file mode 100755 index 000000000..d6349eb2f --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java @@ -0,0 +1,52 @@ +package cn.iocoder.yudao.module.product.dal.mysql.spu; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; + +/** + * 商品spu Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface ProductSpuMapper extends BaseMapperX { + + default PageResult selectPage(SpuPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(ProductSpuDO::getName, reqVO.getName()) + .eqIfPresent(ProductSpuDO::getSellPoint, reqVO.getSellPoint()) + .eqIfPresent(ProductSpuDO::getDescription, reqVO.getDescription()) + .eqIfPresent(ProductSpuDO::getCategoryId, reqVO.getCategoryId()) + .eqIfPresent(ProductSpuDO::getPicUrls, reqVO.getPicUrls()) + .eqIfPresent(ProductSpuDO::getSort, reqVO.getSort()) + .eqIfPresent(ProductSpuDO::getLikeCount, reqVO.getLikeCount()) + .eqIfPresent(ProductSpuDO::getPrice, reqVO.getPrice()) + .eqIfPresent(ProductSpuDO::getQuantity, reqVO.getQuantity()) + .eqIfPresent(ProductSpuDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(ProductSpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc(ProductSpuDO::getId)); + } + + default List selectList(SpuExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(ProductSpuDO::getName, reqVO.getName()) + .eqIfPresent(ProductSpuDO::getSellPoint, reqVO.getSellPoint()) + .eqIfPresent(ProductSpuDO::getDescription, reqVO.getDescription()) + .eqIfPresent(ProductSpuDO::getCategoryId, reqVO.getCategoryId()) + .eqIfPresent(ProductSpuDO::getPicUrls, reqVO.getPicUrls()) + .eqIfPresent(ProductSpuDO::getSort, reqVO.getSort()) + .eqIfPresent(ProductSpuDO::getLikeCount, reqVO.getLikeCount()) + .eqIfPresent(ProductSpuDO::getPrice, reqVO.getPrice()) + .eqIfPresent(ProductSpuDO::getQuantity, reqVO.getQuantity()) + .eqIfPresent(ProductSpuDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(ProductSpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc(ProductSpuDO::getId)); + } + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/SpuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/SpuMapper.java deleted file mode 100755 index 932e68f34..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/SpuMapper.java +++ /dev/null @@ -1,52 +0,0 @@ -package cn.iocoder.yudao.module.product.dal.mysql.spu; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; -import org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; - -/** - * 商品spu Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface SpuMapper extends BaseMapperX { - - default PageResult selectPage(SpuPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .likeIfPresent(SpuDO::getName, reqVO.getName()) - .eqIfPresent(SpuDO::getSellPoint, reqVO.getSellPoint()) - .eqIfPresent(SpuDO::getDescription, reqVO.getDescription()) - .eqIfPresent(SpuDO::getCategoryId, reqVO.getCategoryId()) - .eqIfPresent(SpuDO::getPicUrls, reqVO.getPicUrls()) - .eqIfPresent(SpuDO::getSort, reqVO.getSort()) - .eqIfPresent(SpuDO::getLikeCount, reqVO.getLikeCount()) - .eqIfPresent(SpuDO::getPrice, reqVO.getPrice()) - .eqIfPresent(SpuDO::getQuantity, reqVO.getQuantity()) - .eqIfPresent(SpuDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(SpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc(SpuDO::getId)); - } - - default List selectList(SpuExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .likeIfPresent(SpuDO::getName, reqVO.getName()) - .eqIfPresent(SpuDO::getSellPoint, reqVO.getSellPoint()) - .eqIfPresent(SpuDO::getDescription, reqVO.getDescription()) - .eqIfPresent(SpuDO::getCategoryId, reqVO.getCategoryId()) - .eqIfPresent(SpuDO::getPicUrls, reqVO.getPicUrls()) - .eqIfPresent(SpuDO::getSort, reqVO.getSort()) - .eqIfPresent(SpuDO::getLikeCount, reqVO.getLikeCount()) - .eqIfPresent(SpuDO::getPrice, reqVO.getPrice()) - .eqIfPresent(SpuDO::getQuantity, reqVO.getQuantity()) - .eqIfPresent(SpuDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(SpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc(SpuDO::getId)); - } - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/SkuService.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuService.java similarity index 69% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/SkuService.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuService.java index f7bad6947..3cbe595c1 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/SkuService.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuService.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.product.service.sku; import java.util.*; import javax.validation.*; import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; /** @@ -11,7 +11,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; * * @author 芋道源码 */ -public interface SkuService { +public interface ProductSkuService { /** * 创建商品sku @@ -19,14 +19,14 @@ public interface SkuService { * @param createReqVO 创建信息 * @return 编号 */ - Integer createSku(@Valid SkuCreateReqVO createReqVO); + Integer createSku(@Valid ProductSkuCreateReqVO createReqVO); /** * 更新商品sku * * @param updateReqVO 更新信息 */ - void updateSku(@Valid SkuUpdateReqVO updateReqVO); + void updateSku(@Valid ProductSkuUpdateReqVO updateReqVO); /** * 删除商品sku @@ -41,7 +41,7 @@ public interface SkuService { * @param id 编号 * @return 商品sku */ - SkuDO getSku(Integer id); + ProductSkuDO getSku(Integer id); /** * 获得商品sku列表 @@ -49,7 +49,7 @@ public interface SkuService { * @param ids 编号 * @return 商品sku列表 */ - List getSkuList(Collection ids); + List getSkuList(Collection ids); /** * 获得商品sku分页 @@ -57,7 +57,7 @@ public interface SkuService { * @param pageReqVO 分页查询 * @return 商品sku分页 */ - PageResult getSkuPage(SkuPageReqVO pageReqVO); + PageResult getSkuPage(ProductSkuPageReqVO pageReqVO); /** * 获得商品sku列表, 用于 Excel 导出 @@ -65,6 +65,6 @@ public interface SkuService { * @param exportReqVO 查询条件 * @return 商品sku列表 */ - List getSkuList(SkuExportReqVO exportReqVO); + List getSkuList(ProductSkuExportReqVO exportReqVO); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java new file mode 100755 index 000000000..04bc3e369 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.product.service.sku; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; +import cn.iocoder.yudao.module.product.dal.mysql.sku.ProductSkuMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; + +/** + * 商品sku Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class ProductSkuServiceImpl implements ProductSkuService { + + @Resource + private ProductSkuMapper ProductSkuMapper; + + @Override + public Integer createSku(ProductSkuCreateReqVO createReqVO) { + // 插入 + ProductSkuDO sku = ProductSkuConvert.INSTANCE.convert(createReqVO); + ProductSkuMapper.insert(sku); + // 返回 + return sku.getId(); + } + + @Override + public void updateSku(ProductSkuUpdateReqVO updateReqVO) { + // 校验存在 + this.validateSkuExists(updateReqVO.getId()); + // 更新 + ProductSkuDO updateObj = ProductSkuConvert.INSTANCE.convert(updateReqVO); + ProductSkuMapper.updateById(updateObj); + } + + @Override + public void deleteSku(Integer id) { + // 校验存在 + this.validateSkuExists(id); + // 删除 + ProductSkuMapper.deleteById(id); + } + + private void validateSkuExists(Integer id) { + if (ProductSkuMapper.selectById(id) == null) { + throw exception(SKU_NOT_EXISTS); + } + } + + @Override + public ProductSkuDO getSku(Integer id) { + return ProductSkuMapper.selectById(id); + } + + @Override + public List getSkuList(Collection ids) { + return ProductSkuMapper.selectBatchIds(ids); + } + + @Override + public PageResult getSkuPage(ProductSkuPageReqVO pageReqVO) { + return ProductSkuMapper.selectPage(pageReqVO); + } + + @Override + public List getSkuList(ProductSkuExportReqVO exportReqVO) { + return ProductSkuMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImpl.java deleted file mode 100755 index 5984924f1..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -package cn.iocoder.yudao.module.product.service.sku; - -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; - -import java.util.*; -import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import cn.iocoder.yudao.module.product.convert.sku.SkuConvert; -import cn.iocoder.yudao.module.product.dal.mysql.sku.SkuMapper; - -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; - -/** - * 商品sku Service 实现类 - * - * @author 芋道源码 - */ -@Service -@Validated -public class SkuServiceImpl implements SkuService { - - @Resource - private SkuMapper skuMapper; - - @Override - public Integer createSku(SkuCreateReqVO createReqVO) { - // 插入 - SkuDO sku = SkuConvert.INSTANCE.convert(createReqVO); - skuMapper.insert(sku); - // 返回 - return sku.getId(); - } - - @Override - public void updateSku(SkuUpdateReqVO updateReqVO) { - // 校验存在 - this.validateSkuExists(updateReqVO.getId()); - // 更新 - SkuDO updateObj = SkuConvert.INSTANCE.convert(updateReqVO); - skuMapper.updateById(updateObj); - } - - @Override - public void deleteSku(Integer id) { - // 校验存在 - this.validateSkuExists(id); - // 删除 - skuMapper.deleteById(id); - } - - private void validateSkuExists(Integer id) { - if (skuMapper.selectById(id) == null) { - throw exception(SKU_NOT_EXISTS); - } - } - - @Override - public SkuDO getSku(Integer id) { - return skuMapper.selectById(id); - } - - @Override - public List getSkuList(Collection ids) { - return skuMapper.selectBatchIds(ids); - } - - @Override - public PageResult getSkuPage(SkuPageReqVO pageReqVO) { - return skuMapper.selectPage(pageReqVO); - } - - @Override - public List getSkuList(SkuExportReqVO exportReqVO) { - return skuMapper.selectList(exportReqVO); - } - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/SpuService.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java similarity index 73% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/SpuService.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java index e8ae06fe8..f0649ffe0 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/SpuService.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.product.service.spu; import java.util.*; import javax.validation.*; import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; /** @@ -11,7 +11,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; * * @author 芋道源码 */ -public interface SpuService { +public interface ProductSpuService { /** * 创建商品spu @@ -19,7 +19,7 @@ public interface SpuService { * @param createReqVO 创建信息 * @return 编号 */ - Integer createSpu(@Valid SpuCreateReqVO createReqVO); + Integer createSpu(@Valid ProductSpuCreateReqVO createReqVO); /** * 更新商品spu @@ -41,7 +41,7 @@ public interface SpuService { * @param id 编号 * @return 商品spu */ - SpuDO getSpu(Integer id); + ProductSpuDO getSpu(Integer id); /** * 获得商品spu列表 @@ -49,7 +49,7 @@ public interface SpuService { * @param ids 编号 * @return 商品spu列表 */ - List getSpuList(Collection ids); + List getSpuList(Collection ids); /** * 获得商品spu分页 @@ -57,7 +57,7 @@ public interface SpuService { * @param pageReqVO 分页查询 * @return 商品spu分页 */ - PageResult getSpuPage(SpuPageReqVO pageReqVO); + PageResult getSpuPage(SpuPageReqVO pageReqVO); /** * 获得商品spu列表, 用于 Excel 导出 @@ -65,6 +65,6 @@ public interface SpuService { * @param exportReqVO 查询条件 * @return 商品spu列表 */ - List getSpuList(SpuExportReqVO exportReqVO); + List getSpuList(SpuExportReqVO exportReqVO); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/SpuServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java similarity index 50% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/SpuServiceImpl.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java index 147c7bcde..a978852a6 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/SpuServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java @@ -6,11 +6,11 @@ import org.springframework.validation.annotation.Validated; import java.util.*; import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.product.convert.spu.SpuConvert; -import cn.iocoder.yudao.module.product.dal.mysql.spu.SpuMapper; +import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; +import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; @@ -22,16 +22,16 @@ import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; */ @Service @Validated -public class SpuServiceImpl implements SpuService { +public class ProductSpuServiceImpl implements ProductSpuService { @Resource - private SpuMapper spuMapper; + private ProductSpuMapper ProductSpuMapper; @Override - public Integer createSpu(SpuCreateReqVO createReqVO) { + public Integer createSpu(ProductSpuCreateReqVO createReqVO) { // 插入 - SpuDO spu = SpuConvert.INSTANCE.convert(createReqVO); - spuMapper.insert(spu); + ProductSpuDO spu = ProductSpuConvert.INSTANCE.convert(createReqVO); + ProductSpuMapper.insert(spu); // 返回 return spu.getId(); } @@ -41,8 +41,8 @@ public class SpuServiceImpl implements SpuService { // 校验存在 this.validateSpuExists(updateReqVO.getId()); // 更新 - SpuDO updateObj = SpuConvert.INSTANCE.convert(updateReqVO); - spuMapper.updateById(updateObj); + ProductSpuDO updateObj = ProductSpuConvert.INSTANCE.convert(updateReqVO); + ProductSpuMapper.updateById(updateObj); } @Override @@ -50,33 +50,33 @@ public class SpuServiceImpl implements SpuService { // 校验存在 this.validateSpuExists(id); // 删除 - spuMapper.deleteById(id); + ProductSpuMapper.deleteById(id); } private void validateSpuExists(Integer id) { - if (spuMapper.selectById(id) == null) { + if (ProductSpuMapper.selectById(id) == null) { throw exception(SPU_NOT_EXISTS); } } @Override - public SpuDO getSpu(Integer id) { - return spuMapper.selectById(id); + public ProductSpuDO getSpu(Integer id) { + return ProductSpuMapper.selectById(id); } @Override - public List getSpuList(Collection ids) { - return spuMapper.selectBatchIds(ids); + public List getSpuList(Collection ids) { + return ProductSpuMapper.selectBatchIds(ids); } @Override - public PageResult getSpuPage(SpuPageReqVO pageReqVO) { - return spuMapper.selectPage(pageReqVO); + public PageResult getSpuPage(SpuPageReqVO pageReqVO) { + return ProductSpuMapper.selectPage(pageReqVO); } @Override - public List getSpuList(SpuExportReqVO exportReqVO) { - return spuMapper.selectList(exportReqVO); + public List getSpuList(SpuExportReqVO exportReqVO) { + return ProductSpuMapper.selectList(exportReqVO); } } diff --git a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImplTest.java b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImplTest.java index 1b2085bd5..475d51614 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImplTest.java +++ b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImplTest.java @@ -9,8 +9,8 @@ import javax.annotation.Resource; import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; -import cn.iocoder.yudao.module.product.dal.mysql.sku.SkuMapper; +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; +import cn.iocoder.yudao.module.product.dal.mysql.sku.ProductSkuMapper; import cn.iocoder.yudao.framework.common.pojo.PageResult; import javax.annotation.Resource; @@ -27,71 +27,71 @@ import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; /** -* {@link SkuServiceImpl} 的单元测试类 +* {@link ProductSkuServiceImpl} 的单元测试类 * * @author 芋道源码 */ -@Import(SkuServiceImpl.class) +@Import(ProductSkuServiceImpl.class) public class SkuServiceImplTest extends BaseDbUnitTest { @Resource - private SkuServiceImpl skuService; + private ProductSkuServiceImpl ProductSkuService; @Resource - private SkuMapper skuMapper; + private ProductSkuMapper ProductSkuMapper; @Test public void testCreateSku_success() { // 准备参数 - SkuCreateReqVO reqVO = randomPojo(SkuCreateReqVO.class); + ProductSkuCreateReqVO reqVO = randomPojo(ProductSkuCreateReqVO.class); // 调用 - Integer skuId = skuService.createSku(reqVO); + Integer skuId = ProductSkuService.createSku(reqVO); // 断言 assertNotNull(skuId); // 校验记录的属性是否正确 - SkuDO sku = skuMapper.selectById(skuId); + ProductSkuDO sku = ProductSkuMapper.selectById(skuId); assertPojoEquals(reqVO, sku); } @Test public void testUpdateSku_success() { // mock 数据 - SkuDO dbSku = randomPojo(SkuDO.class); - skuMapper.insert(dbSku);// @Sql: 先插入出一条存在的数据 + ProductSkuDO dbSku = randomPojo(ProductSkuDO.class); + ProductSkuMapper.insert(dbSku);// @Sql: 先插入出一条存在的数据 // 准备参数 - SkuUpdateReqVO reqVO = randomPojo(SkuUpdateReqVO.class, o -> { + ProductSkuUpdateReqVO reqVO = randomPojo(ProductSkuUpdateReqVO.class, o -> { o.setId(dbSku.getId()); // 设置更新的 ID }); // 调用 - skuService.updateSku(reqVO); + ProductSkuService.updateSku(reqVO); // 校验是否更新正确 - SkuDO sku = skuMapper.selectById(reqVO.getId()); // 获取最新的 + ProductSkuDO sku = ProductSkuMapper.selectById(reqVO.getId()); // 获取最新的 assertPojoEquals(reqVO, sku); } @Test public void testUpdateSku_notExists() { // 准备参数 - SkuUpdateReqVO reqVO = randomPojo(SkuUpdateReqVO.class); + ProductSkuUpdateReqVO reqVO = randomPojo(ProductSkuUpdateReqVO.class); // 调用, 并断言异常 - assertServiceException(() -> skuService.updateSku(reqVO), SKU_NOT_EXISTS); + assertServiceException(() -> ProductSkuService.updateSku(reqVO), SKU_NOT_EXISTS); } @Test public void testDeleteSku_success() { // mock 数据 - SkuDO dbSku = randomPojo(SkuDO.class); - skuMapper.insert(dbSku);// @Sql: 先插入出一条存在的数据 + ProductSkuDO dbSku = randomPojo(ProductSkuDO.class); + ProductSkuMapper.insert(dbSku);// @Sql: 先插入出一条存在的数据 // 准备参数 Integer id = dbSku.getId(); // 调用 - skuService.deleteSku(id); + ProductSkuService.deleteSku(id); // 校验数据不存在了 - assertNull(skuMapper.selectById(id)); + assertNull(ProductSkuMapper.selectById(id)); } @Test @@ -100,14 +100,14 @@ public class SkuServiceImplTest extends BaseDbUnitTest { Integer id = 1; // 调用, 并断言异常 - assertServiceException(() -> skuService.deleteSku(id), SKU_NOT_EXISTS); + assertServiceException(() -> ProductSkuService.deleteSku(id), SKU_NOT_EXISTS); } @Test @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 public void testGetSkuPage() { // mock 数据 - SkuDO dbSku = randomPojo(SkuDO.class, o -> { // 等会查询到 + ProductSkuDO dbSku = randomPojo(ProductSkuDO.class, o -> { // 等会查询到 o.setSpuId(null); o.setProperties(null); o.setPrice(null); @@ -118,27 +118,27 @@ public class SkuServiceImplTest extends BaseDbUnitTest { o.setStatus(null); o.setCreateTime(null); }); - skuMapper.insert(dbSku); + ProductSkuMapper.insert(dbSku); // 测试 spuId 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSpuId(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSpuId(null))); // 测试 properties 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setProperties(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setProperties(null))); // 测试 price 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null))); // 测试 originalPrice 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); // 测试 costPrice 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null))); // 测试 barCode 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setBarCode(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setBarCode(null))); // 测试 picUrl 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPicUrl(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPicUrl(null))); // 测试 status 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setStatus(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setStatus(null))); // 测试 createTime 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null))); // 准备参数 - SkuPageReqVO reqVO = new SkuPageReqVO(); + ProductSkuPageReqVO reqVO = new ProductSkuPageReqVO(); reqVO.setSpuId(null); reqVO.setProperties(null); reqVO.setPrice(null); @@ -151,7 +151,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest { reqVO.setEndCreateTime(null); // 调用 - PageResult pageResult = skuService.getSkuPage(reqVO); + PageResult pageResult = ProductSkuService.getSkuPage(reqVO); // 断言 assertEquals(1, pageResult.getTotal()); assertEquals(1, pageResult.getList().size()); @@ -162,7 +162,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest { @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 public void testGetSkuList() { // mock 数据 - SkuDO dbSku = randomPojo(SkuDO.class, o -> { // 等会查询到 + ProductSkuDO dbSku = randomPojo(ProductSkuDO.class, o -> { // 等会查询到 o.setSpuId(null); o.setProperties(null); o.setPrice(null); @@ -173,27 +173,27 @@ public class SkuServiceImplTest extends BaseDbUnitTest { o.setStatus(null); o.setCreateTime(null); }); - skuMapper.insert(dbSku); + ProductSkuMapper.insert(dbSku); // 测试 spuId 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSpuId(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSpuId(null))); // 测试 properties 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setProperties(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setProperties(null))); // 测试 price 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null))); // 测试 originalPrice 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); // 测试 costPrice 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null))); // 测试 barCode 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setBarCode(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setBarCode(null))); // 测试 picUrl 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPicUrl(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPicUrl(null))); // 测试 status 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setStatus(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setStatus(null))); // 测试 createTime 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null))); // 准备参数 - SkuExportReqVO reqVO = new SkuExportReqVO(); + ProductSkuExportReqVO reqVO = new ProductSkuExportReqVO(); reqVO.setSpuId(null); reqVO.setProperties(null); reqVO.setPrice(null); @@ -206,7 +206,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest { reqVO.setEndCreateTime(null); // 调用 - List list = skuService.getSkuList(reqVO); + List list = ProductSkuService.getSkuList(reqVO); // 断言 assertEquals(1, list.size()); assertPojoEquals(dbSku, list.get(0)); diff --git a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/SpuServiceImplTest.java b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java similarity index 64% rename from yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/SpuServiceImplTest.java rename to yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java index c8bd50ad8..afbbdc027 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/SpuServiceImplTest.java +++ b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java @@ -9,8 +9,8 @@ import javax.annotation.Resource; import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; -import cn.iocoder.yudao.module.product.dal.mysql.spu.SpuMapper; +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; +import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper; import cn.iocoder.yudao.framework.common.pojo.PageResult; import javax.annotation.Resource; @@ -27,38 +27,38 @@ import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; /** -* {@link SpuServiceImpl} 的单元测试类 +* {@link ProductSpuServiceImpl} 的单元测试类 * * @author 芋道源码 */ -@Import(SpuServiceImpl.class) -public class SpuServiceImplTest extends BaseDbUnitTest { +@Import(ProductSpuServiceImpl.class) +public class ProductSpuServiceImplTest extends BaseDbUnitTest { @Resource - private SpuServiceImpl spuService; + private ProductSpuServiceImpl spuService; @Resource - private SpuMapper spuMapper; + private ProductSpuMapper ProductSpuMapper; @Test public void testCreateSpu_success() { // 准备参数 - SpuCreateReqVO reqVO = randomPojo(SpuCreateReqVO.class); + ProductSpuCreateReqVO reqVO = randomPojo(ProductSpuCreateReqVO.class); // 调用 Integer spuId = spuService.createSpu(reqVO); // 断言 assertNotNull(spuId); // 校验记录的属性是否正确 - SpuDO spu = spuMapper.selectById(spuId); + ProductSpuDO spu = ProductSpuMapper.selectById(spuId); assertPojoEquals(reqVO, spu); } @Test public void testUpdateSpu_success() { // mock 数据 - SpuDO dbSpu = randomPojo(SpuDO.class); - spuMapper.insert(dbSpu);// @Sql: 先插入出一条存在的数据 + ProductSpuDO dbSpu = randomPojo(ProductSpuDO.class); + ProductSpuMapper.insert(dbSpu);// @Sql: 先插入出一条存在的数据 // 准备参数 SpuUpdateReqVO reqVO = randomPojo(SpuUpdateReqVO.class, o -> { o.setId(dbSpu.getId()); // 设置更新的 ID @@ -67,7 +67,7 @@ public class SpuServiceImplTest extends BaseDbUnitTest { // 调用 spuService.updateSpu(reqVO); // 校验是否更新正确 - SpuDO spu = spuMapper.selectById(reqVO.getId()); // 获取最新的 + ProductSpuDO spu = ProductSpuMapper.selectById(reqVO.getId()); // 获取最新的 assertPojoEquals(reqVO, spu); } @@ -83,15 +83,15 @@ public class SpuServiceImplTest extends BaseDbUnitTest { @Test public void testDeleteSpu_success() { // mock 数据 - SpuDO dbSpu = randomPojo(SpuDO.class); - spuMapper.insert(dbSpu);// @Sql: 先插入出一条存在的数据 + ProductSpuDO dbSpu = randomPojo(ProductSpuDO.class); + ProductSpuMapper.insert(dbSpu);// @Sql: 先插入出一条存在的数据 // 准备参数 Integer id = dbSpu.getId(); // 调用 spuService.deleteSpu(id); // 校验数据不存在了 - assertNull(spuMapper.selectById(id)); + assertNull(ProductSpuMapper.selectById(id)); } @Test @@ -107,7 +107,7 @@ public class SpuServiceImplTest extends BaseDbUnitTest { @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 public void testGetSpuPage() { // mock 数据 - SpuDO dbSpu = randomPojo(SpuDO.class, o -> { // 等会查询到 + ProductSpuDO dbSpu = randomPojo(ProductSpuDO.class, o -> { // 等会查询到 o.setName(null); o.setSellPoint(null); o.setDescription(null); @@ -120,29 +120,29 @@ public class SpuServiceImplTest extends BaseDbUnitTest { o.setStatus(null); o.setCreateTime(null); }); - spuMapper.insert(dbSpu); + ProductSpuMapper.insert(dbSpu); // 测试 name 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setName(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setName(null))); // 测试 sellPoint 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSellPoint(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSellPoint(null))); // 测试 description 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setDescription(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setDescription(null))); // 测试 categoryId 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCategoryId(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCategoryId(null))); // 测试 picUrls 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPicUrls(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPicUrls(null))); // 测试 sort 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSort(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSort(null))); // 测试 likeCount 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null))); // 测试 price 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); // 测试 quantity 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null))); // 测试 status 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setStatus(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setStatus(null))); // 测试 createTime 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null))); // 准备参数 SpuPageReqVO reqVO = new SpuPageReqVO(); reqVO.setName(null); @@ -159,7 +159,7 @@ public class SpuServiceImplTest extends BaseDbUnitTest { reqVO.setEndCreateTime(null); // 调用 - PageResult pageResult = spuService.getSpuPage(reqVO); + PageResult pageResult = spuService.getSpuPage(reqVO); // 断言 assertEquals(1, pageResult.getTotal()); assertEquals(1, pageResult.getList().size()); @@ -170,7 +170,7 @@ public class SpuServiceImplTest extends BaseDbUnitTest { @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 public void testGetSpuList() { // mock 数据 - SpuDO dbSpu = randomPojo(SpuDO.class, o -> { // 等会查询到 + ProductSpuDO dbSpu = randomPojo(ProductSpuDO.class, o -> { // 等会查询到 o.setName(null); o.setSellPoint(null); o.setDescription(null); @@ -183,29 +183,29 @@ public class SpuServiceImplTest extends BaseDbUnitTest { o.setStatus(null); o.setCreateTime(null); }); - spuMapper.insert(dbSpu); + ProductSpuMapper.insert(dbSpu); // 测试 name 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setName(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setName(null))); // 测试 sellPoint 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSellPoint(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSellPoint(null))); // 测试 description 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setDescription(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setDescription(null))); // 测试 categoryId 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCategoryId(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCategoryId(null))); // 测试 picUrls 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPicUrls(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPicUrls(null))); // 测试 sort 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSort(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSort(null))); // 测试 likeCount 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null))); // 测试 price 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); // 测试 quantity 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null))); // 测试 status 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setStatus(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setStatus(null))); // 测试 createTime 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null))); // 准备参数 SpuExportReqVO reqVO = new SpuExportReqVO(); reqVO.setName(null); @@ -222,7 +222,7 @@ public class SpuServiceImplTest extends BaseDbUnitTest { reqVO.setEndCreateTime(null); // 调用 - List list = spuService.getSpuList(reqVO); + List list = spuService.getSpuList(reqVO); // 断言 assertEquals(1, list.size()); assertPojoEquals(dbSpu, list.get(0));