Commit fac3e7c72663480e3c61e3bdf38c1c445ec33784
1 parent
373188b5
product:商品规格,调整成商品属性,避免和 sku 概念冲突
Showing
55 changed files
with
283 additions
and
210 deletions
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/dto/ProductSkuRespDTO.java
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java
| ... | ... | @@ -22,13 +22,13 @@ public interface ErrorCodeConstants { |
| 22 | 22 | ErrorCode BRAND_DISABLED = new ErrorCode(1008002001, "品牌不存在"); |
| 23 | 23 | ErrorCode BRAND_NAME_EXISTS = new ErrorCode(1008002002, "品牌名称已存在"); |
| 24 | 24 | |
| 25 | - // ========== 商品规格名称 1008003000 ========== | |
| 26 | - ErrorCode PROPERTY_NOT_EXISTS = new ErrorCode(1008003000, "规格名称不存在"); | |
| 27 | - ErrorCode PROPERTY_EXISTS = new ErrorCode(1008003001, "规格名称已存在"); | |
| 25 | + // ========== 商品属性项 1008003000 ========== | |
| 26 | + ErrorCode PROPERTY_NOT_EXISTS = new ErrorCode(1008003000, "属性项不存在"); | |
| 27 | + ErrorCode PROPERTY_EXISTS = new ErrorCode(1008003001, "属性项的名称已存在"); | |
| 28 | 28 | |
| 29 | - // ========== 规格值 1008004000 ========== | |
| 30 | - ErrorCode PROPERTY_VALUE_NOT_EXISTS = new ErrorCode(1008004000, "规格值不存在"); | |
| 31 | - ErrorCode PROPERTY_VALUE_EXISTS = new ErrorCode(1008004001, "规格值已存在"); | |
| 29 | + // ========== 商品属性值 1008004000 ========== | |
| 30 | + ErrorCode PROPERTY_VALUE_NOT_EXISTS = new ErrorCode(1008004000, "属性值不存在"); | |
| 31 | + ErrorCode PROPERTY_VALUE_EXISTS = new ErrorCode(1008004001, "属性值的名称已存在"); | |
| 32 | 32 | |
| 33 | 33 | // ========== 商品 SPU 1008005000 ========== |
| 34 | 34 | ErrorCode SPU_NOT_EXISTS = new ErrorCode(1008005000, "商品 SPU 不存在"); |
| ... | ... | @@ -36,7 +36,7 @@ public interface ErrorCodeConstants { |
| 36 | 36 | // ========== 商品 SKU 1008006000 ========== |
| 37 | 37 | ErrorCode SKU_NOT_EXISTS = new ErrorCode(1008006000, "商品 SKU 不存在"); |
| 38 | 38 | ErrorCode SKU_PROPERTIES_DUPLICATED = new ErrorCode(1008006001, "商品 SKU 的属性组合存在重复"); |
| 39 | - ErrorCode SPU_ATTR_NUMBERS_MUST_BE_EQUALS = new ErrorCode(1008006002, "一个 SPU 下的每个 SKU,其规格数必须一致"); | |
| 39 | + ErrorCode SPU_ATTR_NUMBERS_MUST_BE_EQUALS = new ErrorCode(1008006002, "一个 SPU 下的每个 SKU,其属性项必须一致"); | |
| 40 | 40 | ErrorCode SPU_SKU_NOT_DUPLICATE = new ErrorCode(1008006003, "一个 SPU 下的每个 SKU,必须不重复"); |
| 41 | 41 | ErrorCode SKU_STOCK_NOT_ENOUGH = new ErrorCode(1008006004, "商品 SKU 库存不足"); |
| 42 | 42 | ... | ... |
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/spu/ProductSpuSpecTypeEnum.java
| ... | ... | @@ -21,11 +21,11 @@ public enum ProductSpuSpecTypeEnum implements IntArrayValuable { |
| 21 | 21 | public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductSpuSpecTypeEnum::getType).toArray(); |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | - * 规格 | |
| 24 | + * 规格类型 | |
| 25 | 25 | */ |
| 26 | 26 | private final Integer type; |
| 27 | 27 | /** |
| 28 | - * 规格名 | |
| 28 | + * 规格名称 | |
| 29 | 29 | */ |
| 30 | 30 | private final String name; |
| 31 | 31 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java
| ... | ... | @@ -18,7 +18,7 @@ import java.util.List; |
| 18 | 18 | |
| 19 | 19 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 20 | 20 | |
| 21 | -@Api(tags = "管理后台 - 规格名称") | |
| 21 | +@Api(tags = "管理后台 - 商品属性项") | |
| 22 | 22 | @RestController |
| 23 | 23 | @RequestMapping("/product/property") |
| 24 | 24 | @Validated |
| ... | ... | @@ -28,14 +28,14 @@ public class ProductPropertyController { |
| 28 | 28 | private ProductPropertyService productPropertyService; |
| 29 | 29 | |
| 30 | 30 | @PostMapping("/create") |
| 31 | - @ApiOperation("创建规格名称") | |
| 31 | + @ApiOperation("创建属性项") | |
| 32 | 32 | @PreAuthorize("@ss.hasPermission('product:property:create')") |
| 33 | 33 | public CommonResult<Long> createProperty(@Valid @RequestBody ProductPropertyCreateReqVO createReqVO) { |
| 34 | 34 | return success(productPropertyService.createProperty(createReqVO)); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | @PutMapping("/update") |
| 38 | - @ApiOperation("更新规格名称") | |
| 38 | + @ApiOperation("更新属性项") | |
| 39 | 39 | @PreAuthorize("@ss.hasPermission('product:property:update')") |
| 40 | 40 | public CommonResult<Boolean> updateProperty(@Valid @RequestBody ProductPropertyUpdateReqVO updateReqVO) { |
| 41 | 41 | productPropertyService.updateProperty(updateReqVO); |
| ... | ... | @@ -43,7 +43,7 @@ public class ProductPropertyController { |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | @DeleteMapping("/delete") |
| 46 | - @ApiOperation("删除规格名称") | |
| 46 | + @ApiOperation("删除属性项") | |
| 47 | 47 | @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) |
| 48 | 48 | @PreAuthorize("@ss.hasPermission('product:property:delete')") |
| 49 | 49 | public CommonResult<Boolean> deleteProperty(@RequestParam("id") Long id) { |
| ... | ... | @@ -52,7 +52,7 @@ public class ProductPropertyController { |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | @GetMapping("/get") |
| 55 | - @ApiOperation("获得规格名称") | |
| 55 | + @ApiOperation("获得属性项") | |
| 56 | 56 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 57 | 57 | @PreAuthorize("@ss.hasPermission('product:property:query')") |
| 58 | 58 | public CommonResult<ProductPropertyRespVO> getProperty(@RequestParam("id") Long id) { |
| ... | ... | @@ -60,21 +60,21 @@ public class ProductPropertyController { |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | @GetMapping("/list") |
| 63 | - @ApiOperation("获得规格名称列表") | |
| 63 | + @ApiOperation("获得属性项列表") | |
| 64 | 64 | @PreAuthorize("@ss.hasPermission('product:property:query')") |
| 65 | 65 | public CommonResult<List<ProductPropertyRespVO>> getPropertyList(@Valid ProductPropertyListReqVO listReqVO) { |
| 66 | 66 | return success(productPropertyService.getPropertyList(listReqVO)); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | @GetMapping("/page") |
| 70 | - @ApiOperation("获得规格名称分页") | |
| 70 | + @ApiOperation("获得属性项分页") | |
| 71 | 71 | @PreAuthorize("@ss.hasPermission('product:property:query')") |
| 72 | 72 | public CommonResult<PageResult<ProductPropertyRespVO>> getPropertyPage(@Valid ProductPropertyPageReqVO pageVO) { |
| 73 | 73 | return success(productPropertyService.getPropertyPage(pageVO)); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | @GetMapping("/listAndValue") |
| 77 | - @ApiOperation("获得规格名称列表") | |
| 77 | + @ApiOperation("获得属性项列表") | |
| 78 | 78 | @PreAuthorize("@ss.hasPermission('product:property:query')") |
| 79 | 79 | public CommonResult<List<ProductPropertyAndValueRespVO>> getPropertyAndValueList(@Valid ProductPropertyListReqVO listReqVO) { |
| 80 | 80 | return success(productPropertyService.getPropertyAndValueList(listReqVO)); | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyValueController.java
| ... | ... | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.product.controller.admin.property; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | -import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyPageReqVO; | |
| 6 | 5 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO; |
| 7 | 6 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValuePageReqVO; |
| 8 | 7 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO; |
| ... | ... | @@ -20,7 +19,7 @@ import javax.validation.Valid; |
| 20 | 19 | |
| 21 | 20 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 22 | 21 | |
| 23 | -@Api(tags = "管理后台 - 规格值名称") | |
| 22 | +@Api(tags = "管理后台 - 商品属性值") | |
| 24 | 23 | @RestController |
| 25 | 24 | @RequestMapping("/product/property/value") |
| 26 | 25 | @Validated |
| ... | ... | @@ -30,14 +29,14 @@ public class ProductPropertyValueController { |
| 30 | 29 | private ProductPropertyValueService productPropertyValueService; |
| 31 | 30 | |
| 32 | 31 | @PostMapping("/create") |
| 33 | - @ApiOperation("创建规格名称") | |
| 32 | + @ApiOperation("创建属性值") | |
| 34 | 33 | @PreAuthorize("@ss.hasPermission('product:property:create')") |
| 35 | 34 | public CommonResult<Long> createProperty(@Valid @RequestBody ProductPropertyValueCreateReqVO createReqVO) { |
| 36 | 35 | return success(productPropertyValueService.createPropertyValue(createReqVO)); |
| 37 | 36 | } |
| 38 | 37 | |
| 39 | 38 | @PutMapping("/update") |
| 40 | - @ApiOperation("更新规格名称") | |
| 39 | + @ApiOperation("更新属性值") | |
| 41 | 40 | @PreAuthorize("@ss.hasPermission('product:property:update')") |
| 42 | 41 | public CommonResult<Boolean> updateProperty(@Valid @RequestBody ProductPropertyValueUpdateReqVO updateReqVO) { |
| 43 | 42 | productPropertyValueService.updatePropertyValue(updateReqVO); |
| ... | ... | @@ -45,7 +44,7 @@ public class ProductPropertyValueController { |
| 45 | 44 | } |
| 46 | 45 | |
| 47 | 46 | @DeleteMapping("/delete") |
| 48 | - @ApiOperation("删除规格名称") | |
| 47 | + @ApiOperation("删除属性值") | |
| 49 | 48 | @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) |
| 50 | 49 | @PreAuthorize("@ss.hasPermission('product:property:delete')") |
| 51 | 50 | public CommonResult<Boolean> deleteProperty(@RequestParam("id") Long id) { |
| ... | ... | @@ -54,7 +53,7 @@ public class ProductPropertyValueController { |
| 54 | 53 | } |
| 55 | 54 | |
| 56 | 55 | @GetMapping("/get") |
| 57 | - @ApiOperation("获得规格名称") | |
| 56 | + @ApiOperation("获得属性值") | |
| 58 | 57 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 59 | 58 | @PreAuthorize("@ss.hasPermission('product:property:query')") |
| 60 | 59 | public CommonResult<ProductPropertyValueRespVO> getProperty(@RequestParam("id") Long id) { |
| ... | ... | @@ -62,7 +61,7 @@ public class ProductPropertyValueController { |
| 62 | 61 | } |
| 63 | 62 | |
| 64 | 63 | @GetMapping("/page") |
| 65 | - @ApiOperation("获得规格名称分页") | |
| 64 | + @ApiOperation("获得属性值分页") | |
| 66 | 65 | @PreAuthorize("@ss.hasPermission('product:property:query')") |
| 67 | 66 | public CommonResult<PageResult<ProductPropertyValueRespVO>> getPropertyValuePage(@Valid ProductPropertyValuePageReqVO pageVO) { |
| 68 | 67 | return success(productPropertyValueService.getPropertyValueListPage(pageVO)); | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyViewRespVO.java
| ... | ... | @@ -7,28 +7,23 @@ import lombok.ToString; |
| 7 | 7 | |
| 8 | 8 | import java.util.List; |
| 9 | 9 | |
| 10 | -/** | |
| 11 | - * @Description: ProductPropertyViewRespVO | |
| 12 | - * @Author: franky | |
| 13 | - * @CreateDate: 2022/7/5 21:29 | |
| 14 | - * @Version: 1.0.0 | |
| 15 | - */ | |
| 16 | -@ApiModel("管理后台 - 规格名称详情展示 Request VO") | |
| 10 | +// TODO 芋艿:看看怎么删除 | |
| 11 | +@ApiModel("管理后台 - 商品属性详情展示 Request VO") | |
| 17 | 12 | @Data |
| 18 | 13 | @ToString(callSuper = true) |
| 19 | 14 | public class ProductPropertyViewRespVO { |
| 20 | 15 | |
| 21 | - @ApiModelProperty(value = "规格名称id", example = "1") | |
| 16 | + @ApiModelProperty(value = "属性项 id", example = "1") | |
| 22 | 17 | public Long propertyId; |
| 23 | 18 | |
| 24 | - @ApiModelProperty(value = "规格名称", example = "内存") | |
| 19 | + @ApiModelProperty(value = "属性项的名字", example = "内存") | |
| 25 | 20 | public String name; |
| 26 | 21 | |
| 27 | - @ApiModelProperty(value = "规格属性值集合", example = "[{\"v1\":11,\"v2\":\"64G\"},{\"v1\":10,\"v2\":\"32G\"}]") | |
| 22 | + @ApiModelProperty(value = "属性值数组") | |
| 28 | 23 | public List<Tuple2> propertyValues; |
| 29 | 24 | |
| 30 | 25 | @Data |
| 31 | - @ApiModel(value = "规格属性值元组") | |
| 26 | + @ApiModel(value = "属性值元组") | |
| 32 | 27 | public static class Tuple2 { |
| 33 | 28 | private final long id; |
| 34 | 29 | private final String name; | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyAndValueRespVO.java
| ... | ... | @@ -10,20 +10,20 @@ import lombok.ToString; |
| 10 | 10 | import java.time.LocalDateTime; |
| 11 | 11 | import java.util.List; |
| 12 | 12 | |
| 13 | -@ApiModel("管理后台 - 规格 + 规格值 Response VO") | |
| 13 | +@ApiModel("管理后台 - 商品属性项 + 属性值 Response VO") | |
| 14 | 14 | @Data |
| 15 | 15 | @EqualsAndHashCode(callSuper = true) |
| 16 | 16 | @ToString(callSuper = true) |
| 17 | 17 | public class ProductPropertyAndValueRespVO extends ProductPropertyBaseVO { |
| 18 | 18 | |
| 19 | - @ApiModelProperty(value = "规格的编号", required = true, example = "1024") | |
| 19 | + @ApiModelProperty(value = "属性项的编号", required = true, example = "1024") | |
| 20 | 20 | private Long id; |
| 21 | 21 | |
| 22 | 22 | @ApiModelProperty(value = "创建时间", required = true) |
| 23 | 23 | private LocalDateTime createTime; |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * 规格值的集合 | |
| 26 | + * 属性值的集合 | |
| 27 | 27 | */ |
| 28 | 28 | private List<ProductPropertyValueRespVO> values; |
| 29 | 29 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyBaseVO.java
| ... | ... | @@ -7,14 +7,14 @@ import javax.validation.constraints.NotBlank; |
| 7 | 7 | import javax.validation.constraints.NotNull; |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | - * 规格名称 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 10 | + * 商品属性项 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 11 | 11 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 12 | 12 | */ |
| 13 | 13 | @Data |
| 14 | 14 | public class ProductPropertyBaseVO { |
| 15 | 15 | |
| 16 | - @ApiModelProperty(value = "规格名称", required = true, example = "颜色") | |
| 17 | - @NotBlank(message = "规格名称不能为空") | |
| 16 | + @ApiModelProperty(value = "名称", required = true, example = "颜色") | |
| 17 | + @NotBlank(message = "名称不能为空") | |
| 18 | 18 | private String name; |
| 19 | 19 | |
| 20 | 20 | @ApiModelProperty(value = "备注", example = "颜色") | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyCreateReqVO.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyListReqVO.java
| ... | ... | @@ -5,12 +5,12 @@ import io.swagger.annotations.ApiModelProperty; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | import lombok.ToString; |
| 7 | 7 | |
| 8 | -@ApiModel("管理后台 - 规格名称 List Request VO") | |
| 8 | +@ApiModel("管理后台 - 属性项 List Request VO") | |
| 9 | 9 | @Data |
| 10 | 10 | @ToString(callSuper = true) |
| 11 | 11 | public class ProductPropertyListReqVO { |
| 12 | 12 | |
| 13 | - @ApiModelProperty(value = "规格名称", example = "颜色") | |
| 13 | + @ApiModelProperty(value = "名称", example = "颜色") | |
| 14 | 14 | private String name; |
| 15 | 15 | |
| 16 | 16 | @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举") | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyPageReqVO.java
| ... | ... | @@ -12,13 +12,13 @@ import java.time.LocalDateTime; |
| 12 | 12 | |
| 13 | 13 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 14 | 14 | |
| 15 | -@ApiModel("管理后台 - 规格名称分页 Request VO") | |
| 15 | +@ApiModel("管理后台 - 属性项 Request VO") | |
| 16 | 16 | @Data |
| 17 | 17 | @EqualsAndHashCode(callSuper = true) |
| 18 | 18 | @ToString(callSuper = true) |
| 19 | 19 | public class ProductPropertyPageReqVO extends PageParam { |
| 20 | 20 | |
| 21 | - @ApiModelProperty(value = "规格名称", example = "颜色") | |
| 21 | + @ApiModelProperty(value = "名称", example = "颜色") | |
| 22 | 22 | private String name; |
| 23 | 23 | |
| 24 | 24 | @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举") | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyRespVO.java
| ... | ... | @@ -8,13 +8,13 @@ import lombok.ToString; |
| 8 | 8 | |
| 9 | 9 | import java.time.LocalDateTime; |
| 10 | 10 | |
| 11 | -@ApiModel("管理后台 - 规格 + 规格值 Response VO") | |
| 11 | +@ApiModel("管理后台 - 属性项 Response VO") | |
| 12 | 12 | @Data |
| 13 | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | 14 | @ToString(callSuper = true) |
| 15 | 15 | public class ProductPropertyRespVO extends ProductPropertyBaseVO { |
| 16 | 16 | |
| 17 | - @ApiModelProperty(value = "规格的编号", required = true, example = "1024") | |
| 17 | + @ApiModelProperty(value = "编号", required = true, example = "1024") | |
| 18 | 18 | private Long id; |
| 19 | 19 | |
| 20 | 20 | @ApiModelProperty(value = "创建时间", required = true) | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyUpdateReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.product.controller.admin.property.vo.property; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO; | |
| 4 | -import lombok.*; | |
| 5 | -import io.swagger.annotations.*; | |
| 6 | -import javax.validation.constraints.*; | |
| 7 | -import java.util.List; | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 8 | 8 | |
| 9 | -@ApiModel("管理后台 - 规格名称更新 Request VO") | |
| 9 | +import javax.validation.constraints.NotNull; | |
| 10 | + | |
| 11 | +@ApiModel("管理后台 - 属性项更新 Request VO") | |
| 10 | 12 | @Data |
| 11 | 13 | @EqualsAndHashCode(callSuper = true) |
| 12 | 14 | @ToString(callSuper = true) | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueBaseVO.java
| ... | ... | @@ -7,18 +7,18 @@ import javax.validation.constraints.NotEmpty; |
| 7 | 7 | import javax.validation.constraints.NotNull; |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | -* 规格值 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 10 | +* 属性值 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 11 | 11 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 12 | 12 | */ |
| 13 | 13 | @Data |
| 14 | 14 | public class ProductPropertyValueBaseVO { |
| 15 | 15 | |
| 16 | - @ApiModelProperty(value = "规格编号", required = true, example = "1024") | |
| 17 | - @NotNull(message = "规格编号不能为空") | |
| 16 | + @ApiModelProperty(value = "属性项的编号", required = true, example = "1024") | |
| 17 | + @NotNull(message = "属性项的编号不能为空") | |
| 18 | 18 | private Long propertyId; |
| 19 | 19 | |
| 20 | - @ApiModelProperty(value = "规格值名字", required = true, example = "红色") | |
| 21 | - @NotEmpty(message = "规格值名字不能为空") | |
| 20 | + @ApiModelProperty(value = "名称", required = true, example = "红色") | |
| 21 | + @NotEmpty(message = "名称名字不能为空") | |
| 22 | 22 | private String name; |
| 23 | 23 | |
| 24 | 24 | @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举") | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueCreateReqVO.java
| ... | ... | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.product.controller.admin.property.vo.value; |
| 3 | 3 | import lombok.*; |
| 4 | 4 | import io.swagger.annotations.*; |
| 5 | 5 | |
| 6 | -@ApiModel("管理后台 - 规格值创建 Request VO") | |
| 6 | +@ApiModel("管理后台 - 商品属性值创建 Request VO") | |
| 7 | 7 | @Data |
| 8 | 8 | @EqualsAndHashCode(callSuper = true) |
| 9 | 9 | @ToString(callSuper = true) | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValuePageReqVO.java
| ... | ... | @@ -6,23 +6,17 @@ import io.swagger.annotations.ApiModelProperty; |
| 6 | 6 | import lombok.Data; |
| 7 | 7 | import lombok.EqualsAndHashCode; |
| 8 | 8 | import lombok.ToString; |
| 9 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 10 | 9 | |
| 11 | -import javax.validation.constraints.NotEmpty; | |
| 12 | -import java.util.Date; | |
| 13 | - | |
| 14 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 15 | - | |
| 16 | -@ApiModel("管理后台 - 规格名称值分页 Request VO") | |
| 10 | +@ApiModel("管理后台 - 商品属性值分页 Request VO") | |
| 17 | 11 | @Data |
| 18 | 12 | @EqualsAndHashCode(callSuper = true) |
| 19 | 13 | @ToString(callSuper = true) |
| 20 | 14 | public class ProductPropertyValuePageReqVO extends PageParam { |
| 21 | 15 | |
| 22 | - @ApiModelProperty(value = "规格id", example = "1024") | |
| 16 | + @ApiModelProperty(value = "属性项的编号", example = "1024") | |
| 23 | 17 | private String propertyId; |
| 24 | 18 | |
| 25 | - @ApiModelProperty(value = "规格值", example = "红色") | |
| 19 | + @ApiModelProperty(value = "名称", example = "红色") | |
| 26 | 20 | private String name; |
| 27 | 21 | |
| 28 | 22 | @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举") | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueRespVO.java
| ... | ... | @@ -8,13 +8,13 @@ import lombok.ToString; |
| 8 | 8 | |
| 9 | 9 | import java.time.LocalDateTime; |
| 10 | 10 | |
| 11 | -@ApiModel("管理后台 - 规格值 Response VO") | |
| 11 | +@ApiModel("管理后台 - 商品属性值 Response VO") | |
| 12 | 12 | @Data |
| 13 | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | 14 | @ToString(callSuper = true) |
| 15 | 15 | public class ProductPropertyValueRespVO extends ProductPropertyValueBaseVO { |
| 16 | 16 | |
| 17 | - @ApiModelProperty(value = "主键", required = true, example = "10") | |
| 17 | + @ApiModelProperty(value = "编号", required = true, example = "10") | |
| 18 | 18 | private Long id; |
| 19 | 19 | |
| 20 | 20 | @ApiModelProperty(value = "创建时间") | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueUpdateReqVO.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateOrUpdateReqVO.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java
| ... | ... | @@ -35,22 +35,22 @@ public class ProductSpuDetailRespVO extends ProductSpuBaseVO { |
| 35 | 35 | public static class Sku extends ProductSkuBaseVO { |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - * 规格的数组 | |
| 38 | + * 属性数组 | |
| 39 | 39 | */ |
| 40 | 40 | private List<ProductSpuDetailRespVO.Property> properties; |
| 41 | 41 | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - @ApiModel(value = "管理后台 - 商品规格的详细 Response VO") | |
| 44 | + @ApiModel(value = "管理后台 - 商品属性的详细 Response VO") | |
| 45 | 45 | @Data |
| 46 | 46 | @EqualsAndHashCode(callSuper = true) |
| 47 | 47 | @ToString(callSuper = true) |
| 48 | 48 | public static class Property extends ProductSkuBaseVO.Property { |
| 49 | 49 | |
| 50 | - @ApiModelProperty(value = "规格的名字", required = true, example = "颜色") | |
| 50 | + @ApiModelProperty(value = "属性项的名字", required = true, example = "颜色") | |
| 51 | 51 | private String propertyName; |
| 52 | 52 | |
| 53 | - @ApiModelProperty(value = "规格值的名字", required = true, example = "蓝色") | |
| 53 | + @ApiModelProperty(value = "属性值的名称", required = true, example = "蓝色") | |
| 54 | 54 | private String valueName; |
| 55 | 55 | |
| 56 | 56 | } |
| ... | ... | @@ -59,7 +59,7 @@ public class ProductSpuDetailRespVO extends ProductSpuBaseVO { |
| 59 | 59 | private Long categoryId; |
| 60 | 60 | |
| 61 | 61 | // TODO @芋艿:在瞅瞅~ |
| 62 | - @ApiModelProperty(value = "规格属性修改和详情展示组合", example = "[{\"propertyId\":2,\"name\":\"内存\",\"propertyValues\":[{\"v1\":11,\"v2\":\"64G\"},{\"v1\":10,\"v2\":\"32G\"}]},{\"propertyId\":3,\"name\":\"尺寸\",\"propertyValues\":[{\"v1\":16,\"v2\":\"6.1\"},{\"v1\":15,\"v2\":\"5.7\"}]}]") | |
| 62 | + @ApiModelProperty(value = "属性修改和详情展示组合", example = "[{\"propertyId\":2,\"name\":\"内存\",\"propertyValues\":[{\"v1\":11,\"v2\":\"64G\"},{\"v1\":10,\"v2\":\"32G\"}]},{\"propertyId\":3,\"name\":\"尺寸\",\"propertyValues\":[{\"v1\":16,\"v2\":\"6.1\"},{\"v1\":15,\"v2\":\"5.7\"}]}]") | |
| 63 | 63 | private List<ProductPropertyViewRespVO> productPropertyViews; |
| 64 | 64 | |
| 65 | 65 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/ProductPropertyConvert.java
| ... | ... | @@ -5,16 +5,14 @@ import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.Pro |
| 5 | 5 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyCreateReqVO; |
| 6 | 6 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyRespVO; |
| 7 | 7 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyUpdateReqVO; |
| 8 | -import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO; | |
| 9 | 8 | import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; |
| 10 | -import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; | |
| 11 | 9 | import org.mapstruct.Mapper; |
| 12 | 10 | import org.mapstruct.factory.Mappers; |
| 13 | 11 | |
| 14 | 12 | import java.util.List; |
| 15 | 13 | |
| 16 | 14 | /** |
| 17 | - * 规格名称 Convert | |
| 15 | + * 属性项 Convert | |
| 18 | 16 | * |
| 19 | 17 | * @author 芋道源码 |
| 20 | 18 | */ | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/ProductPropertyValueConvert.java
| 1 | 1 | package cn.iocoder.yudao.module.product.convert.propertyvalue; |
| 2 | 2 | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | - | |
| 7 | 4 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO; |
| 8 | 5 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO; |
| 9 | 6 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO; |
| ... | ... | @@ -11,8 +8,10 @@ import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyVa |
| 11 | 8 | import org.mapstruct.Mapper; |
| 12 | 9 | import org.mapstruct.factory.Mappers; |
| 13 | 10 | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 14 | 13 | /** |
| 15 | - * 规格值 Convert | |
| 14 | + * 属性值 Convert | |
| 16 | 15 | * |
| 17 | 16 | * @author 芋道源码 |
| 18 | 17 | */ | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java
| ... | ... | @@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableName; |
| 8 | 8 | import lombok.*; |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | - * 规格名称 DO | |
| 11 | + * 商品属性项 DO | |
| 12 | 12 | * |
| 13 | 13 | * @author 芋道源码 |
| 14 | 14 | */ |
| ... | ... | @@ -28,7 +28,7 @@ public class ProductPropertyDO extends BaseDO { |
| 28 | 28 | @TableId |
| 29 | 29 | private Long id; |
| 30 | 30 | /** |
| 31 | - * 规格名称 | |
| 31 | + * 名称 | |
| 32 | 32 | */ |
| 33 | 33 | private String name; |
| 34 | 34 | /** | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyValueDO.java
| ... | ... | @@ -9,7 +9,7 @@ import lombok.*; |
| 9 | 9 | |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | - * 规格值 DO | |
| 12 | + * 商品属性值 DO | |
| 13 | 13 | * |
| 14 | 14 | * @author 芋道源码 |
| 15 | 15 | */ |
| ... | ... | @@ -29,13 +29,13 @@ public class ProductPropertyValueDO extends BaseDO { |
| 29 | 29 | @TableId |
| 30 | 30 | private Long id; |
| 31 | 31 | /** |
| 32 | - * 规格键编号 | |
| 32 | + * 属性项的编号 | |
| 33 | 33 | * |
| 34 | 34 | * 关联 {@link ProductPropertyDO#getId()} |
| 35 | 35 | */ |
| 36 | 36 | private Long propertyId; |
| 37 | 37 | /** |
| 38 | - * 规格值名字 | |
| 38 | + * 名称 | |
| 39 | 39 | */ |
| 40 | 40 | private String name; |
| 41 | 41 | /** | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyMapper.java
| ... | ... | @@ -7,13 +7,6 @@ import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.Pro |
| 7 | 7 | import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; |
| 8 | 8 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 9 | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 规格名称 Mapper | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | 10 | @Mapper |
| 18 | 11 | public interface ProductPropertyMapper extends BaseMapperX<ProductPropertyDO> { |
| 19 | 12 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyValueMapper.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyService.java
| 1 | 1 | package cn.iocoder.yudao.module.product.service.property; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyRespVO; | |
| 5 | 4 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.*; |
| 6 | -import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; | |
| 7 | 5 | |
| 8 | 6 | import javax.validation.Valid; |
| 9 | 7 | import java.util.Collection; |
| 10 | 8 | import java.util.List; |
| 11 | 9 | |
| 12 | 10 | /** |
| 13 | - * 规格名称 Service 接口 | |
| 11 | + * 商品属性项 Service 接口 | |
| 14 | 12 | * |
| 15 | 13 | * @author 芋道源码 |
| 16 | 14 | */ |
| 17 | 15 | public interface ProductPropertyService { |
| 18 | 16 | |
| 19 | 17 | /** |
| 20 | - * 创建规格名称 | |
| 18 | + * 创建属性项 | |
| 21 | 19 | * |
| 22 | 20 | * @param createReqVO 创建信息 |
| 23 | 21 | * @return 编号 |
| ... | ... | @@ -25,23 +23,23 @@ public interface ProductPropertyService { |
| 25 | 23 | Long createProperty(@Valid ProductPropertyCreateReqVO createReqVO); |
| 26 | 24 | |
| 27 | 25 | /** |
| 28 | - * 更新规格名称 | |
| 26 | + * 更新属性项 | |
| 29 | 27 | * |
| 30 | 28 | * @param updateReqVO 更新信息 |
| 31 | 29 | */ |
| 32 | 30 | void updateProperty(@Valid ProductPropertyUpdateReqVO updateReqVO); |
| 33 | 31 | |
| 34 | 32 | /** |
| 35 | - * 删除规格名称 | |
| 33 | + * 删除属性项 | |
| 36 | 34 | * |
| 37 | 35 | * @param id 编号 |
| 38 | 36 | */ |
| 39 | 37 | void deleteProperty(Long id); |
| 40 | 38 | |
| 41 | 39 | /** |
| 42 | - * 获得规格名称列表 | |
| 40 | + * 获得属性项列表 | |
| 43 | 41 | * @param listReqVO 集合查询 |
| 44 | - * @return 规格名称集合 | |
| 42 | + * @return 属性项集合 | |
| 45 | 43 | */ |
| 46 | 44 | List<ProductPropertyRespVO> getPropertyList(ProductPropertyListReqVO listReqVO); |
| 47 | 45 | |
| ... | ... | @@ -49,31 +47,31 @@ public interface ProductPropertyService { |
| 49 | 47 | * 获取属性名称分页 |
| 50 | 48 | * |
| 51 | 49 | * @param pageReqVO 分页条件 |
| 52 | - * @return 规格名称分页 | |
| 50 | + * @return 属性项分页 | |
| 53 | 51 | */ |
| 54 | 52 | PageResult<ProductPropertyRespVO> getPropertyPage(ProductPropertyPageReqVO pageReqVO); |
| 55 | 53 | |
| 56 | 54 | /** |
| 57 | - * 获得指定编号的规格名称 | |
| 55 | + * 获得指定编号的属性项 | |
| 58 | 56 | * |
| 59 | 57 | * @param id 编号 |
| 60 | - * @return 规格名称 | |
| 58 | + * @return 属性项 | |
| 61 | 59 | */ |
| 62 | 60 | ProductPropertyRespVO getProperty(Long id); |
| 63 | 61 | |
| 64 | 62 | /** |
| 65 | - * 根据规格属性编号的集合,获得对应的规格 + 规格值的集合 | |
| 63 | + * 根据属性项的编号的集合,获得对应的属性项数组 | |
| 66 | 64 | * |
| 67 | - * @param ids 规格编号的集合 | |
| 68 | - * @return 对应的规格 | |
| 65 | + * @param ids 属性项的编号的集合 | |
| 66 | + * @return 属性项数组 | |
| 69 | 67 | */ |
| 70 | 68 | List<ProductPropertyRespVO> getPropertyList(Collection<Long> ids); |
| 71 | 69 | |
| 72 | 70 | /** |
| 73 | - * 获得规格名称 + 值的列表 | |
| 71 | + * 获得属性项 + 值的列表 | |
| 74 | 72 | * |
| 75 | 73 | * @param listReqVO 列表查询 |
| 76 | - * @return 规格名称 + 值的列表 | |
| 74 | + * @return 属性项 + 值的列表 | |
| 77 | 75 | */ |
| 78 | 76 | List<ProductPropertyAndValueRespVO> getPropertyAndValueList(ProductPropertyListReqVO listReqVO); |
| 79 | 77 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java
| ... | ... | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.product.service.property; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 5 | -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | |
| 6 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 7 | 6 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.*; |
| 8 | 7 | import cn.iocoder.yudao.module.product.convert.property.ProductPropertyConvert; |
| ... | ... | @@ -19,14 +18,13 @@ import javax.annotation.Resource; |
| 19 | 18 | import java.util.Collection; |
| 20 | 19 | import java.util.List; |
| 21 | 20 | import java.util.Map; |
| 22 | -import java.util.Objects; | |
| 23 | 21 | |
| 24 | 22 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 25 | 23 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_EXISTS; |
| 26 | 24 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_NOT_EXISTS; |
| 27 | 25 | |
| 28 | 26 | /** |
| 29 | - * 规格名称 Service 实现类 | |
| 27 | + * 商品属性项 Service 实现类 | |
| 30 | 28 | * |
| 31 | 29 | * @author 芋道源码 |
| 32 | 30 | */ |
| ... | ... | @@ -58,7 +56,7 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { |
| 58 | 56 | @Transactional(rollbackFor = Exception.class) |
| 59 | 57 | public void updateProperty(ProductPropertyUpdateReqVO updateReqVO) { |
| 60 | 58 | // 校验存在 |
| 61 | - this.validatePropertyExists(updateReqVO.getId()); | |
| 59 | + validatePropertyExists(updateReqVO.getId()); | |
| 62 | 60 | ProductPropertyDO productPropertyDO = productPropertyMapper.selectByName(updateReqVO.getName()); |
| 63 | 61 | if (productPropertyDO != null && !productPropertyDO.getId().equals(updateReqVO.getId())) { |
| 64 | 62 | throw exception(PROPERTY_EXISTS); |
| ... | ... | @@ -71,10 +69,10 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { |
| 71 | 69 | @Override |
| 72 | 70 | public void deleteProperty(Long id) { |
| 73 | 71 | // 校验存在 |
| 74 | - this.validatePropertyExists(id); | |
| 72 | + validatePropertyExists(id); | |
| 75 | 73 | // 删除 |
| 76 | 74 | productPropertyMapper.deleteById(id); |
| 77 | - //同步删除属性值 | |
| 75 | + // 同步删除属性值 | |
| 78 | 76 | productPropertyValueMapper.deletePropertyValueByPropertyId(id); |
| 79 | 77 | } |
| 80 | 78 | |
| ... | ... | @@ -93,7 +91,6 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { |
| 93 | 91 | |
| 94 | 92 | @Override |
| 95 | 93 | public PageResult<ProductPropertyRespVO> getPropertyPage(ProductPropertyPageReqVO pageReqVO) { |
| 96 | - //获取属性列表 | |
| 97 | 94 | PageResult<ProductPropertyDO> pageResult = productPropertyMapper.selectPage(pageReqVO); |
| 98 | 95 | return ProductPropertyConvert.INSTANCE.convertPage(pageResult); |
| 99 | 96 | } |
| ... | ... | @@ -104,11 +101,13 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { |
| 104 | 101 | return ProductPropertyConvert.INSTANCE.convert(property); |
| 105 | 102 | } |
| 106 | 103 | |
| 104 | + // TODO @芋艿:丢到 Controller | |
| 107 | 105 | @Override |
| 108 | 106 | public List<ProductPropertyRespVO> getPropertyList(Collection<Long> ids) { |
| 109 | 107 | return ProductPropertyConvert.INSTANCE.convertList(productPropertyMapper.selectBatchIds(ids)); |
| 110 | 108 | } |
| 111 | 109 | |
| 110 | + // TODO @芋艿:丢到 Controller | |
| 112 | 111 | @Override |
| 113 | 112 | public List<ProductPropertyAndValueRespVO> getPropertyAndValueList(ProductPropertyListReqVO listReqVO) { |
| 114 | 113 | List<ProductPropertyRespVO> propertyList = getPropertyList(listReqVO); | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyValueService.java
| ... | ... | @@ -9,16 +9,14 @@ import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.Produc |
| 9 | 9 | import java.util.List; |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | - * <p> | |
| 13 | - * 规格值 Service 接口 | |
| 14 | - * </p> | |
| 12 | + * 商品属性值 Service 接口 | |
| 15 | 13 | * |
| 16 | 14 | * @author LuoWenFeng |
| 17 | 15 | */ |
| 18 | 16 | public interface ProductPropertyValueService { |
| 19 | 17 | |
| 20 | 18 | /** |
| 21 | - * 创建规格值 | |
| 19 | + * 创建属性值 | |
| 22 | 20 | * |
| 23 | 21 | * @param createReqVO 创建信息 |
| 24 | 22 | * @return 编号 |
| ... | ... | @@ -26,40 +24,40 @@ public interface ProductPropertyValueService { |
| 26 | 24 | Long createPropertyValue(ProductPropertyValueCreateReqVO createReqVO); |
| 27 | 25 | |
| 28 | 26 | /** |
| 29 | - * 更新规格值 | |
| 27 | + * 更新属性值 | |
| 30 | 28 | * |
| 31 | 29 | * @param updateReqVO 更新信息 |
| 32 | 30 | */ |
| 33 | 31 | void updatePropertyValue(ProductPropertyValueUpdateReqVO updateReqVO); |
| 34 | 32 | |
| 35 | 33 | /** |
| 36 | - * 删除规格值 | |
| 34 | + * 删除属性值 | |
| 37 | 35 | * |
| 38 | 36 | * @param id 编号 |
| 39 | 37 | */ |
| 40 | 38 | void deletePropertyValue(Long id); |
| 41 | 39 | |
| 42 | 40 | /** |
| 43 | - * 获得规格值 | |
| 41 | + * 获得属性值 | |
| 44 | 42 | * |
| 45 | 43 | * @param id 编号 |
| 46 | - * @return 规格名称 | |
| 44 | + * @return 属性值 | |
| 47 | 45 | */ |
| 48 | 46 | ProductPropertyValueRespVO getPropertyValue(Long id); |
| 49 | 47 | |
| 50 | 48 | /** |
| 51 | - * 获得规格值 | |
| 49 | + * 获得属性值 | |
| 52 | 50 | * |
| 53 | 51 | * @param id 编号 |
| 54 | - * @return 规格名称 | |
| 52 | + * @return 属性值 | |
| 55 | 53 | */ |
| 56 | 54 | List<ProductPropertyValueRespVO> getPropertyValueListByPropertyId(List<Long> id); |
| 57 | 55 | |
| 58 | 56 | /** |
| 59 | - * 获取规格值 分页 | |
| 57 | + * 获取属性值的分页 | |
| 60 | 58 | * |
| 61 | 59 | * @param pageReqVO 查询条件 |
| 62 | - * @return | |
| 60 | + * @return 属性值的分页 | |
| 63 | 61 | */ |
| 64 | 62 | PageResult<ProductPropertyValueRespVO> getPropertyValueListPage(ProductPropertyValuePageReqVO pageReqVO); |
| 65 | 63 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyValueServiceImpl.java
| ... | ... | @@ -14,13 +14,12 @@ import org.springframework.validation.annotation.Validated; |
| 14 | 14 | |
| 15 | 15 | import javax.annotation.Resource; |
| 16 | 16 | import java.util.List; |
| 17 | -import java.util.Objects; | |
| 18 | 17 | |
| 19 | 18 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 20 | 19 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_VALUE_EXISTS; |
| 21 | 20 | |
| 22 | 21 | /** |
| 23 | - * 规格值 Service 实现类 | |
| 22 | + * 商品属性值 Service 实现类 | |
| 24 | 23 | * |
| 25 | 24 | * @author LuoWenFeng |
| 26 | 25 | */ | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/bo/ProductPropertyValueDetailRespBO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.product.service.property.bo; | |
| 2 | + | |
| 3 | +import lombok.Data; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 商品属性项的明细 Response BO | |
| 7 | + * | |
| 8 | + * @author 芋道源码 | |
| 9 | + */ | |
| 10 | +@Data | |
| 11 | +public class ProductPropertyValueDetailRespBO { | |
| 12 | + | |
| 13 | + /** | |
| 14 | + * 属性的编号 | |
| 15 | + */ | |
| 16 | + private Long propertyId; | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 属性的名称 | |
| 20 | + */ | |
| 21 | + private String propertyName; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 属性值的编号 | |
| 25 | + */ | |
| 26 | + private Long valueId; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 属性值的名称 | |
| 30 | + */ | |
| 31 | + private String valueName; | |
| 32 | + | |
| 33 | +} | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java
| ... | ... | @@ -84,15 +84,17 @@ public class ProductSkuServiceImpl implements ProductSkuService { |
| 84 | 84 | return; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - // 1、校验规格属性存在 | |
| 88 | - Set<Long> propertyIds = skus.stream().filter(p -> p.getProperties() != null).flatMap(p -> p.getProperties().stream()) // 遍历多个 Property 属性 | |
| 89 | - .map(ProductSkuBaseVO.Property::getPropertyId).collect(Collectors.toSet()); // 将每个 Property 转换成对应的 propertyId,最后形成集合 | |
| 87 | + // 1、校验属性项存在 | |
| 88 | + Set<Long> propertyIds = skus.stream().filter(p -> p.getProperties() != null) | |
| 89 | + .flatMap(p -> p.getProperties().stream()) // 遍历多个 Property 属性 | |
| 90 | + .map(ProductSkuBaseVO.Property::getPropertyId) // 将每个 Property 转换成对应的 propertyId,最后形成集合 | |
| 91 | + .collect(Collectors.toSet()); | |
| 90 | 92 | List<ProductPropertyRespVO> propertyList = productPropertyService.getPropertyList(propertyIds); |
| 91 | 93 | if (propertyList.size() != propertyIds.size()) { |
| 92 | 94 | throw exception(PROPERTY_NOT_EXISTS); |
| 93 | 95 | } |
| 94 | 96 | |
| 95 | - // 2. 校验,一个 SKU 下,没有重复的规格。校验方式是,遍历每个 SKU ,看看是否有重复的规格 propertyId | |
| 97 | + // 2. 校验,一个 SKU 下,没有重复的属性。校验方式是,遍历每个 SKU ,看看是否有重复的属性 propertyId | |
| 96 | 98 | Map<Long, ProductPropertyValueRespVO> propertyValueMap = CollectionUtils.convertMap(productPropertyValueService.getPropertyValueListByPropertyId(new ArrayList<>(propertyIds)), ProductPropertyValueRespVO::getId); |
| 97 | 99 | skus.forEach(sku -> { |
| 98 | 100 | Set<Long> skuPropertyIds = convertSet(sku.getProperties(), propertyItem -> propertyValueMap.get(propertyItem.getValueId()).getPropertyId()); |
| ... | ... | @@ -101,7 +103,7 @@ public class ProductSkuServiceImpl implements ProductSkuService { |
| 101 | 103 | } |
| 102 | 104 | }); |
| 103 | 105 | |
| 104 | - // 3. 再校验,每个 Sku 的规格值的数量,是一致的。 | |
| 106 | + // 3. 再校验,每个 Sku 的属性值的数量,是一致的。 | |
| 105 | 107 | int attrValueIdsSize = skus.get(0).getProperties().size(); |
| 106 | 108 | for (int i = 1; i < skus.size(); i++) { |
| 107 | 109 | if (attrValueIdsSize != skus.get(i).getProperties().size()) { |
| ... | ... | @@ -151,7 +153,7 @@ public class ProductSkuServiceImpl implements ProductSkuService { |
| 151 | 153 | public void updateSkus(Long spuId, String spuName, List<ProductSkuCreateOrUpdateReqVO> skus) { |
| 152 | 154 | // 查询 SPU 下已经存在的 SKU 的集合 |
| 153 | 155 | List<ProductSkuDO> existsSkus = productSkuMapper.selectListBySpuId(spuId); |
| 154 | - // 构建规格与 SKU 的映射关系; | |
| 156 | + // 构建属性与 SKU 的映射关系; | |
| 155 | 157 | // TODO @luowenfeng: 可以下 existsSkuMap2; 会简洁一点; 另外, 可以考虑抽一个小方法, 用于 Properties 生成一个串; 这样 177 也可以复用了 |
| 156 | 158 | Map<String, Long> existsSkuMap = existsSkus.stream() |
| 157 | 159 | .map(v -> { | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java
| ... | ... | @@ -133,7 +133,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { |
| 133 | 133 | if (null != spu) { |
| 134 | 134 | List<ProductSpuDetailRespVO.Sku> skuReqs = ProductSkuConvert.INSTANCE.convertList03(productSkuService.getSkusBySpuId(id)); |
| 135 | 135 | respVO.setSkus(skuReqs); |
| 136 | - // 组合 sku 规格属性 | |
| 136 | + // 组合 sku 属性 | |
| 137 | 137 | if (spu.getSpecType().equals(ProductSpuSpecTypeEnum.DISABLE.getType())) { |
| 138 | 138 | List<ProductSkuRespVO.Property> properties = new ArrayList<>(); |
| 139 | 139 | for (ProductSpuDetailRespVO.Sku productSkuRespVO : skuReqs) { | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/price/PriceServiceImpl.java
| ... | ... | @@ -265,7 +265,7 @@ public class PriceServiceImpl implements PriceService { |
| 265 | 265 | |
| 266 | 266 | private void calculatePriceByRewardActivity(PriceCalculateRespDTO priceCalculate, List<PriceCalculateRespDTO.OrderItem> orderItems, |
| 267 | 267 | RewardActivityDO rewardActivity) { |
| 268 | - // 获得最大匹配的满减送活动的规格 | |
| 268 | + // 获得最大匹配的满减送活动的规则 | |
| 269 | 269 | RewardActivityDO.Rule rule = getLastMatchRewardActivityRule(rewardActivity, orderItems); |
| 270 | 270 | if (rule == null) { |
| 271 | 271 | // 获取不到的情况下,记录不满足的优惠明细 |
| ... | ... | @@ -288,11 +288,11 @@ public class PriceServiceImpl implements PriceService { |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
| 291 | - * 获得最大匹配的满减送活动的规格 | |
| 291 | + * 获得最大匹配的满减送活动的规则 | |
| 292 | 292 | * |
| 293 | 293 | * @param rewardActivity 满减送活动 |
| 294 | 294 | * @param orderItems 商品项 |
| 295 | - * @return 匹配的活动规格 | |
| 295 | + * @return 匹配的活动规则 | |
| 296 | 296 | */ |
| 297 | 297 | private RewardActivityDO.Rule getLastMatchRewardActivityRule(RewardActivityDO rewardActivity, |
| 298 | 298 | List<PriceCalculateRespDTO.OrderItem> orderItems) { | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleBaseVO.java
| ... | ... | @@ -72,7 +72,7 @@ public class TradeAfterSaleBaseVO { |
| 72 | 72 | @NotNull(message = "商品 SKU 编号不能为空") |
| 73 | 73 | private Long skuId; |
| 74 | 74 | |
| 75 | - @ApiModelProperty(value = "规格值数组") | |
| 75 | + @ApiModelProperty(value = "商品属性数组") | |
| 76 | 76 | private List<ProductPropertyValueDetailRespVO> properties; |
| 77 | 77 | |
| 78 | 78 | @ApiModelProperty(value = "商品图片", example = "https://www.iocoder.cn/2.png") | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/base/product/property/ProductPropertyValueDetailRespVO.java
| ... | ... | @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; |
| 4 | 4 | import io.swagger.annotations.ApiModelProperty; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | |
| 7 | -@ApiModel("管理后台 - 商品规格 + 规格值的明细 Response VO") | |
| 7 | +@ApiModel("管理后台 - 商品属性值的明细 Response VO") | |
| 8 | 8 | @Data |
| 9 | 9 | public class ProductPropertyValueDetailRespVO { |
| 10 | 10 | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java
| 1 | 1 | package cn.iocoder.yudao.module.trade.controller.admin.order; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 6 | import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDeliveryReqVO; |
| 6 | 7 | import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageItemRespVO; |
| 7 | 8 | import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO; |
| 9 | +import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert; | |
| 8 | 10 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO; |
| 11 | +import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; | |
| 9 | 12 | import cn.iocoder.yudao.module.trade.service.order.TradeOrderService; |
| 10 | 13 | import io.swagger.annotations.Api; |
| 11 | 14 | import io.swagger.annotations.ApiOperation; |
| ... | ... | @@ -15,8 +18,11 @@ import org.springframework.validation.annotation.Validated; |
| 15 | 18 | import org.springframework.web.bind.annotation.*; |
| 16 | 19 | |
| 17 | 20 | import javax.annotation.Resource; |
| 21 | +import java.util.List; | |
| 22 | +import java.util.Set; | |
| 18 | 23 | |
| 19 | 24 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 25 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 20 | 26 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 21 | 27 | |
| 22 | 28 | @Api(tags = "管理后台 - 交易订单") |
| ... | ... | @@ -33,7 +39,19 @@ public class TradeOrderController { |
| 33 | 39 | @ApiOperation("获得交易订单分页") |
| 34 | 40 | @PreAuthorize("@ss.hasPermission('trade:order:query')") |
| 35 | 41 | public CommonResult<PageResult<TradeOrderPageItemRespVO>> getOrderPage(TradeOrderPageReqVO reqVO) { |
| 42 | + // 查询订单 | |
| 36 | 43 | PageResult<TradeOrderDO> pageResult = tradeOrderService.getOrderPage(reqVO); |
| 44 | + if (CollUtil.isEmpty(pageResult.getList())) { | |
| 45 | + return success(PageResult.empty()); | |
| 46 | + } | |
| 47 | + | |
| 48 | + // 查询订单项 | |
| 49 | + List<TradeOrderItemDO> orderItems = tradeOrderService.getOrderItems( | |
| 50 | + convertSet(pageResult.getList(), TradeOrderDO::getId)); | |
| 51 | + // 查询属性 | |
| 52 | + Set<Long> propertyValueIds = TradeOrderConvert.INSTANCE.convertPropertyValueIds(orderItems); | |
| 53 | + | |
| 54 | + | |
| 37 | 55 | return success(null); |
| 38 | 56 | } |
| 39 | 57 | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderPageItemRespVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderPageReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.trade.controller.admin.order.vo; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 4 | 5 | import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; |
| 5 | 6 | import io.swagger.annotations.ApiModel; |
| ... | ... | @@ -8,7 +9,7 @@ import lombok.Data; |
| 8 | 9 | |
| 9 | 10 | @ApiModel("管理后台 - 交易订单的分页 Request VO") |
| 10 | 11 | @Data |
| 11 | -public class TradeOrderPageReqVO { | |
| 12 | +public class TradeOrderPageReqVO extends PageParam { | |
| 12 | 13 | |
| 13 | 14 | @ApiModelProperty(value = "订单状态", example = "1", notes = "参见 TradeOrderStatusEnum 枚举") |
| 14 | 15 | @InEnum(value = TradeOrderStatusEnum.class, message = "订单状态必须是 {value}") | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/base/property/AppProductPropertyValueDetailRespVO.java
| ... | ... | @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; |
| 4 | 4 | import io.swagger.annotations.ApiModelProperty; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | |
| 7 | -@ApiModel("用户 App - 商品规格 + 规格值的明细 Response VO") | |
| 7 | +@ApiModel("用户 App - 商品属性值的明细 Response VO") | |
| 8 | 8 | @Data |
| 9 | 9 | public class AppProductPropertyValueDetailRespVO { |
| 10 | 10 | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/base/sku/AppProductSkuBaseRespVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderGetCreateInfoRespVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java
| 1 | 1 | package cn.iocoder.yudao.module.trade.convert.order; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 4 | 5 | import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO; |
| 5 | 6 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; |
| ... | ... | @@ -18,8 +19,11 @@ import org.mapstruct.Mapping; |
| 18 | 19 | import org.mapstruct.Mappings; |
| 19 | 20 | import org.mapstruct.factory.Mappers; |
| 20 | 21 | |
| 22 | +import java.util.HashSet; | |
| 21 | 23 | import java.util.List; |
| 22 | 24 | import java.util.Map; |
| 25 | +import java.util.Set; | |
| 26 | +import java.util.stream.Collectors; | |
| 23 | 27 | |
| 24 | 28 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; |
| 25 | 29 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.addTime; |
| ... | ... | @@ -88,4 +92,14 @@ public interface TradeOrderConvert { |
| 88 | 92 | return createReqDTO; |
| 89 | 93 | } |
| 90 | 94 | |
| 95 | + default Set<Long> convertPropertyValueIds(List<TradeOrderItemDO> orderItems) { | |
| 96 | + if (CollUtil.isEmpty(orderItems)) { | |
| 97 | + return new HashSet<>(); | |
| 98 | + } | |
| 99 | + return orderItems.stream().filter(item -> item.getProperties() != null) | |
| 100 | + .flatMap(p -> p.getProperties().stream()) // 遍历多个 Property 属性 | |
| 101 | + .map(TradeOrderItemDO.Property::getValueId) // 将每个 Property 转换成对应的 propertyId,最后形成集合 | |
| 102 | + .collect(Collectors.toSet()); | |
| 103 | + } | |
| 104 | + | |
| 91 | 105 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/TradeAfterSaleDO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderMapper.java
| 1 | 1 | package cn.iocoder.yudao.module.trade.dal.mysql.order; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 3 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO; | |
| 4 | 7 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO; |
| 5 | 8 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 6 | 9 | import org.apache.ibatis.annotations.Mapper; |
| ... | ... | @@ -14,8 +17,12 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> { |
| 14 | 17 | } |
| 15 | 18 | |
| 16 | 19 | default TradeOrderDO selectByIdAndUserId(Long id, Long userId) { |
| 17 | - return selectOne(TradeOrderDO::getId, id, | |
| 18 | - TradeOrderDO::getUserId, userId); | |
| 20 | + return selectOne(TradeOrderDO::getId, id, TradeOrderDO::getUserId, userId); | |
| 21 | + } | |
| 22 | + | |
| 23 | + default PageResult<TradeOrderDO> selectPage(TradeOrderPageReqVO reqVO) { | |
| 24 | + return selectPage(reqVO, new LambdaQueryWrapperX<TradeOrderDO>() | |
| 25 | + .eqIfPresent(TradeOrderDO::getStatus, reqVO.getStatus())); | |
| 19 | 26 | } |
| 20 | 27 | |
| 21 | 28 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderService.java
| ... | ... | @@ -7,6 +7,12 @@ import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreate |
| 7 | 7 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO; |
| 8 | 8 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; |
| 9 | 9 | |
| 10 | +import java.util.Collection; | |
| 11 | +import java.util.List; | |
| 12 | +import java.util.Map; | |
| 13 | + | |
| 14 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap; | |
| 15 | + | |
| 10 | 16 | /** |
| 11 | 17 | * 交易订单 Service 接口 |
| 12 | 18 | * |
| ... | ... | @@ -90,4 +96,23 @@ public interface TradeOrderService { |
| 90 | 96 | void updateOrderItemAfterSaleStatus(Long id, Integer oldAfterSaleStatus, |
| 91 | 97 | Integer newAfterSaleStatus, Integer refundPrice); |
| 92 | 98 | |
| 99 | + /** | |
| 100 | + * 查询交易订单项 | |
| 101 | + * | |
| 102 | + * @param ids 交易订单项编号数组 | |
| 103 | + * @return 交易订单项数组 | |
| 104 | + */ | |
| 105 | + List<TradeOrderItemDO> getOrderItems(Collection<Long> ids); | |
| 106 | + | |
| 107 | + /** | |
| 108 | + * 查询交易订单项 Map | |
| 109 | + * | |
| 110 | + * @param ids 交易订单项编号数组 | |
| 111 | + * @return 交易订单项 Map | |
| 112 | + */ | |
| 113 | + default Map<Long, List<TradeOrderItemDO>> getOrderItemMap(Collection<Long> ids) { | |
| 114 | + List<TradeOrderItemDO> orderItems = getOrderItems(ids); | |
| 115 | + return convertMultiMap(orderItems, TradeOrderItemDO::getOrderId); | |
| 116 | + } | |
| 117 | + | |
| 93 | 118 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceImpl.java
| ... | ... | @@ -43,10 +43,7 @@ import org.springframework.transaction.annotation.Transactional; |
| 43 | 43 | |
| 44 | 44 | import javax.annotation.Resource; |
| 45 | 45 | import java.time.LocalDateTime; |
| 46 | -import java.util.List; | |
| 47 | -import java.util.Map; | |
| 48 | -import java.util.Objects; | |
| 49 | -import java.util.Set; | |
| 46 | +import java.util.*; | |
| 50 | 47 | |
| 51 | 48 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 52 | 49 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| ... | ... | @@ -423,7 +420,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { |
| 423 | 420 | |
| 424 | 421 | @Override |
| 425 | 422 | public PageResult<TradeOrderDO> getOrderPage(TradeOrderPageReqVO reqVO) { |
| 426 | - return null; | |
| 423 | + return tradeOrderMapper.selectPage(reqVO); | |
| 427 | 424 | } |
| 428 | 425 | |
| 429 | 426 | // =================== Order Item =================== |
| ... | ... | @@ -475,6 +472,11 @@ public class TradeOrderServiceImpl implements TradeOrderService { |
| 475 | 472 | // TODO 芋艿:未来如果有分佣,需要更新相关分佣订单为已失效 |
| 476 | 473 | } |
| 477 | 474 | |
| 475 | + @Override | |
| 476 | + public List<TradeOrderItemDO> getOrderItems(Collection<Long> ids) { | |
| 477 | + return tradeOrderItemMapper.selectBatchIds(ids); | |
| 478 | + } | |
| 479 | + | |
| 478 | 480 | /** |
| 479 | 481 | * 判断指定订单的所有订单项,是不是都售后成功 |
| 480 | 482 | * | ... | ... |
yudao-ui-admin/src/api/mall/product/property.js
| 1 | 1 | import request from '@/utils/request' |
| 2 | 2 | |
| 3 | -// 创建规格名称 | |
| 3 | +// ------------------------ 属性项 ------------------- | |
| 4 | + | |
| 5 | +// 创建属性项 | |
| 4 | 6 | export function createProperty(data) { |
| 5 | 7 | return request({ |
| 6 | 8 | url: '/product/property/create', |
| ... | ... | @@ -9,7 +11,7 @@ export function createProperty(data) { |
| 9 | 11 | }) |
| 10 | 12 | } |
| 11 | 13 | |
| 12 | -// 更新规格名称 | |
| 14 | +// 更新属性项 | |
| 13 | 15 | export function updateProperty(data) { |
| 14 | 16 | return request({ |
| 15 | 17 | url: '/product/property/update', |
| ... | ... | @@ -18,7 +20,7 @@ export function updateProperty(data) { |
| 18 | 20 | }) |
| 19 | 21 | } |
| 20 | 22 | |
| 21 | -// 删除规格名称 | |
| 23 | +// 删除属性项 | |
| 22 | 24 | export function deleteProperty(id) { |
| 23 | 25 | return request({ |
| 24 | 26 | url: '/product/property/delete?id=' + id, |
| ... | ... | @@ -26,7 +28,7 @@ export function deleteProperty(id) { |
| 26 | 28 | }) |
| 27 | 29 | } |
| 28 | 30 | |
| 29 | -// 获得规格名称 | |
| 31 | +// 获得属性项 | |
| 30 | 32 | export function getProperty(id) { |
| 31 | 33 | return request({ |
| 32 | 34 | url: '/product/property/get?id=' + id, |
| ... | ... | @@ -34,7 +36,7 @@ export function getProperty(id) { |
| 34 | 36 | }) |
| 35 | 37 | } |
| 36 | 38 | |
| 37 | -// 获得规格名称分页 | |
| 39 | +// 获得属性项分页 | |
| 38 | 40 | export function getPropertyPage(query) { |
| 39 | 41 | return request({ |
| 40 | 42 | url: '/product/property/page', |
| ... | ... | @@ -43,7 +45,7 @@ export function getPropertyPage(query) { |
| 43 | 45 | }) |
| 44 | 46 | } |
| 45 | 47 | |
| 46 | -// 获得规格名称列表 | |
| 48 | +// 获得属性项列表 | |
| 47 | 49 | export function getPropertyList(query) { |
| 48 | 50 | return request({ |
| 49 | 51 | url: '/product/property/list', |
| ... | ... | @@ -52,7 +54,7 @@ export function getPropertyList(query) { |
| 52 | 54 | }) |
| 53 | 55 | } |
| 54 | 56 | |
| 55 | -// 获得规格名称列表 | |
| 57 | +// 获得属性项列表 | |
| 56 | 58 | export function getPropertyListAndValue(query) { |
| 57 | 59 | return request({ |
| 58 | 60 | url: '/product/property/listAndValue', |
| ... | ... | @@ -62,7 +64,7 @@ export function getPropertyListAndValue(query) { |
| 62 | 64 | } |
| 63 | 65 | |
| 64 | 66 | |
| 65 | -// 导出规格名称 Excel | |
| 67 | +// 导出属性项 Excel | |
| 66 | 68 | export function exportPropertyExcel(query) { |
| 67 | 69 | return request({ |
| 68 | 70 | url: '/product/property/export-excel', |
| ... | ... | @@ -72,9 +74,9 @@ export function exportPropertyExcel(query) { |
| 72 | 74 | }) |
| 73 | 75 | } |
| 74 | 76 | |
| 75 | -// ------------------------ 规格名称值 ------------------- | |
| 77 | +// ------------------------ 属性值 ------------------- | |
| 76 | 78 | |
| 77 | -// 获得规格名称值分页 | |
| 79 | +// 获得属性值分页 | |
| 78 | 80 | export function getPropertyValuePage(query) { |
| 79 | 81 | return request({ |
| 80 | 82 | url: '/product/property/value/page', |
| ... | ... | @@ -83,7 +85,7 @@ export function getPropertyValuePage(query) { |
| 83 | 85 | }) |
| 84 | 86 | } |
| 85 | 87 | |
| 86 | -// 获得规格名称值 | |
| 88 | +// 获得属性值 | |
| 87 | 89 | export function getPropertyValue(id) { |
| 88 | 90 | return request({ |
| 89 | 91 | url: '/product/property/value/get?id=' + id, |
| ... | ... | @@ -92,7 +94,7 @@ export function getPropertyValue(id) { |
| 92 | 94 | } |
| 93 | 95 | |
| 94 | 96 | |
| 95 | -// 创建规格名称值 | |
| 97 | +// 创建属性值 | |
| 96 | 98 | export function createPropertyValue(data) { |
| 97 | 99 | return request({ |
| 98 | 100 | url: '/product/property/value/create', |
| ... | ... | @@ -101,7 +103,7 @@ export function createPropertyValue(data) { |
| 101 | 103 | }) |
| 102 | 104 | } |
| 103 | 105 | |
| 104 | -// 更新规格名称值 | |
| 106 | +// 更新属性值 | |
| 105 | 107 | export function updatePropertyValue(data) { |
| 106 | 108 | return request({ |
| 107 | 109 | url: '/product/property/value/update', |
| ... | ... | @@ -110,7 +112,7 @@ export function updatePropertyValue(data) { |
| 110 | 112 | }) |
| 111 | 113 | } |
| 112 | 114 | |
| 113 | -// 删除规格名称 | |
| 115 | +// 删除属性值 | |
| 114 | 116 | export function deletePropertyValue(id) { |
| 115 | 117 | return request({ |
| 116 | 118 | url: '/product/property/value/delete?id=' + id, | ... | ... |
yudao-ui-admin/src/router/index.js
| ... | ... | @@ -106,7 +106,7 @@ export const constantRoutes = [ |
| 106 | 106 | path: 'value/:propertyId(\\d+)', |
| 107 | 107 | component: (resolve) => require(['@/views/mall/product/property/value'], resolve), |
| 108 | 108 | name: 'PropertyValue', |
| 109 | - meta: {title: '规格数据', icon: '', activeMenu: '/product/property'} | |
| 109 | + meta: {title: '商品属性值', icon: '', activeMenu: '/product/property'} | |
| 110 | 110 | } |
| 111 | 111 | ] |
| 112 | 112 | }, { | ... | ... |
yudao-ui-admin/src/views/mall/product/property/index.vue
| ... | ... | @@ -3,8 +3,8 @@ |
| 3 | 3 | |
| 4 | 4 | <!-- 搜索工作栏 --> |
| 5 | 5 | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| 6 | - <el-form-item label="规格名称" prop="name"> | |
| 7 | - <el-input v-model="queryParams.name" placeholder="请输入规格名称" clearable @keyup.enter.native="handleQuery"/> | |
| 6 | + <el-form-item label="名称" prop="name"> | |
| 7 | + <el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/> | |
| 8 | 8 | </el-form-item> |
| 9 | 9 | <el-form-item label="状态" prop="status"> |
| 10 | 10 | <el-select v-model="queryParams.status" placeholder="请选择开启状态" clearable size="small"> |
| ... | ... | @@ -33,8 +33,8 @@ |
| 33 | 33 | |
| 34 | 34 | <!-- 列表 --> |
| 35 | 35 | <el-table v-loading="loading" :data="list"> |
| 36 | - <el-table-column label="规格id" align="center" prop="id" /> | |
| 37 | - <el-table-column label="规格名称" align="center" :show-overflow-tooltip="true"> | |
| 36 | + <el-table-column label="编号" align="center" prop="id" /> | |
| 37 | + <el-table-column label="名称" align="center" :show-overflow-tooltip="true"> | |
| 38 | 38 | <template slot-scope="scope"> |
| 39 | 39 | <router-link :to="'/property/value/' + scope.row.id" class="link-type"> |
| 40 | 40 | <span>{{ scope.row.name }}</span> |
| ... | ... | @@ -68,13 +68,13 @@ |
| 68 | 68 | <!-- 对话框(添加 / 修改) --> |
| 69 | 69 | <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
| 70 | 70 | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| 71 | - <el-form-item label="规格id" prop="id" v-if="form.id != null"> | |
| 71 | + <el-form-item label="编号" prop="id" v-if="form.id != null"> | |
| 72 | 72 | <el-input v-model="form.id" disabled /> |
| 73 | 73 | </el-form-item> |
| 74 | - <el-form-item label="规格名称" prop="name"> | |
| 75 | - <el-input v-model="form.name" placeholder="请输入规格名称" /> | |
| 74 | + <el-form-item label="名称" prop="name"> | |
| 75 | + <el-input v-model="form.name" placeholder="请输入名称" /> | |
| 76 | 76 | </el-form-item> |
| 77 | - <el-form-item label="开启状态" prop="status"> | |
| 77 | + <el-form-item label="状态" prop="status"> | |
| 78 | 78 | <el-radio-group v-model="form.status"> |
| 79 | 79 | <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" |
| 80 | 80 | :key="dict.value" :label="parseInt(dict.value)">{{ dict.label }} |
| ... | ... | @@ -110,7 +110,7 @@ export default { |
| 110 | 110 | showSearch: true, |
| 111 | 111 | // 总条数 |
| 112 | 112 | total: 0, |
| 113 | - // 规格名称列表 | |
| 113 | + // 属性项列表 | |
| 114 | 114 | list: [], |
| 115 | 115 | // 弹出层标题 |
| 116 | 116 | title: "", |
| ... | ... | @@ -134,7 +134,7 @@ export default { |
| 134 | 134 | // 表单校验 |
| 135 | 135 | rules: { |
| 136 | 136 | name: [ |
| 137 | - { required: true, message: "规格不能为空", trigger: "blur" } | |
| 137 | + { required: true, message: "名称不能为空", trigger: "blur" } | |
| 138 | 138 | ], |
| 139 | 139 | status: [ |
| 140 | 140 | { required: true, message: "状态不能为空", trigger: "blur" } |
| ... | ... | @@ -185,7 +185,7 @@ export default { |
| 185 | 185 | handleAdd() { |
| 186 | 186 | this.reset(); |
| 187 | 187 | this.open = true; |
| 188 | - this.title = "添加规格"; | |
| 188 | + this.title = "添加属性项"; | |
| 189 | 189 | }, |
| 190 | 190 | /** 修改按钮操作 */ |
| 191 | 191 | handleUpdate(row) { |
| ... | ... | @@ -194,7 +194,7 @@ export default { |
| 194 | 194 | getProperty(id).then(response => { |
| 195 | 195 | this.form = response.data; |
| 196 | 196 | this.open = true; |
| 197 | - this.title = "修改规格"; | |
| 197 | + this.title = "修改属性项"; | |
| 198 | 198 | }); |
| 199 | 199 | }, |
| 200 | 200 | /** 提交按钮 */ |
| ... | ... | @@ -223,7 +223,7 @@ export default { |
| 223 | 223 | /** 删除按钮操作 */ |
| 224 | 224 | handleDelete(row) { |
| 225 | 225 | const id = row.id; |
| 226 | - this.$modal.confirm('是否确认删除规格名称为"' + row.name + '"的数据项?').then(function() { | |
| 226 | + this.$modal.confirm('是否确认删除名称为"' + row.name + '"的数据项?').then(function() { | |
| 227 | 227 | return deleteProperty(id); |
| 228 | 228 | }).then(() => { |
| 229 | 229 | this.getList(); |
| ... | ... | @@ -237,11 +237,11 @@ export default { |
| 237 | 237 | params.pageNo = undefined; |
| 238 | 238 | params.pageSize = undefined; |
| 239 | 239 | // 执行导出 |
| 240 | - this.$modal.confirm('是否确认导出所有规格名称数据项?').then(() => { | |
| 240 | + this.$modal.confirm('是否确认导出所有名称数据项?').then(() => { | |
| 241 | 241 | this.exportLoading = true; |
| 242 | 242 | return exportPropertyExcel(params); |
| 243 | 243 | }).then(response => { |
| 244 | - this.$download.excel(response, '规格名称.xls'); | |
| 244 | + this.$download.excel(response, '名称.xls'); | |
| 245 | 245 | this.exportLoading = false; |
| 246 | 246 | }).catch(() => {}); |
| 247 | 247 | }, | ... | ... |
yudao-ui-admin/src/views/mall/product/property/value.vue
| 1 | 1 | <template> |
| 2 | 2 | <div class="app-container"> |
| 3 | 3 | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| 4 | - <el-form-item label="规格名称" prop="propertyId"> | |
| 4 | + <el-form-item label="属性项" prop="propertyId"> | |
| 5 | 5 | <el-select v-model="queryParams.propertyId"> |
| 6 | 6 | <el-option v-for="item in propertyOptions" :key="item.id" :label="item.id +'-'+ item.name" :value="item.id"/> |
| 7 | 7 | </el-select> |
| 8 | 8 | </el-form-item> |
| 9 | - <el-form-item label="规格值" prop="name"> | |
| 10 | - <el-input v-model="queryParams.name" placeholder="请输入规格值" clearable @keyup.enter.native="handleQuery"/> | |
| 9 | + <el-form-item label="名称" prop="name"> | |
| 10 | + <el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/> | |
| 11 | 11 | </el-form-item> |
| 12 | 12 | <el-form-item label="状态" prop="status"> |
| 13 | 13 | <el-select v-model="queryParams.status" placeholder="状态" clearable size="small"> |
| ... | ... | @@ -35,8 +35,8 @@ |
| 35 | 35 | </el-row> |
| 36 | 36 | |
| 37 | 37 | <el-table v-loading="loading" :data="dataList"> |
| 38 | - <el-table-column label="规格值id" align="center" prop="id"/> | |
| 39 | - <el-table-column label="规格值" align="center" prop="name"/> | |
| 38 | + <el-table-column label="编号" align="center" prop="id"/> | |
| 39 | + <el-table-column label="名称" align="center" prop="name"/> | |
| 40 | 40 | <el-table-column label="状态" align="center" prop="status"> |
| 41 | 41 | <template slot-scope="scope"> |
| 42 | 42 | <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/> |
| ... | ... | @@ -66,11 +66,11 @@ |
| 66 | 66 | <!-- 添加或修改参数配置对话框 --> |
| 67 | 67 | <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
| 68 | 68 | <el-form ref="form" :model="form" :rules="rules" label-width="90px"> |
| 69 | - <el-form-item label="规格值编码"> | |
| 69 | + <el-form-item label="属性项"> | |
| 70 | 70 | <el-input v-model="form.propertyId" :disabled="true"/> |
| 71 | 71 | </el-form-item> |
| 72 | - <el-form-item label="规格值" prop="name"> | |
| 73 | - <el-input v-model="form.name" placeholder="请输入数据标签"/> | |
| 72 | + <el-form-item label="名称" prop="name"> | |
| 73 | + <el-input v-model="form.name" placeholder="请输入名称"/> | |
| 74 | 74 | </el-form-item> |
| 75 | 75 | <el-form-item label="状态" prop="status"> |
| 76 | 76 | <el-radio-group v-model="form.status"> |
| ... | ... | @@ -137,7 +137,7 @@ export default { |
| 137 | 137 | // 表单校验 |
| 138 | 138 | rules: { |
| 139 | 139 | name: [ |
| 140 | - {required: true, message: "规格值不能为空", trigger: "blur"} | |
| 140 | + {required: true, message: "名称不能为空", trigger: "blur"} | |
| 141 | 141 | ], |
| 142 | 142 | status: [ |
| 143 | 143 | {required: true, message: "状态不能为空", trigger: "blur"} |
| ... | ... | @@ -206,7 +206,7 @@ export default { |
| 206 | 206 | handleAdd() { |
| 207 | 207 | this.reset(); |
| 208 | 208 | this.open = true; |
| 209 | - this.title = "添加规格值"; | |
| 209 | + this.title = "添加属性值"; | |
| 210 | 210 | this.form.propertyId = this.queryParams.propertyId; |
| 211 | 211 | }, |
| 212 | 212 | /** 修改按钮操作 */ |
| ... | ... | @@ -216,7 +216,7 @@ export default { |
| 216 | 216 | getPropertyValue(id).then(response => { |
| 217 | 217 | this.form = response.data; |
| 218 | 218 | this.open = true; |
| 219 | - this.title = "修改规格值"; | |
| 219 | + this.title = "修改属性值"; | |
| 220 | 220 | }); |
| 221 | 221 | }, |
| 222 | 222 | /** 提交按钮 */ | ... | ... |