Commit fac3e7c72663480e3c61e3bdf38c1c445ec33784

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