Commit eb5bdda3442fb7aa7856a2374bafb122fc4287b4
1 parent
e1c08c46
SPU名字重构
Showing
29 changed files
with
343 additions
and
321 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/SkuController.java renamed to 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; |
| 22 | 22 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; |
| 23 | 23 | |
| 24 | 24 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; |
| 25 | -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; | |
| 26 | -import cn.iocoder.yudao.module.product.convert.sku.SkuConvert; | |
| 27 | -import cn.iocoder.yudao.module.product.service.sku.SkuService; | |
| 25 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | |
| 26 | +import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; | |
| 27 | +import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; | |
| 28 | 28 | |
| 29 | 29 | @Api(tags = "管理后台 - 商品sku") |
| 30 | 30 | @RestController |
| 31 | 31 | @RequestMapping("/product/sku") |
| 32 | 32 | @Validated |
| 33 | -public class SkuController { | |
| 33 | +public class ProductSkuController { | |
| 34 | 34 | |
| 35 | 35 | @Resource |
| 36 | - private SkuService skuService; | |
| 36 | + private ProductSkuService ProductSkuService; | |
| 37 | 37 | |
| 38 | 38 | @PostMapping("/create") |
| 39 | 39 | @ApiOperation("创建商品sku") |
| 40 | 40 | @PreAuthorize("@ss.hasPermission('product:sku:create')") |
| 41 | - public CommonResult<Integer> createSku(@Valid @RequestBody SkuCreateReqVO createReqVO) { | |
| 42 | - return success(skuService.createSku(createReqVO)); | |
| 41 | + public CommonResult<Integer> createSku(@Valid @RequestBody ProductSkuCreateReqVO createReqVO) { | |
| 42 | + return success(ProductSkuService.createSku(createReqVO)); | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | @PutMapping("/update") |
| 46 | 46 | @ApiOperation("更新商品sku") |
| 47 | 47 | @PreAuthorize("@ss.hasPermission('product:sku:update')") |
| 48 | - public CommonResult<Boolean> updateSku(@Valid @RequestBody SkuUpdateReqVO updateReqVO) { | |
| 49 | - skuService.updateSku(updateReqVO); | |
| 48 | + public CommonResult<Boolean> updateSku(@Valid @RequestBody ProductSkuUpdateReqVO updateReqVO) { | |
| 49 | + ProductSkuService.updateSku(updateReqVO); | |
| 50 | 50 | return success(true); |
| 51 | 51 | } |
| 52 | 52 | |
| ... | ... | @@ -55,7 +55,7 @@ public class SkuController { |
| 55 | 55 | @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Integer.class) |
| 56 | 56 | @PreAuthorize("@ss.hasPermission('product:sku:delete')") |
| 57 | 57 | public CommonResult<Boolean> deleteSku(@RequestParam("id") Integer id) { |
| 58 | - skuService.deleteSku(id); | |
| 58 | + ProductSkuService.deleteSku(id); | |
| 59 | 59 | return success(true); |
| 60 | 60 | } |
| 61 | 61 | |
| ... | ... | @@ -63,38 +63,38 @@ public class SkuController { |
| 63 | 63 | @ApiOperation("获得商品sku") |
| 64 | 64 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class) |
| 65 | 65 | @PreAuthorize("@ss.hasPermission('product:sku:query')") |
| 66 | - public CommonResult<SkuRespVO> getSku(@RequestParam("id") Integer id) { | |
| 67 | - SkuDO sku = skuService.getSku(id); | |
| 68 | - return success(SkuConvert.INSTANCE.convert(sku)); | |
| 66 | + public CommonResult<ProductSkuRespVO> getSku(@RequestParam("id") Integer id) { | |
| 67 | + ProductSkuDO sku = ProductSkuService.getSku(id); | |
| 68 | + return success(ProductSkuConvert.INSTANCE.convert(sku)); | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | @GetMapping("/list") |
| 72 | 72 | @ApiOperation("获得商品sku列表") |
| 73 | 73 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) |
| 74 | 74 | @PreAuthorize("@ss.hasPermission('product:sku:query')") |
| 75 | - public CommonResult<List<SkuRespVO>> getSkuList(@RequestParam("ids") Collection<Integer> ids) { | |
| 76 | - List<SkuDO> list = skuService.getSkuList(ids); | |
| 77 | - return success(SkuConvert.INSTANCE.convertList(list)); | |
| 75 | + public CommonResult<List<ProductSkuRespVO>> getSkuList(@RequestParam("ids") Collection<Integer> ids) { | |
| 76 | + List<ProductSkuDO> list = ProductSkuService.getSkuList(ids); | |
| 77 | + return success(ProductSkuConvert.INSTANCE.convertList(list)); | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | @GetMapping("/page") |
| 81 | 81 | @ApiOperation("获得商品sku分页") |
| 82 | 82 | @PreAuthorize("@ss.hasPermission('product:sku:query')") |
| 83 | - public CommonResult<PageResult<SkuRespVO>> getSkuPage(@Valid SkuPageReqVO pageVO) { | |
| 84 | - PageResult<SkuDO> pageResult = skuService.getSkuPage(pageVO); | |
| 85 | - return success(SkuConvert.INSTANCE.convertPage(pageResult)); | |
| 83 | + public CommonResult<PageResult<ProductSkuRespVO>> getSkuPage(@Valid ProductSkuPageReqVO pageVO) { | |
| 84 | + PageResult<ProductSkuDO> pageResult = ProductSkuService.getSkuPage(pageVO); | |
| 85 | + return success(ProductSkuConvert.INSTANCE.convertPage(pageResult)); | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | @GetMapping("/export-excel") |
| 89 | 89 | @ApiOperation("导出商品sku Excel") |
| 90 | 90 | @PreAuthorize("@ss.hasPermission('product:sku:export')") |
| 91 | 91 | @OperateLog(type = EXPORT) |
| 92 | - public void exportSkuExcel(@Valid SkuExportReqVO exportReqVO, | |
| 92 | + public void exportSkuExcel(@Valid ProductSkuExportReqVO exportReqVO, | |
| 93 | 93 | HttpServletResponse response) throws IOException { |
| 94 | - List<SkuDO> list = skuService.getSkuList(exportReqVO); | |
| 94 | + List<ProductSkuDO> list = ProductSkuService.getSkuList(exportReqVO); | |
| 95 | 95 | // 导出 Excel |
| 96 | - List<SkuExcelVO> datas = SkuConvert.INSTANCE.convertList02(list); | |
| 97 | - ExcelUtils.write(response, "商品sku.xls", "数据", SkuExcelVO.class, datas); | |
| 96 | + List<ProductSkuExcelVO> datas = ProductSkuConvert.INSTANCE.convertList02(list); | |
| 97 | + ExcelUtils.write(response, "商品sku.xls", "数据", ProductSkuExcelVO.class, datas); | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuBaseVO.java renamed to 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.*; |
| 10 | 10 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 11 | 11 | */ |
| 12 | 12 | @Data |
| 13 | -public class SkuBaseVO { | |
| 13 | +public class ProductSkuBaseVO { | |
| 14 | 14 | |
| 15 | 15 | @ApiModelProperty(value = "spu编号", required = true) |
| 16 | 16 | @NotNull(message = "spu编号不能为空") |
| ... | ... | @@ -18,7 +18,7 @@ public class SkuBaseVO { |
| 18 | 18 | |
| 19 | 19 | @ApiModelProperty(value = "规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]", required = true) |
| 20 | 20 | @NotNull(message = "规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]不能为空") |
| 21 | - private String properties; | |
| 21 | + private List<Property> properties; | |
| 22 | 22 | |
| 23 | 23 | @ApiModelProperty(value = "销售价格,单位:分", required = true) |
| 24 | 24 | @NotNull(message = "销售价格,单位:分不能为空") |
| ... | ... | @@ -43,4 +43,10 @@ public class SkuBaseVO { |
| 43 | 43 | @ApiModelProperty(value = "状态: 0-正常 1-禁用") |
| 44 | 44 | private Integer status; |
| 45 | 45 | |
| 46 | + @Data | |
| 47 | + public static class Property { | |
| 48 | + private Integer propertyId; | |
| 49 | + private Integer valueId; | |
| 50 | + } | |
| 51 | + | |
| 46 | 52 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuCreateReqVO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateReqVO.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExcelVO.java renamed to 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; |
| 12 | 12 | * @author 芋道源码 |
| 13 | 13 | */ |
| 14 | 14 | @Data |
| 15 | -public class SkuExcelVO { | |
| 15 | +public class ProductSkuExcelVO { | |
| 16 | 16 | |
| 17 | 17 | @ExcelProperty("主键") |
| 18 | 18 | private Integer id; |
| ... | ... | @@ -21,7 +21,7 @@ public class SkuExcelVO { |
| 21 | 21 | private Long spuId; |
| 22 | 22 | |
| 23 | 23 | @ExcelProperty("规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]") |
| 24 | - private String properties; | |
| 24 | + private List<Property> properties; | |
| 25 | 25 | |
| 26 | 26 | @ExcelProperty("销售价格,单位:分") |
| 27 | 27 | private Integer price; |
| ... | ... | @@ -44,4 +44,9 @@ public class SkuExcelVO { |
| 44 | 44 | @ExcelProperty("创建时间") |
| 45 | 45 | private Date createTime; |
| 46 | 46 | |
| 47 | + @Data | |
| 48 | + public static class Property { | |
| 49 | + private Integer propertyId; | |
| 50 | + private Integer valueId; | |
| 51 | + } | |
| 47 | 52 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExportReqVO.java renamed to 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_ |
| 10 | 10 | |
| 11 | 11 | @ApiModel(value = "管理后台 - 商品sku Excel 导出 Request VO", description = "参数和 SkuPageReqVO 是一致的") |
| 12 | 12 | @Data |
| 13 | -public class SkuExportReqVO { | |
| 13 | +public class ProductSkuExportReqVO { | |
| 14 | 14 | |
| 15 | 15 | @ApiModelProperty(value = "spu编号") |
| 16 | 16 | private Long spuId; | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuPageReqVO.java renamed to 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_ |
| 12 | 12 | @Data |
| 13 | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | 14 | @ToString(callSuper = true) |
| 15 | -public class SkuPageReqVO extends PageParam { | |
| 15 | +public class ProductSkuPageReqVO extends PageParam { | |
| 16 | 16 | |
| 17 | 17 | @ApiModelProperty(value = "spu编号") |
| 18 | 18 | private Long spuId; | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuRespVO.java renamed to 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.*; |
| 8 | 8 | @Data |
| 9 | 9 | @EqualsAndHashCode(callSuper = true) |
| 10 | 10 | @ToString(callSuper = true) |
| 11 | -public class SkuRespVO extends SkuBaseVO { | |
| 11 | +public class ProductSkuRespVO extends ProductSkuBaseVO { | |
| 12 | 12 | |
| 13 | 13 | @ApiModelProperty(value = "主键", required = true) |
| 14 | 14 | private Integer id; | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuUpdateReqVO.java renamed to 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.*; |
| 9 | 9 | @Data |
| 10 | 10 | @EqualsAndHashCode(callSuper = true) |
| 11 | 11 | @ToString(callSuper = true) |
| 12 | -public class SkuUpdateReqVO extends SkuBaseVO { | |
| 12 | +public class ProductSkuUpdateReqVO extends ProductSkuBaseVO { | |
| 13 | 13 | |
| 14 | 14 | @ApiModelProperty(value = "主键", required = true) |
| 15 | 15 | @NotNull(message = "主键不能为空") | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/SpuController.java renamed to 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; |
| 22 | 22 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; |
| 23 | 23 | |
| 24 | 24 | import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; |
| 25 | -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; | |
| 26 | -import cn.iocoder.yudao.module.product.convert.spu.SpuConvert; | |
| 27 | -import cn.iocoder.yudao.module.product.service.spu.SpuService; | |
| 25 | +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | |
| 26 | +import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; | |
| 27 | +import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; | |
| 28 | 28 | |
| 29 | 29 | @Api(tags = "管理后台 - 商品spu") |
| 30 | 30 | @RestController |
| 31 | 31 | @RequestMapping("/product/spu") |
| 32 | 32 | @Validated |
| 33 | -public class SpuController { | |
| 33 | +public class ProductSpuController { | |
| 34 | 34 | |
| 35 | 35 | @Resource |
| 36 | - private SpuService spuService; | |
| 36 | + private ProductSpuService spuService; | |
| 37 | 37 | |
| 38 | 38 | @PostMapping("/create") |
| 39 | 39 | @ApiOperation("创建商品spu") |
| 40 | 40 | @PreAuthorize("@ss.hasPermission('product:spu:create')") |
| 41 | - public CommonResult<Integer> createSpu(@Valid @RequestBody SpuCreateReqVO createReqVO) { | |
| 41 | + public CommonResult<Integer> createSpu(@Valid @RequestBody ProductSpuCreateReqVO createReqVO) { | |
| 42 | 42 | return success(spuService.createSpu(createReqVO)); |
| 43 | 43 | } |
| 44 | 44 | |
| ... | ... | @@ -64,8 +64,8 @@ public class SpuController { |
| 64 | 64 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class) |
| 65 | 65 | @PreAuthorize("@ss.hasPermission('product:spu:query')") |
| 66 | 66 | public CommonResult<SpuRespVO> getSpu(@RequestParam("id") Integer id) { |
| 67 | - SpuDO spu = spuService.getSpu(id); | |
| 68 | - return success(SpuConvert.INSTANCE.convert(spu)); | |
| 67 | + ProductSpuDO spu = spuService.getSpu(id); | |
| 68 | + return success(ProductSpuConvert.INSTANCE.convert(spu)); | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | @GetMapping("/list") |
| ... | ... | @@ -73,16 +73,16 @@ public class SpuController { |
| 73 | 73 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) |
| 74 | 74 | @PreAuthorize("@ss.hasPermission('product:spu:query')") |
| 75 | 75 | public CommonResult<List<SpuRespVO>> getSpuList(@RequestParam("ids") Collection<Integer> ids) { |
| 76 | - List<SpuDO> list = spuService.getSpuList(ids); | |
| 77 | - return success(SpuConvert.INSTANCE.convertList(list)); | |
| 76 | + List<ProductSpuDO> list = spuService.getSpuList(ids); | |
| 77 | + return success(ProductSpuConvert.INSTANCE.convertList(list)); | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | @GetMapping("/page") |
| 81 | 81 | @ApiOperation("获得商品spu分页") |
| 82 | 82 | @PreAuthorize("@ss.hasPermission('product:spu:query')") |
| 83 | 83 | public CommonResult<PageResult<SpuRespVO>> getSpuPage(@Valid SpuPageReqVO pageVO) { |
| 84 | - PageResult<SpuDO> pageResult = spuService.getSpuPage(pageVO); | |
| 85 | - return success(SpuConvert.INSTANCE.convertPage(pageResult)); | |
| 84 | + PageResult<ProductSpuDO> pageResult = spuService.getSpuPage(pageVO); | |
| 85 | + return success(ProductSpuConvert.INSTANCE.convertPage(pageResult)); | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | @GetMapping("/export-excel") |
| ... | ... | @@ -91,9 +91,9 @@ public class SpuController { |
| 91 | 91 | @OperateLog(type = EXPORT) |
| 92 | 92 | public void exportSpuExcel(@Valid SpuExportReqVO exportReqVO, |
| 93 | 93 | HttpServletResponse response) throws IOException { |
| 94 | - List<SpuDO> list = spuService.getSpuList(exportReqVO); | |
| 94 | + List<ProductSpuDO> list = spuService.getSpuList(exportReqVO); | |
| 95 | 95 | // 导出 Excel |
| 96 | - List<SpuExcelVO> datas = SpuConvert.INSTANCE.convertList02(list); | |
| 96 | + List<SpuExcelVO> datas = ProductSpuConvert.INSTANCE.convertList02(list); | |
| 97 | 97 | ExcelUtils.write(response, "商品spu.xls", "数据", SpuExcelVO.class, datas); |
| 98 | 98 | } |
| 99 | 99 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuBaseVO.java renamed to 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.*; |
| 10 | 10 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 11 | 11 | */ |
| 12 | 12 | @Data |
| 13 | -public class SpuBaseVO { | |
| 13 | +public class ProductSpuBaseVO { | |
| 14 | 14 | |
| 15 | 15 | @ApiModelProperty(value = "商品名称") |
| 16 | 16 | private String name; |
| ... | ... | @@ -29,7 +29,7 @@ public class SpuBaseVO { |
| 29 | 29 | |
| 30 | 30 | @ApiModelProperty(value = "商品主图地址,* 数组,以逗号分隔,最多上传15张", required = true) |
| 31 | 31 | @NotNull(message = "商品主图地址,* 数组,以逗号分隔,最多上传15张不能为空") |
| 32 | - private String picUrls; | |
| 32 | + private List<String> picUrls; | |
| 33 | 33 | |
| 34 | 34 | @ApiModelProperty(value = "排序字段", required = true) |
| 35 | 35 | @NotNull(message = "排序字段不能为空") | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuCreateReqVO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuCreateReqVO.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExcelVO.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExportReqVO.java
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.*; |
| 8 | 8 | @Data |
| 9 | 9 | @EqualsAndHashCode(callSuper = true) |
| 10 | 10 | @ToString(callSuper = true) |
| 11 | -public class SpuRespVO extends SpuBaseVO { | |
| 11 | +public class SpuRespVO extends ProductSpuBaseVO { | |
| 12 | 12 | |
| 13 | 13 | @ApiModelProperty(value = "主键", required = true) |
| 14 | 14 | private Integer id; | ... | ... |
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.*; |
| 9 | 9 | @Data |
| 10 | 10 | @EqualsAndHashCode(callSuper = true) |
| 11 | 11 | @ToString(callSuper = true) |
| 12 | -public class SpuUpdateReqVO extends SpuBaseVO { | |
| 12 | +public class SpuUpdateReqVO extends ProductSpuBaseVO { | |
| 13 | 13 | |
| 14 | 14 | @ApiModelProperty(value = "主键", required = true) |
| 15 | 15 | @NotNull(message = "主键不能为空") | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/SkuConvert.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/ProductSkuConvert.java
| ... | ... | @@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 7 | import org.mapstruct.Mapper; |
| 8 | 8 | import org.mapstruct.factory.Mappers; |
| 9 | 9 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; |
| 10 | -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; | |
| 10 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * 商品sku Convert |
| ... | ... | @@ -15,20 +15,20 @@ import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; |
| 15 | 15 | * @author 芋道源码 |
| 16 | 16 | */ |
| 17 | 17 | @Mapper |
| 18 | -public interface SkuConvert { | |
| 18 | +public interface ProductSkuConvert { | |
| 19 | 19 | |
| 20 | - SkuConvert INSTANCE = Mappers.getMapper(SkuConvert.class); | |
| 20 | + ProductSkuConvert INSTANCE = Mappers.getMapper(ProductSkuConvert.class); | |
| 21 | 21 | |
| 22 | - SkuDO convert(SkuCreateReqVO bean); | |
| 22 | + ProductSkuDO convert(ProductSkuCreateReqVO bean); | |
| 23 | 23 | |
| 24 | - SkuDO convert(SkuUpdateReqVO bean); | |
| 24 | + ProductSkuDO convert(ProductSkuUpdateReqVO bean); | |
| 25 | 25 | |
| 26 | - SkuRespVO convert(SkuDO bean); | |
| 26 | + ProductSkuRespVO convert(ProductSkuDO bean); | |
| 27 | 27 | |
| 28 | - List<SkuRespVO> convertList(List<SkuDO> list); | |
| 28 | + List<ProductSkuRespVO> convertList(List<ProductSkuDO> list); | |
| 29 | 29 | |
| 30 | - PageResult<SkuRespVO> convertPage(PageResult<SkuDO> page); | |
| 30 | + PageResult<ProductSkuRespVO> convertPage(PageResult<ProductSkuDO> page); | |
| 31 | 31 | |
| 32 | - List<SkuExcelVO> convertList02(List<SkuDO> list); | |
| 32 | + List<ProductSkuExcelVO> convertList02(List<ProductSkuDO> list); | |
| 33 | 33 | |
| 34 | 34 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/SpuConvert.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java
| ... | ... | @@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 7 | import org.mapstruct.Mapper; |
| 8 | 8 | import org.mapstruct.factory.Mappers; |
| 9 | 9 | import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; |
| 10 | -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; | |
| 10 | +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * 商品spu Convert |
| ... | ... | @@ -15,20 +15,20 @@ import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; |
| 15 | 15 | * @author 芋道源码 |
| 16 | 16 | */ |
| 17 | 17 | @Mapper |
| 18 | -public interface SpuConvert { | |
| 18 | +public interface ProductSpuConvert { | |
| 19 | 19 | |
| 20 | - SpuConvert INSTANCE = Mappers.getMapper(SpuConvert.class); | |
| 20 | + ProductSpuConvert INSTANCE = Mappers.getMapper(ProductSpuConvert.class); | |
| 21 | 21 | |
| 22 | - SpuDO convert(SpuCreateReqVO bean); | |
| 22 | + ProductSpuDO convert(ProductSpuCreateReqVO bean); | |
| 23 | 23 | |
| 24 | - SpuDO convert(SpuUpdateReqVO bean); | |
| 24 | + ProductSpuDO convert(SpuUpdateReqVO bean); | |
| 25 | 25 | |
| 26 | - SpuRespVO convert(SpuDO bean); | |
| 26 | + SpuRespVO convert(ProductSpuDO bean); | |
| 27 | 27 | |
| 28 | - List<SpuRespVO> convertList(List<SpuDO> list); | |
| 28 | + List<SpuRespVO> convertList(List<ProductSpuDO> list); | |
| 29 | 29 | |
| 30 | - PageResult<SpuRespVO> convertPage(PageResult<SpuDO> page); | |
| 30 | + PageResult<SpuRespVO> convertPage(PageResult<ProductSpuDO> page); | |
| 31 | 31 | |
| 32 | - List<SpuExcelVO> convertList02(List<SpuDO> list); | |
| 32 | + List<SpuExcelVO> convertList02(List<ProductSpuDO> list); | |
| 33 | 33 | |
| 34 | 34 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/SkuDO.java renamed to 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; |
| 6 | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | 7 | import lombok.*; |
| 8 | 8 | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 9 | 11 | /** |
| 10 | 12 | * 商品sku DO |
| 11 | 13 | * |
| ... | ... | @@ -19,7 +21,7 @@ import lombok.*; |
| 19 | 21 | @Builder |
| 20 | 22 | @NoArgsConstructor |
| 21 | 23 | @AllArgsConstructor |
| 22 | -public class SkuDO extends BaseDO { | |
| 24 | +public class ProductSkuDO extends BaseDO { | |
| 23 | 25 | |
| 24 | 26 | /** |
| 25 | 27 | * 主键 |
| ... | ... | @@ -34,7 +36,7 @@ public class SkuDO extends BaseDO { |
| 34 | 36 | * 规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }] |
| 35 | 37 | */ |
| 36 | 38 | // TODO franky:可以定义一个内部的 Property 类,然后 List<Property> |
| 37 | - private String properties; | |
| 39 | + private List<Property> properties; | |
| 38 | 40 | /** |
| 39 | 41 | * 销售价格,单位:分 |
| 40 | 42 | */ |
| ... | ... | @@ -60,4 +62,11 @@ public class SkuDO extends BaseDO { |
| 60 | 62 | */ |
| 61 | 63 | private Integer status; |
| 62 | 64 | |
| 65 | + @Data | |
| 66 | + public static class Property { | |
| 67 | + private Integer propertyId; | |
| 68 | + private Integer valueId; | |
| 69 | + } | |
| 70 | + | |
| 63 | 71 | } |
| 72 | + | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/SpuDO.java renamed to 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; |
| 6 | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | 7 | import lombok.*; |
| 8 | 8 | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 9 | 11 | /** |
| 10 | 12 | * 商品spu DO |
| 11 | 13 | * |
| ... | ... | @@ -19,7 +21,7 @@ import lombok.*; |
| 19 | 21 | @Builder |
| 20 | 22 | @NoArgsConstructor |
| 21 | 23 | @AllArgsConstructor |
| 22 | -public class SpuDO extends BaseDO { | |
| 24 | +public class ProductSpuDO extends BaseDO { | |
| 23 | 25 | |
| 24 | 26 | /** |
| 25 | 27 | * 主键 |
| ... | ... | @@ -46,7 +48,7 @@ public class SpuDO extends BaseDO { |
| 46 | 48 | * 商品主图地址,* 数组,以逗号分隔,最多上传15张 |
| 47 | 49 | */ |
| 48 | 50 | // TODO franky:List<String> |
| 49 | - private String picUrls; | |
| 51 | + private List<String> picUrls; | |
| 50 | 52 | /** |
| 51 | 53 | * 排序字段 |
| 52 | 54 | */ | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java
0 → 100755
| 1 | +package cn.iocoder.yudao.module.product.dal.mysql.sku; | |
| 2 | + | |
| 3 | +import java.util.*; | |
| 4 | + | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 8 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | +import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 商品sku Mapper | |
| 14 | + * | |
| 15 | + * @author 芋道源码 | |
| 16 | + */ | |
| 17 | +@Mapper | |
| 18 | +public interface ProductSkuMapper extends BaseMapperX<ProductSkuDO> { | |
| 19 | + | |
| 20 | + default PageResult<ProductSkuDO> selectPage(ProductSkuPageReqVO reqVO) { | |
| 21 | + return selectPage(reqVO, new LambdaQueryWrapperX<ProductSkuDO>() | |
| 22 | + .eqIfPresent(ProductSkuDO::getSpuId, reqVO.getSpuId()) | |
| 23 | + .eqIfPresent(ProductSkuDO::getProperties, reqVO.getProperties()) | |
| 24 | + .eqIfPresent(ProductSkuDO::getPrice, reqVO.getPrice()) | |
| 25 | + .eqIfPresent(ProductSkuDO::getOriginalPrice, reqVO.getOriginalPrice()) | |
| 26 | + .eqIfPresent(ProductSkuDO::getCostPrice, reqVO.getCostPrice()) | |
| 27 | + .eqIfPresent(ProductSkuDO::getBarCode, reqVO.getBarCode()) | |
| 28 | + .eqIfPresent(ProductSkuDO::getPicUrl, reqVO.getPicUrl()) | |
| 29 | + .eqIfPresent(ProductSkuDO::getStatus, reqVO.getStatus()) | |
| 30 | + .betweenIfPresent(ProductSkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 31 | + .orderByDesc(ProductSkuDO::getId)); | |
| 32 | + } | |
| 33 | + | |
| 34 | + default List<ProductSkuDO> selectList(ProductSkuExportReqVO reqVO) { | |
| 35 | + return selectList(new LambdaQueryWrapperX<ProductSkuDO>() | |
| 36 | + .eqIfPresent(ProductSkuDO::getSpuId, reqVO.getSpuId()) | |
| 37 | + .eqIfPresent(ProductSkuDO::getProperties, reqVO.getProperties()) | |
| 38 | + .eqIfPresent(ProductSkuDO::getPrice, reqVO.getPrice()) | |
| 39 | + .eqIfPresent(ProductSkuDO::getOriginalPrice, reqVO.getOriginalPrice()) | |
| 40 | + .eqIfPresent(ProductSkuDO::getCostPrice, reqVO.getCostPrice()) | |
| 41 | + .eqIfPresent(ProductSkuDO::getBarCode, reqVO.getBarCode()) | |
| 42 | + .eqIfPresent(ProductSkuDO::getPicUrl, reqVO.getPicUrl()) | |
| 43 | + .eqIfPresent(ProductSkuDO::getStatus, reqVO.getStatus()) | |
| 44 | + .betweenIfPresent(ProductSkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 45 | + .orderByDesc(ProductSkuDO::getId)); | |
| 46 | + } | |
| 47 | + | |
| 48 | +} | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/SkuMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.product.dal.mysql.sku; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 8 | -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | -import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 商品sku Mapper | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface SkuMapper extends BaseMapperX<SkuDO> { | |
| 19 | - | |
| 20 | - default PageResult<SkuDO> selectPage(SkuPageReqVO reqVO) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<SkuDO>() | |
| 22 | - .eqIfPresent(SkuDO::getSpuId, reqVO.getSpuId()) | |
| 23 | - .eqIfPresent(SkuDO::getProperties, reqVO.getProperties()) | |
| 24 | - .eqIfPresent(SkuDO::getPrice, reqVO.getPrice()) | |
| 25 | - .eqIfPresent(SkuDO::getOriginalPrice, reqVO.getOriginalPrice()) | |
| 26 | - .eqIfPresent(SkuDO::getCostPrice, reqVO.getCostPrice()) | |
| 27 | - .eqIfPresent(SkuDO::getBarCode, reqVO.getBarCode()) | |
| 28 | - .eqIfPresent(SkuDO::getPicUrl, reqVO.getPicUrl()) | |
| 29 | - .eqIfPresent(SkuDO::getStatus, reqVO.getStatus()) | |
| 30 | - .betweenIfPresent(SkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 31 | - .orderByDesc(SkuDO::getId)); | |
| 32 | - } | |
| 33 | - | |
| 34 | - default List<SkuDO> selectList(SkuExportReqVO reqVO) { | |
| 35 | - return selectList(new LambdaQueryWrapperX<SkuDO>() | |
| 36 | - .eqIfPresent(SkuDO::getSpuId, reqVO.getSpuId()) | |
| 37 | - .eqIfPresent(SkuDO::getProperties, reqVO.getProperties()) | |
| 38 | - .eqIfPresent(SkuDO::getPrice, reqVO.getPrice()) | |
| 39 | - .eqIfPresent(SkuDO::getOriginalPrice, reqVO.getOriginalPrice()) | |
| 40 | - .eqIfPresent(SkuDO::getCostPrice, reqVO.getCostPrice()) | |
| 41 | - .eqIfPresent(SkuDO::getBarCode, reqVO.getBarCode()) | |
| 42 | - .eqIfPresent(SkuDO::getPicUrl, reqVO.getPicUrl()) | |
| 43 | - .eqIfPresent(SkuDO::getStatus, reqVO.getStatus()) | |
| 44 | - .betweenIfPresent(SkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 45 | - .orderByDesc(SkuDO::getId)); | |
| 46 | - } | |
| 47 | - | |
| 48 | -} |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java
0 → 100755
| 1 | +package cn.iocoder.yudao.module.product.dal.mysql.spu; | |
| 2 | + | |
| 3 | +import java.util.*; | |
| 4 | + | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 8 | +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | +import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 商品spu Mapper | |
| 14 | + * | |
| 15 | + * @author 芋道源码 | |
| 16 | + */ | |
| 17 | +@Mapper | |
| 18 | +public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> { | |
| 19 | + | |
| 20 | + default PageResult<ProductSpuDO> selectPage(SpuPageReqVO reqVO) { | |
| 21 | + return selectPage(reqVO, new LambdaQueryWrapperX<ProductSpuDO>() | |
| 22 | + .likeIfPresent(ProductSpuDO::getName, reqVO.getName()) | |
| 23 | + .eqIfPresent(ProductSpuDO::getSellPoint, reqVO.getSellPoint()) | |
| 24 | + .eqIfPresent(ProductSpuDO::getDescription, reqVO.getDescription()) | |
| 25 | + .eqIfPresent(ProductSpuDO::getCategoryId, reqVO.getCategoryId()) | |
| 26 | + .eqIfPresent(ProductSpuDO::getPicUrls, reqVO.getPicUrls()) | |
| 27 | + .eqIfPresent(ProductSpuDO::getSort, reqVO.getSort()) | |
| 28 | + .eqIfPresent(ProductSpuDO::getLikeCount, reqVO.getLikeCount()) | |
| 29 | + .eqIfPresent(ProductSpuDO::getPrice, reqVO.getPrice()) | |
| 30 | + .eqIfPresent(ProductSpuDO::getQuantity, reqVO.getQuantity()) | |
| 31 | + .eqIfPresent(ProductSpuDO::getStatus, reqVO.getStatus()) | |
| 32 | + .betweenIfPresent(ProductSpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 33 | + .orderByDesc(ProductSpuDO::getId)); | |
| 34 | + } | |
| 35 | + | |
| 36 | + default List<ProductSpuDO> selectList(SpuExportReqVO reqVO) { | |
| 37 | + return selectList(new LambdaQueryWrapperX<ProductSpuDO>() | |
| 38 | + .likeIfPresent(ProductSpuDO::getName, reqVO.getName()) | |
| 39 | + .eqIfPresent(ProductSpuDO::getSellPoint, reqVO.getSellPoint()) | |
| 40 | + .eqIfPresent(ProductSpuDO::getDescription, reqVO.getDescription()) | |
| 41 | + .eqIfPresent(ProductSpuDO::getCategoryId, reqVO.getCategoryId()) | |
| 42 | + .eqIfPresent(ProductSpuDO::getPicUrls, reqVO.getPicUrls()) | |
| 43 | + .eqIfPresent(ProductSpuDO::getSort, reqVO.getSort()) | |
| 44 | + .eqIfPresent(ProductSpuDO::getLikeCount, reqVO.getLikeCount()) | |
| 45 | + .eqIfPresent(ProductSpuDO::getPrice, reqVO.getPrice()) | |
| 46 | + .eqIfPresent(ProductSpuDO::getQuantity, reqVO.getQuantity()) | |
| 47 | + .eqIfPresent(ProductSpuDO::getStatus, reqVO.getStatus()) | |
| 48 | + .betweenIfPresent(ProductSpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 49 | + .orderByDesc(ProductSpuDO::getId)); | |
| 50 | + } | |
| 51 | + | |
| 52 | +} | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/SpuMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.product.dal.mysql.spu; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 8 | -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | -import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 商品spu Mapper | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface SpuMapper extends BaseMapperX<SpuDO> { | |
| 19 | - | |
| 20 | - default PageResult<SpuDO> selectPage(SpuPageReqVO reqVO) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<SpuDO>() | |
| 22 | - .likeIfPresent(SpuDO::getName, reqVO.getName()) | |
| 23 | - .eqIfPresent(SpuDO::getSellPoint, reqVO.getSellPoint()) | |
| 24 | - .eqIfPresent(SpuDO::getDescription, reqVO.getDescription()) | |
| 25 | - .eqIfPresent(SpuDO::getCategoryId, reqVO.getCategoryId()) | |
| 26 | - .eqIfPresent(SpuDO::getPicUrls, reqVO.getPicUrls()) | |
| 27 | - .eqIfPresent(SpuDO::getSort, reqVO.getSort()) | |
| 28 | - .eqIfPresent(SpuDO::getLikeCount, reqVO.getLikeCount()) | |
| 29 | - .eqIfPresent(SpuDO::getPrice, reqVO.getPrice()) | |
| 30 | - .eqIfPresent(SpuDO::getQuantity, reqVO.getQuantity()) | |
| 31 | - .eqIfPresent(SpuDO::getStatus, reqVO.getStatus()) | |
| 32 | - .betweenIfPresent(SpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 33 | - .orderByDesc(SpuDO::getId)); | |
| 34 | - } | |
| 35 | - | |
| 36 | - default List<SpuDO> selectList(SpuExportReqVO reqVO) { | |
| 37 | - return selectList(new LambdaQueryWrapperX<SpuDO>() | |
| 38 | - .likeIfPresent(SpuDO::getName, reqVO.getName()) | |
| 39 | - .eqIfPresent(SpuDO::getSellPoint, reqVO.getSellPoint()) | |
| 40 | - .eqIfPresent(SpuDO::getDescription, reqVO.getDescription()) | |
| 41 | - .eqIfPresent(SpuDO::getCategoryId, reqVO.getCategoryId()) | |
| 42 | - .eqIfPresent(SpuDO::getPicUrls, reqVO.getPicUrls()) | |
| 43 | - .eqIfPresent(SpuDO::getSort, reqVO.getSort()) | |
| 44 | - .eqIfPresent(SpuDO::getLikeCount, reqVO.getLikeCount()) | |
| 45 | - .eqIfPresent(SpuDO::getPrice, reqVO.getPrice()) | |
| 46 | - .eqIfPresent(SpuDO::getQuantity, reqVO.getQuantity()) | |
| 47 | - .eqIfPresent(SpuDO::getStatus, reqVO.getStatus()) | |
| 48 | - .betweenIfPresent(SpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 49 | - .orderByDesc(SpuDO::getId)); | |
| 50 | - } | |
| 51 | - | |
| 52 | -} |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/SkuService.java renamed to 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; |
| 3 | 3 | import java.util.*; |
| 4 | 4 | import javax.validation.*; |
| 5 | 5 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; |
| 6 | -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; | |
| 6 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | |
| 7 | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 8 | 8 | |
| 9 | 9 | /** |
| ... | ... | @@ -11,7 +11,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 11 | 11 | * |
| 12 | 12 | * @author 芋道源码 |
| 13 | 13 | */ |
| 14 | -public interface SkuService { | |
| 14 | +public interface ProductSkuService { | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * 创建商品sku |
| ... | ... | @@ -19,14 +19,14 @@ public interface SkuService { |
| 19 | 19 | * @param createReqVO 创建信息 |
| 20 | 20 | * @return 编号 |
| 21 | 21 | */ |
| 22 | - Integer createSku(@Valid SkuCreateReqVO createReqVO); | |
| 22 | + Integer createSku(@Valid ProductSkuCreateReqVO createReqVO); | |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * 更新商品sku |
| 26 | 26 | * |
| 27 | 27 | * @param updateReqVO 更新信息 |
| 28 | 28 | */ |
| 29 | - void updateSku(@Valid SkuUpdateReqVO updateReqVO); | |
| 29 | + void updateSku(@Valid ProductSkuUpdateReqVO updateReqVO); | |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * 删除商品sku |
| ... | ... | @@ -41,7 +41,7 @@ public interface SkuService { |
| 41 | 41 | * @param id 编号 |
| 42 | 42 | * @return 商品sku |
| 43 | 43 | */ |
| 44 | - SkuDO getSku(Integer id); | |
| 44 | + ProductSkuDO getSku(Integer id); | |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * 获得商品sku列表 |
| ... | ... | @@ -49,7 +49,7 @@ public interface SkuService { |
| 49 | 49 | * @param ids 编号 |
| 50 | 50 | * @return 商品sku列表 |
| 51 | 51 | */ |
| 52 | - List<SkuDO> getSkuList(Collection<Integer> ids); | |
| 52 | + List<ProductSkuDO> getSkuList(Collection<Integer> ids); | |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * 获得商品sku分页 |
| ... | ... | @@ -57,7 +57,7 @@ public interface SkuService { |
| 57 | 57 | * @param pageReqVO 分页查询 |
| 58 | 58 | * @return 商品sku分页 |
| 59 | 59 | */ |
| 60 | - PageResult<SkuDO> getSkuPage(SkuPageReqVO pageReqVO); | |
| 60 | + PageResult<ProductSkuDO> getSkuPage(ProductSkuPageReqVO pageReqVO); | |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * 获得商品sku列表, 用于 Excel 导出 |
| ... | ... | @@ -65,6 +65,6 @@ public interface SkuService { |
| 65 | 65 | * @param exportReqVO 查询条件 |
| 66 | 66 | * @return 商品sku列表 |
| 67 | 67 | */ |
| 68 | - List<SkuDO> getSkuList(SkuExportReqVO exportReqVO); | |
| 68 | + List<ProductSkuDO> getSkuList(ProductSkuExportReqVO exportReqVO); | |
| 69 | 69 | |
| 70 | 70 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImpl.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java
| ... | ... | @@ -6,11 +6,11 @@ import org.springframework.validation.annotation.Validated; |
| 6 | 6 | |
| 7 | 7 | import java.util.*; |
| 8 | 8 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; |
| 9 | -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; | |
| 9 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | |
| 10 | 10 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 11 | 11 | |
| 12 | -import cn.iocoder.yudao.module.product.convert.sku.SkuConvert; | |
| 13 | -import cn.iocoder.yudao.module.product.dal.mysql.sku.SkuMapper; | |
| 12 | +import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; | |
| 13 | +import cn.iocoder.yudao.module.product.dal.mysql.sku.ProductSkuMapper; | |
| 14 | 14 | |
| 15 | 15 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 16 | 16 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; |
| ... | ... | @@ -22,27 +22,27 @@ import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; |
| 22 | 22 | */ |
| 23 | 23 | @Service |
| 24 | 24 | @Validated |
| 25 | -public class SkuServiceImpl implements SkuService { | |
| 25 | +public class ProductSkuServiceImpl implements ProductSkuService { | |
| 26 | 26 | |
| 27 | 27 | @Resource |
| 28 | - private SkuMapper skuMapper; | |
| 28 | + private ProductSkuMapper ProductSkuMapper; | |
| 29 | 29 | |
| 30 | 30 | @Override |
| 31 | - public Integer createSku(SkuCreateReqVO createReqVO) { | |
| 31 | + public Integer createSku(ProductSkuCreateReqVO createReqVO) { | |
| 32 | 32 | // 插入 |
| 33 | - SkuDO sku = SkuConvert.INSTANCE.convert(createReqVO); | |
| 34 | - skuMapper.insert(sku); | |
| 33 | + ProductSkuDO sku = ProductSkuConvert.INSTANCE.convert(createReqVO); | |
| 34 | + ProductSkuMapper.insert(sku); | |
| 35 | 35 | // 返回 |
| 36 | 36 | return sku.getId(); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | @Override |
| 40 | - public void updateSku(SkuUpdateReqVO updateReqVO) { | |
| 40 | + public void updateSku(ProductSkuUpdateReqVO updateReqVO) { | |
| 41 | 41 | // 校验存在 |
| 42 | 42 | this.validateSkuExists(updateReqVO.getId()); |
| 43 | 43 | // 更新 |
| 44 | - SkuDO updateObj = SkuConvert.INSTANCE.convert(updateReqVO); | |
| 45 | - skuMapper.updateById(updateObj); | |
| 44 | + ProductSkuDO updateObj = ProductSkuConvert.INSTANCE.convert(updateReqVO); | |
| 45 | + ProductSkuMapper.updateById(updateObj); | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | @Override |
| ... | ... | @@ -50,33 +50,33 @@ public class SkuServiceImpl implements SkuService { |
| 50 | 50 | // 校验存在 |
| 51 | 51 | this.validateSkuExists(id); |
| 52 | 52 | // 删除 |
| 53 | - skuMapper.deleteById(id); | |
| 53 | + ProductSkuMapper.deleteById(id); | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | private void validateSkuExists(Integer id) { |
| 57 | - if (skuMapper.selectById(id) == null) { | |
| 57 | + if (ProductSkuMapper.selectById(id) == null) { | |
| 58 | 58 | throw exception(SKU_NOT_EXISTS); |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | @Override |
| 63 | - public SkuDO getSku(Integer id) { | |
| 64 | - return skuMapper.selectById(id); | |
| 63 | + public ProductSkuDO getSku(Integer id) { | |
| 64 | + return ProductSkuMapper.selectById(id); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | @Override |
| 68 | - public List<SkuDO> getSkuList(Collection<Integer> ids) { | |
| 69 | - return skuMapper.selectBatchIds(ids); | |
| 68 | + public List<ProductSkuDO> getSkuList(Collection<Integer> ids) { | |
| 69 | + return ProductSkuMapper.selectBatchIds(ids); | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | @Override |
| 73 | - public PageResult<SkuDO> getSkuPage(SkuPageReqVO pageReqVO) { | |
| 74 | - return skuMapper.selectPage(pageReqVO); | |
| 73 | + public PageResult<ProductSkuDO> getSkuPage(ProductSkuPageReqVO pageReqVO) { | |
| 74 | + return ProductSkuMapper.selectPage(pageReqVO); | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | @Override |
| 78 | - public List<SkuDO> getSkuList(SkuExportReqVO exportReqVO) { | |
| 79 | - return skuMapper.selectList(exportReqVO); | |
| 78 | + public List<ProductSkuDO> getSkuList(ProductSkuExportReqVO exportReqVO) { | |
| 79 | + return ProductSkuMapper.selectList(exportReqVO); | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/SpuService.java renamed to 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; |
| 3 | 3 | import java.util.*; |
| 4 | 4 | import javax.validation.*; |
| 5 | 5 | import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; |
| 6 | -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; | |
| 6 | +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | |
| 7 | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 8 | 8 | |
| 9 | 9 | /** |
| ... | ... | @@ -11,7 +11,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 11 | 11 | * |
| 12 | 12 | * @author 芋道源码 |
| 13 | 13 | */ |
| 14 | -public interface SpuService { | |
| 14 | +public interface ProductSpuService { | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * 创建商品spu |
| ... | ... | @@ -19,7 +19,7 @@ public interface SpuService { |
| 19 | 19 | * @param createReqVO 创建信息 |
| 20 | 20 | * @return 编号 |
| 21 | 21 | */ |
| 22 | - Integer createSpu(@Valid SpuCreateReqVO createReqVO); | |
| 22 | + Integer createSpu(@Valid ProductSpuCreateReqVO createReqVO); | |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * 更新商品spu |
| ... | ... | @@ -41,7 +41,7 @@ public interface SpuService { |
| 41 | 41 | * @param id 编号 |
| 42 | 42 | * @return 商品spu |
| 43 | 43 | */ |
| 44 | - SpuDO getSpu(Integer id); | |
| 44 | + ProductSpuDO getSpu(Integer id); | |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * 获得商品spu列表 |
| ... | ... | @@ -49,7 +49,7 @@ public interface SpuService { |
| 49 | 49 | * @param ids 编号 |
| 50 | 50 | * @return 商品spu列表 |
| 51 | 51 | */ |
| 52 | - List<SpuDO> getSpuList(Collection<Integer> ids); | |
| 52 | + List<ProductSpuDO> getSpuList(Collection<Integer> ids); | |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * 获得商品spu分页 |
| ... | ... | @@ -57,7 +57,7 @@ public interface SpuService { |
| 57 | 57 | * @param pageReqVO 分页查询 |
| 58 | 58 | * @return 商品spu分页 |
| 59 | 59 | */ |
| 60 | - PageResult<SpuDO> getSpuPage(SpuPageReqVO pageReqVO); | |
| 60 | + PageResult<ProductSpuDO> getSpuPage(SpuPageReqVO pageReqVO); | |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * 获得商品spu列表, 用于 Excel 导出 |
| ... | ... | @@ -65,6 +65,6 @@ public interface SpuService { |
| 65 | 65 | * @param exportReqVO 查询条件 |
| 66 | 66 | * @return 商品spu列表 |
| 67 | 67 | */ |
| 68 | - List<SpuDO> getSpuList(SpuExportReqVO exportReqVO); | |
| 68 | + List<ProductSpuDO> getSpuList(SpuExportReqVO exportReqVO); | |
| 69 | 69 | |
| 70 | 70 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/SpuServiceImpl.java renamed to 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; |
| 6 | 6 | |
| 7 | 7 | import java.util.*; |
| 8 | 8 | import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; |
| 9 | -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; | |
| 9 | +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | |
| 10 | 10 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 11 | 11 | |
| 12 | -import cn.iocoder.yudao.module.product.convert.spu.SpuConvert; | |
| 13 | -import cn.iocoder.yudao.module.product.dal.mysql.spu.SpuMapper; | |
| 12 | +import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; | |
| 13 | +import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper; | |
| 14 | 14 | |
| 15 | 15 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 16 | 16 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; |
| ... | ... | @@ -22,16 +22,16 @@ import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; |
| 22 | 22 | */ |
| 23 | 23 | @Service |
| 24 | 24 | @Validated |
| 25 | -public class SpuServiceImpl implements SpuService { | |
| 25 | +public class ProductSpuServiceImpl implements ProductSpuService { | |
| 26 | 26 | |
| 27 | 27 | @Resource |
| 28 | - private SpuMapper spuMapper; | |
| 28 | + private ProductSpuMapper ProductSpuMapper; | |
| 29 | 29 | |
| 30 | 30 | @Override |
| 31 | - public Integer createSpu(SpuCreateReqVO createReqVO) { | |
| 31 | + public Integer createSpu(ProductSpuCreateReqVO createReqVO) { | |
| 32 | 32 | // 插入 |
| 33 | - SpuDO spu = SpuConvert.INSTANCE.convert(createReqVO); | |
| 34 | - spuMapper.insert(spu); | |
| 33 | + ProductSpuDO spu = ProductSpuConvert.INSTANCE.convert(createReqVO); | |
| 34 | + ProductSpuMapper.insert(spu); | |
| 35 | 35 | // 返回 |
| 36 | 36 | return spu.getId(); |
| 37 | 37 | } |
| ... | ... | @@ -41,8 +41,8 @@ public class SpuServiceImpl implements SpuService { |
| 41 | 41 | // 校验存在 |
| 42 | 42 | this.validateSpuExists(updateReqVO.getId()); |
| 43 | 43 | // 更新 |
| 44 | - SpuDO updateObj = SpuConvert.INSTANCE.convert(updateReqVO); | |
| 45 | - spuMapper.updateById(updateObj); | |
| 44 | + ProductSpuDO updateObj = ProductSpuConvert.INSTANCE.convert(updateReqVO); | |
| 45 | + ProductSpuMapper.updateById(updateObj); | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | @Override |
| ... | ... | @@ -50,33 +50,33 @@ public class SpuServiceImpl implements SpuService { |
| 50 | 50 | // 校验存在 |
| 51 | 51 | this.validateSpuExists(id); |
| 52 | 52 | // 删除 |
| 53 | - spuMapper.deleteById(id); | |
| 53 | + ProductSpuMapper.deleteById(id); | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | private void validateSpuExists(Integer id) { |
| 57 | - if (spuMapper.selectById(id) == null) { | |
| 57 | + if (ProductSpuMapper.selectById(id) == null) { | |
| 58 | 58 | throw exception(SPU_NOT_EXISTS); |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | @Override |
| 63 | - public SpuDO getSpu(Integer id) { | |
| 64 | - return spuMapper.selectById(id); | |
| 63 | + public ProductSpuDO getSpu(Integer id) { | |
| 64 | + return ProductSpuMapper.selectById(id); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | @Override |
| 68 | - public List<SpuDO> getSpuList(Collection<Integer> ids) { | |
| 69 | - return spuMapper.selectBatchIds(ids); | |
| 68 | + public List<ProductSpuDO> getSpuList(Collection<Integer> ids) { | |
| 69 | + return ProductSpuMapper.selectBatchIds(ids); | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | @Override |
| 73 | - public PageResult<SpuDO> getSpuPage(SpuPageReqVO pageReqVO) { | |
| 74 | - return spuMapper.selectPage(pageReqVO); | |
| 73 | + public PageResult<ProductSpuDO> getSpuPage(SpuPageReqVO pageReqVO) { | |
| 74 | + return ProductSpuMapper.selectPage(pageReqVO); | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | @Override |
| 78 | - public List<SpuDO> getSpuList(SpuExportReqVO exportReqVO) { | |
| 79 | - return spuMapper.selectList(exportReqVO); | |
| 78 | + public List<ProductSpuDO> getSpuList(SpuExportReqVO exportReqVO) { | |
| 79 | + return ProductSpuMapper.selectList(exportReqVO); | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | } | ... | ... |
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; |
| 9 | 9 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 10 | 10 | |
| 11 | 11 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; |
| 12 | -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; | |
| 13 | -import cn.iocoder.yudao.module.product.dal.mysql.sku.SkuMapper; | |
| 12 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | |
| 13 | +import cn.iocoder.yudao.module.product.dal.mysql.sku.ProductSkuMapper; | |
| 14 | 14 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 15 | 15 | |
| 16 | 16 | import javax.annotation.Resource; |
| ... | ... | @@ -27,71 +27,71 @@ import static org.junit.jupiter.api.Assertions.*; |
| 27 | 27 | import static org.mockito.Mockito.*; |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | -* {@link SkuServiceImpl} 的单元测试类 | |
| 30 | +* {@link ProductSkuServiceImpl} 的单元测试类 | |
| 31 | 31 | * |
| 32 | 32 | * @author 芋道源码 |
| 33 | 33 | */ |
| 34 | -@Import(SkuServiceImpl.class) | |
| 34 | +@Import(ProductSkuServiceImpl.class) | |
| 35 | 35 | public class SkuServiceImplTest extends BaseDbUnitTest { |
| 36 | 36 | |
| 37 | 37 | @Resource |
| 38 | - private SkuServiceImpl skuService; | |
| 38 | + private ProductSkuServiceImpl ProductSkuService; | |
| 39 | 39 | |
| 40 | 40 | @Resource |
| 41 | - private SkuMapper skuMapper; | |
| 41 | + private ProductSkuMapper ProductSkuMapper; | |
| 42 | 42 | |
| 43 | 43 | @Test |
| 44 | 44 | public void testCreateSku_success() { |
| 45 | 45 | // 准备参数 |
| 46 | - SkuCreateReqVO reqVO = randomPojo(SkuCreateReqVO.class); | |
| 46 | + ProductSkuCreateReqVO reqVO = randomPojo(ProductSkuCreateReqVO.class); | |
| 47 | 47 | |
| 48 | 48 | // 调用 |
| 49 | - Integer skuId = skuService.createSku(reqVO); | |
| 49 | + Integer skuId = ProductSkuService.createSku(reqVO); | |
| 50 | 50 | // 断言 |
| 51 | 51 | assertNotNull(skuId); |
| 52 | 52 | // 校验记录的属性是否正确 |
| 53 | - SkuDO sku = skuMapper.selectById(skuId); | |
| 53 | + ProductSkuDO sku = ProductSkuMapper.selectById(skuId); | |
| 54 | 54 | assertPojoEquals(reqVO, sku); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | @Test |
| 58 | 58 | public void testUpdateSku_success() { |
| 59 | 59 | // mock 数据 |
| 60 | - SkuDO dbSku = randomPojo(SkuDO.class); | |
| 61 | - skuMapper.insert(dbSku);// @Sql: 先插入出一条存在的数据 | |
| 60 | + ProductSkuDO dbSku = randomPojo(ProductSkuDO.class); | |
| 61 | + ProductSkuMapper.insert(dbSku);// @Sql: 先插入出一条存在的数据 | |
| 62 | 62 | // 准备参数 |
| 63 | - SkuUpdateReqVO reqVO = randomPojo(SkuUpdateReqVO.class, o -> { | |
| 63 | + ProductSkuUpdateReqVO reqVO = randomPojo(ProductSkuUpdateReqVO.class, o -> { | |
| 64 | 64 | o.setId(dbSku.getId()); // 设置更新的 ID |
| 65 | 65 | }); |
| 66 | 66 | |
| 67 | 67 | // 调用 |
| 68 | - skuService.updateSku(reqVO); | |
| 68 | + ProductSkuService.updateSku(reqVO); | |
| 69 | 69 | // 校验是否更新正确 |
| 70 | - SkuDO sku = skuMapper.selectById(reqVO.getId()); // 获取最新的 | |
| 70 | + ProductSkuDO sku = ProductSkuMapper.selectById(reqVO.getId()); // 获取最新的 | |
| 71 | 71 | assertPojoEquals(reqVO, sku); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | @Test |
| 75 | 75 | public void testUpdateSku_notExists() { |
| 76 | 76 | // 准备参数 |
| 77 | - SkuUpdateReqVO reqVO = randomPojo(SkuUpdateReqVO.class); | |
| 77 | + ProductSkuUpdateReqVO reqVO = randomPojo(ProductSkuUpdateReqVO.class); | |
| 78 | 78 | |
| 79 | 79 | // 调用, 并断言异常 |
| 80 | - assertServiceException(() -> skuService.updateSku(reqVO), SKU_NOT_EXISTS); | |
| 80 | + assertServiceException(() -> ProductSkuService.updateSku(reqVO), SKU_NOT_EXISTS); | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | @Test |
| 84 | 84 | public void testDeleteSku_success() { |
| 85 | 85 | // mock 数据 |
| 86 | - SkuDO dbSku = randomPojo(SkuDO.class); | |
| 87 | - skuMapper.insert(dbSku);// @Sql: 先插入出一条存在的数据 | |
| 86 | + ProductSkuDO dbSku = randomPojo(ProductSkuDO.class); | |
| 87 | + ProductSkuMapper.insert(dbSku);// @Sql: 先插入出一条存在的数据 | |
| 88 | 88 | // 准备参数 |
| 89 | 89 | Integer id = dbSku.getId(); |
| 90 | 90 | |
| 91 | 91 | // 调用 |
| 92 | - skuService.deleteSku(id); | |
| 92 | + ProductSkuService.deleteSku(id); | |
| 93 | 93 | // 校验数据不存在了 |
| 94 | - assertNull(skuMapper.selectById(id)); | |
| 94 | + assertNull(ProductSkuMapper.selectById(id)); | |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | @Test |
| ... | ... | @@ -100,14 +100,14 @@ public class SkuServiceImplTest extends BaseDbUnitTest { |
| 100 | 100 | Integer id = 1; |
| 101 | 101 | |
| 102 | 102 | // 调用, 并断言异常 |
| 103 | - assertServiceException(() -> skuService.deleteSku(id), SKU_NOT_EXISTS); | |
| 103 | + assertServiceException(() -> ProductSkuService.deleteSku(id), SKU_NOT_EXISTS); | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | @Test |
| 107 | 107 | @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 |
| 108 | 108 | public void testGetSkuPage() { |
| 109 | 109 | // mock 数据 |
| 110 | - SkuDO dbSku = randomPojo(SkuDO.class, o -> { // 等会查询到 | |
| 110 | + ProductSkuDO dbSku = randomPojo(ProductSkuDO.class, o -> { // 等会查询到 | |
| 111 | 111 | o.setSpuId(null); |
| 112 | 112 | o.setProperties(null); |
| 113 | 113 | o.setPrice(null); |
| ... | ... | @@ -118,27 +118,27 @@ public class SkuServiceImplTest extends BaseDbUnitTest { |
| 118 | 118 | o.setStatus(null); |
| 119 | 119 | o.setCreateTime(null); |
| 120 | 120 | }); |
| 121 | - skuMapper.insert(dbSku); | |
| 121 | + ProductSkuMapper.insert(dbSku); | |
| 122 | 122 | // 测试 spuId 不匹配 |
| 123 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSpuId(null))); | |
| 123 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSpuId(null))); | |
| 124 | 124 | // 测试 properties 不匹配 |
| 125 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setProperties(null))); | |
| 125 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setProperties(null))); | |
| 126 | 126 | // 测试 price 不匹配 |
| 127 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null))); | |
| 127 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null))); | |
| 128 | 128 | // 测试 originalPrice 不匹配 |
| 129 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); | |
| 129 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); | |
| 130 | 130 | // 测试 costPrice 不匹配 |
| 131 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null))); | |
| 131 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null))); | |
| 132 | 132 | // 测试 barCode 不匹配 |
| 133 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setBarCode(null))); | |
| 133 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setBarCode(null))); | |
| 134 | 134 | // 测试 picUrl 不匹配 |
| 135 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPicUrl(null))); | |
| 135 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPicUrl(null))); | |
| 136 | 136 | // 测试 status 不匹配 |
| 137 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setStatus(null))); | |
| 137 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setStatus(null))); | |
| 138 | 138 | // 测试 createTime 不匹配 |
| 139 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null))); | |
| 139 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null))); | |
| 140 | 140 | // 准备参数 |
| 141 | - SkuPageReqVO reqVO = new SkuPageReqVO(); | |
| 141 | + ProductSkuPageReqVO reqVO = new ProductSkuPageReqVO(); | |
| 142 | 142 | reqVO.setSpuId(null); |
| 143 | 143 | reqVO.setProperties(null); |
| 144 | 144 | reqVO.setPrice(null); |
| ... | ... | @@ -151,7 +151,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest { |
| 151 | 151 | reqVO.setEndCreateTime(null); |
| 152 | 152 | |
| 153 | 153 | // 调用 |
| 154 | - PageResult<SkuDO> pageResult = skuService.getSkuPage(reqVO); | |
| 154 | + PageResult<ProductSkuDO> pageResult = ProductSkuService.getSkuPage(reqVO); | |
| 155 | 155 | // 断言 |
| 156 | 156 | assertEquals(1, pageResult.getTotal()); |
| 157 | 157 | assertEquals(1, pageResult.getList().size()); |
| ... | ... | @@ -162,7 +162,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest { |
| 162 | 162 | @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 |
| 163 | 163 | public void testGetSkuList() { |
| 164 | 164 | // mock 数据 |
| 165 | - SkuDO dbSku = randomPojo(SkuDO.class, o -> { // 等会查询到 | |
| 165 | + ProductSkuDO dbSku = randomPojo(ProductSkuDO.class, o -> { // 等会查询到 | |
| 166 | 166 | o.setSpuId(null); |
| 167 | 167 | o.setProperties(null); |
| 168 | 168 | o.setPrice(null); |
| ... | ... | @@ -173,27 +173,27 @@ public class SkuServiceImplTest extends BaseDbUnitTest { |
| 173 | 173 | o.setStatus(null); |
| 174 | 174 | o.setCreateTime(null); |
| 175 | 175 | }); |
| 176 | - skuMapper.insert(dbSku); | |
| 176 | + ProductSkuMapper.insert(dbSku); | |
| 177 | 177 | // 测试 spuId 不匹配 |
| 178 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSpuId(null))); | |
| 178 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSpuId(null))); | |
| 179 | 179 | // 测试 properties 不匹配 |
| 180 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setProperties(null))); | |
| 180 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setProperties(null))); | |
| 181 | 181 | // 测试 price 不匹配 |
| 182 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null))); | |
| 182 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null))); | |
| 183 | 183 | // 测试 originalPrice 不匹配 |
| 184 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); | |
| 184 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); | |
| 185 | 185 | // 测试 costPrice 不匹配 |
| 186 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null))); | |
| 186 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null))); | |
| 187 | 187 | // 测试 barCode 不匹配 |
| 188 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setBarCode(null))); | |
| 188 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setBarCode(null))); | |
| 189 | 189 | // 测试 picUrl 不匹配 |
| 190 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPicUrl(null))); | |
| 190 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPicUrl(null))); | |
| 191 | 191 | // 测试 status 不匹配 |
| 192 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setStatus(null))); | |
| 192 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setStatus(null))); | |
| 193 | 193 | // 测试 createTime 不匹配 |
| 194 | - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null))); | |
| 194 | + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null))); | |
| 195 | 195 | // 准备参数 |
| 196 | - SkuExportReqVO reqVO = new SkuExportReqVO(); | |
| 196 | + ProductSkuExportReqVO reqVO = new ProductSkuExportReqVO(); | |
| 197 | 197 | reqVO.setSpuId(null); |
| 198 | 198 | reqVO.setProperties(null); |
| 199 | 199 | reqVO.setPrice(null); |
| ... | ... | @@ -206,7 +206,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest { |
| 206 | 206 | reqVO.setEndCreateTime(null); |
| 207 | 207 | |
| 208 | 208 | // 调用 |
| 209 | - List<SkuDO> list = skuService.getSkuList(reqVO); | |
| 209 | + List<ProductSkuDO> list = ProductSkuService.getSkuList(reqVO); | |
| 210 | 210 | // 断言 |
| 211 | 211 | assertEquals(1, list.size()); |
| 212 | 212 | assertPojoEquals(dbSku, list.get(0)); | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/SpuServiceImplTest.java renamed to 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; |
| 9 | 9 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 10 | 10 | |
| 11 | 11 | import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; |
| 12 | -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; | |
| 13 | -import cn.iocoder.yudao.module.product.dal.mysql.spu.SpuMapper; | |
| 12 | +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | |
| 13 | +import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper; | |
| 14 | 14 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 15 | 15 | |
| 16 | 16 | import javax.annotation.Resource; |
| ... | ... | @@ -27,38 +27,38 @@ import static org.junit.jupiter.api.Assertions.*; |
| 27 | 27 | import static org.mockito.Mockito.*; |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | -* {@link SpuServiceImpl} 的单元测试类 | |
| 30 | +* {@link ProductSpuServiceImpl} 的单元测试类 | |
| 31 | 31 | * |
| 32 | 32 | * @author 芋道源码 |
| 33 | 33 | */ |
| 34 | -@Import(SpuServiceImpl.class) | |
| 35 | -public class SpuServiceImplTest extends BaseDbUnitTest { | |
| 34 | +@Import(ProductSpuServiceImpl.class) | |
| 35 | +public class ProductSpuServiceImplTest extends BaseDbUnitTest { | |
| 36 | 36 | |
| 37 | 37 | @Resource |
| 38 | - private SpuServiceImpl spuService; | |
| 38 | + private ProductSpuServiceImpl spuService; | |
| 39 | 39 | |
| 40 | 40 | @Resource |
| 41 | - private SpuMapper spuMapper; | |
| 41 | + private ProductSpuMapper ProductSpuMapper; | |
| 42 | 42 | |
| 43 | 43 | @Test |
| 44 | 44 | public void testCreateSpu_success() { |
| 45 | 45 | // 准备参数 |
| 46 | - SpuCreateReqVO reqVO = randomPojo(SpuCreateReqVO.class); | |
| 46 | + ProductSpuCreateReqVO reqVO = randomPojo(ProductSpuCreateReqVO.class); | |
| 47 | 47 | |
| 48 | 48 | // 调用 |
| 49 | 49 | Integer spuId = spuService.createSpu(reqVO); |
| 50 | 50 | // 断言 |
| 51 | 51 | assertNotNull(spuId); |
| 52 | 52 | // 校验记录的属性是否正确 |
| 53 | - SpuDO spu = spuMapper.selectById(spuId); | |
| 53 | + ProductSpuDO spu = ProductSpuMapper.selectById(spuId); | |
| 54 | 54 | assertPojoEquals(reqVO, spu); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | @Test |
| 58 | 58 | public void testUpdateSpu_success() { |
| 59 | 59 | // mock 数据 |
| 60 | - SpuDO dbSpu = randomPojo(SpuDO.class); | |
| 61 | - spuMapper.insert(dbSpu);// @Sql: 先插入出一条存在的数据 | |
| 60 | + ProductSpuDO dbSpu = randomPojo(ProductSpuDO.class); | |
| 61 | + ProductSpuMapper.insert(dbSpu);// @Sql: 先插入出一条存在的数据 | |
| 62 | 62 | // 准备参数 |
| 63 | 63 | SpuUpdateReqVO reqVO = randomPojo(SpuUpdateReqVO.class, o -> { |
| 64 | 64 | o.setId(dbSpu.getId()); // 设置更新的 ID |
| ... | ... | @@ -67,7 +67,7 @@ public class SpuServiceImplTest extends BaseDbUnitTest { |
| 67 | 67 | // 调用 |
| 68 | 68 | spuService.updateSpu(reqVO); |
| 69 | 69 | // 校验是否更新正确 |
| 70 | - SpuDO spu = spuMapper.selectById(reqVO.getId()); // 获取最新的 | |
| 70 | + ProductSpuDO spu = ProductSpuMapper.selectById(reqVO.getId()); // 获取最新的 | |
| 71 | 71 | assertPojoEquals(reqVO, spu); |
| 72 | 72 | } |
| 73 | 73 | |
| ... | ... | @@ -83,15 +83,15 @@ public class SpuServiceImplTest extends BaseDbUnitTest { |
| 83 | 83 | @Test |
| 84 | 84 | public void testDeleteSpu_success() { |
| 85 | 85 | // mock 数据 |
| 86 | - SpuDO dbSpu = randomPojo(SpuDO.class); | |
| 87 | - spuMapper.insert(dbSpu);// @Sql: 先插入出一条存在的数据 | |
| 86 | + ProductSpuDO dbSpu = randomPojo(ProductSpuDO.class); | |
| 87 | + ProductSpuMapper.insert(dbSpu);// @Sql: 先插入出一条存在的数据 | |
| 88 | 88 | // 准备参数 |
| 89 | 89 | Integer id = dbSpu.getId(); |
| 90 | 90 | |
| 91 | 91 | // 调用 |
| 92 | 92 | spuService.deleteSpu(id); |
| 93 | 93 | // 校验数据不存在了 |
| 94 | - assertNull(spuMapper.selectById(id)); | |
| 94 | + assertNull(ProductSpuMapper.selectById(id)); | |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | @Test |
| ... | ... | @@ -107,7 +107,7 @@ public class SpuServiceImplTest extends BaseDbUnitTest { |
| 107 | 107 | @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 |
| 108 | 108 | public void testGetSpuPage() { |
| 109 | 109 | // mock 数据 |
| 110 | - SpuDO dbSpu = randomPojo(SpuDO.class, o -> { // 等会查询到 | |
| 110 | + ProductSpuDO dbSpu = randomPojo(ProductSpuDO.class, o -> { // 等会查询到 | |
| 111 | 111 | o.setName(null); |
| 112 | 112 | o.setSellPoint(null); |
| 113 | 113 | o.setDescription(null); |
| ... | ... | @@ -120,29 +120,29 @@ public class SpuServiceImplTest extends BaseDbUnitTest { |
| 120 | 120 | o.setStatus(null); |
| 121 | 121 | o.setCreateTime(null); |
| 122 | 122 | }); |
| 123 | - spuMapper.insert(dbSpu); | |
| 123 | + ProductSpuMapper.insert(dbSpu); | |
| 124 | 124 | // 测试 name 不匹配 |
| 125 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setName(null))); | |
| 125 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setName(null))); | |
| 126 | 126 | // 测试 sellPoint 不匹配 |
| 127 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSellPoint(null))); | |
| 127 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSellPoint(null))); | |
| 128 | 128 | // 测试 description 不匹配 |
| 129 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setDescription(null))); | |
| 129 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setDescription(null))); | |
| 130 | 130 | // 测试 categoryId 不匹配 |
| 131 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCategoryId(null))); | |
| 131 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCategoryId(null))); | |
| 132 | 132 | // 测试 picUrls 不匹配 |
| 133 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPicUrls(null))); | |
| 133 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPicUrls(null))); | |
| 134 | 134 | // 测试 sort 不匹配 |
| 135 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSort(null))); | |
| 135 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSort(null))); | |
| 136 | 136 | // 测试 likeCount 不匹配 |
| 137 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null))); | |
| 137 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null))); | |
| 138 | 138 | // 测试 price 不匹配 |
| 139 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); | |
| 139 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); | |
| 140 | 140 | // 测试 quantity 不匹配 |
| 141 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null))); | |
| 141 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null))); | |
| 142 | 142 | // 测试 status 不匹配 |
| 143 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setStatus(null))); | |
| 143 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setStatus(null))); | |
| 144 | 144 | // 测试 createTime 不匹配 |
| 145 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null))); | |
| 145 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null))); | |
| 146 | 146 | // 准备参数 |
| 147 | 147 | SpuPageReqVO reqVO = new SpuPageReqVO(); |
| 148 | 148 | reqVO.setName(null); |
| ... | ... | @@ -159,7 +159,7 @@ public class SpuServiceImplTest extends BaseDbUnitTest { |
| 159 | 159 | reqVO.setEndCreateTime(null); |
| 160 | 160 | |
| 161 | 161 | // 调用 |
| 162 | - PageResult<SpuDO> pageResult = spuService.getSpuPage(reqVO); | |
| 162 | + PageResult<ProductSpuDO> pageResult = spuService.getSpuPage(reqVO); | |
| 163 | 163 | // 断言 |
| 164 | 164 | assertEquals(1, pageResult.getTotal()); |
| 165 | 165 | assertEquals(1, pageResult.getList().size()); |
| ... | ... | @@ -170,7 +170,7 @@ public class SpuServiceImplTest extends BaseDbUnitTest { |
| 170 | 170 | @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 |
| 171 | 171 | public void testGetSpuList() { |
| 172 | 172 | // mock 数据 |
| 173 | - SpuDO dbSpu = randomPojo(SpuDO.class, o -> { // 等会查询到 | |
| 173 | + ProductSpuDO dbSpu = randomPojo(ProductSpuDO.class, o -> { // 等会查询到 | |
| 174 | 174 | o.setName(null); |
| 175 | 175 | o.setSellPoint(null); |
| 176 | 176 | o.setDescription(null); |
| ... | ... | @@ -183,29 +183,29 @@ public class SpuServiceImplTest extends BaseDbUnitTest { |
| 183 | 183 | o.setStatus(null); |
| 184 | 184 | o.setCreateTime(null); |
| 185 | 185 | }); |
| 186 | - spuMapper.insert(dbSpu); | |
| 186 | + ProductSpuMapper.insert(dbSpu); | |
| 187 | 187 | // 测试 name 不匹配 |
| 188 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setName(null))); | |
| 188 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setName(null))); | |
| 189 | 189 | // 测试 sellPoint 不匹配 |
| 190 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSellPoint(null))); | |
| 190 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSellPoint(null))); | |
| 191 | 191 | // 测试 description 不匹配 |
| 192 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setDescription(null))); | |
| 192 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setDescription(null))); | |
| 193 | 193 | // 测试 categoryId 不匹配 |
| 194 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCategoryId(null))); | |
| 194 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCategoryId(null))); | |
| 195 | 195 | // 测试 picUrls 不匹配 |
| 196 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPicUrls(null))); | |
| 196 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPicUrls(null))); | |
| 197 | 197 | // 测试 sort 不匹配 |
| 198 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSort(null))); | |
| 198 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSort(null))); | |
| 199 | 199 | // 测试 likeCount 不匹配 |
| 200 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null))); | |
| 200 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null))); | |
| 201 | 201 | // 测试 price 不匹配 |
| 202 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); | |
| 202 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); | |
| 203 | 203 | // 测试 quantity 不匹配 |
| 204 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null))); | |
| 204 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null))); | |
| 205 | 205 | // 测试 status 不匹配 |
| 206 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setStatus(null))); | |
| 206 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setStatus(null))); | |
| 207 | 207 | // 测试 createTime 不匹配 |
| 208 | - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null))); | |
| 208 | + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null))); | |
| 209 | 209 | // 准备参数 |
| 210 | 210 | SpuExportReqVO reqVO = new SpuExportReqVO(); |
| 211 | 211 | reqVO.setName(null); |
| ... | ... | @@ -222,7 +222,7 @@ public class SpuServiceImplTest extends BaseDbUnitTest { |
| 222 | 222 | reqVO.setEndCreateTime(null); |
| 223 | 223 | |
| 224 | 224 | // 调用 |
| 225 | - List<SpuDO> list = spuService.getSpuList(reqVO); | |
| 225 | + List<ProductSpuDO> list = spuService.getSpuList(reqVO); | |
| 226 | 226 | // 断言 |
| 227 | 227 | assertEquals(1, list.size()); |
| 228 | 228 | assertPojoEquals(dbSpu, list.get(0)); | ... | ... |