Commit 72019f727e68efc9c393b53931942c5e1c44a26b

Authored by YunaiV
2 parents bb26bc40 493b1395

Merge remote-tracking branch 'origin/feature/1.8.0-uniapp' into feature/1.8.0-uniapp

Showing 31 changed files with 383 additions and 506 deletions
sql/mall.sql
... ... @@ -171,7 +171,7 @@ VALUES ('商品导出', 'product:spu:export', 3, 5, @parentId, '', '', '', 0);
171 171 drop table if exists product_property;
172 172 create table product_property
173 173 (
174   - id bigint comment '主键',
  174 + id bigint NOT NULL AUTO_INCREMENT comment '主键',
175 175 name varchar(64) comment '规格名称',
176 176 status tinyint comment '状态: 0 开启 ,1 禁用',
177 177 create_time datetime default current_timestamp comment '创建时间',
... ... @@ -179,7 +179,7 @@ create table product_property
179 179 creator varchar(64) comment '创建人',
180 180 updater varchar(64) comment '更新人',
181 181 tenant_id bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
182   - deleted bit(1) comment '状态',
  182 + deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
183 183 primary key (id),
184 184 key idx_name ( name (32)) comment '规格名称索引'
185 185 ) comment '规格名称' character set utf8mb4
... ... @@ -189,7 +189,7 @@ create table product_property
189 189 drop table if exists product_property_value;
190 190 create table product_property_value
191 191 (
192   - id int comment '主键',
  192 + id bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
193 193 property_id bigint comment '规格键id',
194 194 name varchar(128) comment '规格值名字',
195 195 status tinyint comment '状态: 1 开启 ,2 禁用',
... ... @@ -198,7 +198,7 @@ create table product_property_value
198 198 creator varchar(64) comment '创建人',
199 199 updater varchar(64) comment '更新人',
200 200 tenant_id bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
201   - deleted bit(1) comment '状态',
  201 + deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
202 202 primary key (id)
203 203 ) comment '规格值' character set utf8mb4
204 204 collate utf8mb4_general_ci;
... ... @@ -207,7 +207,7 @@ create table product_property_value
207 207 drop table if exists product_spu;
208 208 create table product_spu
209 209 (
210   - id int comment '主键',
  210 + id bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
211 211 name varchar(128) comment '商品名称',
212 212 sell_point varchar(128) not null comment '卖点',
213 213 description text not null comment '描述',
... ... @@ -223,7 +223,7 @@ create table product_spu
223 223 creator varchar(64) comment '创建人',
224 224 updater varchar(64) comment '更新人',
225 225 tenant_id bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
226   - deleted bit(1) comment '状态',
  226 + deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
227 227 primary key (id)
228 228 ) comment '商品spu' character set utf8mb4
229 229 collate utf8mb4_general_ci;
... ... @@ -233,7 +233,7 @@ create table product_spu
233 233 drop table if exists product_sku;
234 234 create table product_sku
235 235 (
236   - id int comment '主键',
  236 + id bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
237 237 spu_id bigint not null comment 'spu编号',
238 238 properties varchar(64) not null comment '规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]',
239 239 price int not null DEFAULT -1 comment '销售价格,单位:分',
... ... @@ -247,7 +247,7 @@ create table product_sku
247 247 creator varchar(64) comment '创建人',
248 248 updater varchar(64) comment '更新人',
249 249 tenant_id bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
250   - deleted bit(1) comment '状态',
  250 + deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
251 251 primary key (id)
252 252 ) comment '商品sku' character set utf8mb4
253 253 collate utf8mb4_general_ci;
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/PropertyController.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java 100755 → 100644
1 1 package cn.iocoder.yudao.module.product.controller.admin.property;
2 2  
  3 +import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
3 4 import org.springframework.web.bind.annotation.*;
4 5 import javax.annotation.Resource;
5 6 import org.springframework.validation.annotation.Validated;
6 7 import org.springframework.security.access.prepost.PreAuthorize;
7 8 import io.swagger.annotations.*;
8 9  
9   -import javax.validation.constraints.*;
10 10 import javax.validation.*;
11 11 import javax.servlet.http.*;
12 12 import java.util.*;
... ... @@ -22,31 +22,30 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
22 22 import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
23 23  
24 24 import cn.iocoder.yudao.module.product.controller.admin.property.vo.*;
25   -import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO;
26   -import cn.iocoder.yudao.module.product.convert.property.PropertyConvert;
27   -import cn.iocoder.yudao.module.product.service.property.PropertyService;
  25 +import cn.iocoder.yudao.module.product.convert.property.ProductPropertyConvert;
  26 +import cn.iocoder.yudao.module.product.service.property.ProductPropertyService;
28 27  
29 28 @Api(tags = "管理后台 - 规格名称")
30 29 @RestController
31 30 @RequestMapping("/product/property")
32 31 @Validated
33   -public class PropertyController {
  32 +public class ProductPropertyController {
34 33  
35 34 @Resource
36   - private PropertyService propertyService;
  35 + private ProductPropertyService productPropertyService;
37 36  
38 37 @PostMapping("/create")
39 38 @ApiOperation("创建规格名称")
40 39 @PreAuthorize("@ss.hasPermission('product:property:create')")
41   - public CommonResult<Long> createProperty(@Valid @RequestBody PropertyCreateReqVO createReqVO) {
42   - return success(propertyService.createProperty(createReqVO));
  40 + public CommonResult<Long> createProperty(@Valid @RequestBody ProductPropertyCreateReqVO createReqVO) {
  41 + return success(productPropertyService.createProperty(createReqVO));
43 42 }
44 43  
45 44 @PutMapping("/update")
46 45 @ApiOperation("更新规格名称")
47 46 @PreAuthorize("@ss.hasPermission('product:property:update')")
48   - public CommonResult<Boolean> updateProperty(@Valid @RequestBody PropertyUpdateReqVO updateReqVO) {
49   - propertyService.updateProperty(updateReqVO);
  47 + public CommonResult<Boolean> updateProperty(@Valid @RequestBody ProductPropertyUpdateReqVO updateReqVO) {
  48 + productPropertyService.updateProperty(updateReqVO);
50 49 return success(true);
51 50 }
52 51  
... ... @@ -55,7 +54,7 @@ public class PropertyController {
55 54 @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
56 55 @PreAuthorize("@ss.hasPermission('product:property:delete')")
57 56 public CommonResult<Boolean> deleteProperty(@RequestParam("id") Long id) {
58   - propertyService.deleteProperty(id);
  57 + productPropertyService.deleteProperty(id);
59 58 return success(true);
60 59 }
61 60  
... ... @@ -63,38 +62,36 @@ public class PropertyController {
63 62 @ApiOperation("获得规格名称")
64 63 @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
65 64 @PreAuthorize("@ss.hasPermission('product:property:query')")
66   - public CommonResult<PropertyRespVO> getProperty(@RequestParam("id") Long id) {
67   - PropertyDO property = propertyService.getProperty(id);
68   - return success(PropertyConvert.INSTANCE.convert(property));
  65 + public CommonResult<ProductPropertyRespVO> getProperty(@RequestParam("id") Long id) {
  66 + return success(productPropertyService.getPropertyResp(id));
69 67 }
70 68  
71 69 @GetMapping("/list")
72 70 @ApiOperation("获得规格名称列表")
73 71 @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
74 72 @PreAuthorize("@ss.hasPermission('product:property:query')")
75   - public CommonResult<List<PropertyRespVO>> getPropertyList(@RequestParam("ids") Collection<Long> ids) {
76   - List<PropertyDO> list = propertyService.getPropertyList(ids);
77   - return success(PropertyConvert.INSTANCE.convertList(list));
  73 + public CommonResult<List<ProductPropertyRespVO>> getPropertyList(@RequestParam("ids") Collection<Long> ids) {
  74 + List<ProductPropertyDO> list = productPropertyService.getPropertyList(ids);
  75 + return success(ProductPropertyConvert.INSTANCE.convertList(list));
78 76 }
79 77  
80 78 @GetMapping("/page")
81 79 @ApiOperation("获得规格名称分页")
82 80 @PreAuthorize("@ss.hasPermission('product:property:query')")
83   - public CommonResult<PageResult<PropertyRespVO>> getPropertyPage(@Valid PropertyPageReqVO pageVO) {
84   - PageResult<PropertyDO> pageResult = propertyService.getPropertyPage(pageVO);
85   - return success(PropertyConvert.INSTANCE.convertPage(pageResult));
  81 + public CommonResult<PageResult<ProductPropertyRespVO>> getPropertyPage(@Valid ProductPropertyPageReqVO pageVO) {
  82 + return success(productPropertyService.getPropertyListPage(pageVO));
86 83 }
87 84  
88 85 @GetMapping("/export-excel")
89 86 @ApiOperation("导出规格名称 Excel")
90 87 @PreAuthorize("@ss.hasPermission('product:property:export')")
91 88 @OperateLog(type = EXPORT)
92   - public void exportPropertyExcel(@Valid PropertyExportReqVO exportReqVO,
  89 + public void exportPropertyExcel(@Valid ProductPropertyExportReqVO exportReqVO,
93 90 HttpServletResponse response) throws IOException {
94   - List<PropertyDO> list = propertyService.getPropertyList(exportReqVO);
  91 + List<ProductPropertyDO> list = productPropertyService.getPropertyList(exportReqVO);
95 92 // 导出 Excel
96   - List<PropertyExcelVO> datas = PropertyConvert.INSTANCE.convertList02(list);
97   - ExcelUtils.write(response, "规格名称.xls", "数据", PropertyExcelVO.class, datas);
  93 + List<ProductPropertyExcelVO> datas = ProductPropertyConvert.INSTANCE.convertList02(list);
  94 + ExcelUtils.write(response, "规格名称.xls", "数据", ProductPropertyExcelVO.class, datas);
98 95 }
99 96  
100 97 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyBaseVO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyBaseVO.java 100755 → 100644
... ... @@ -10,7 +10,7 @@ import javax.validation.constraints.*;
10 10 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
11 11 */
12 12 @Data
13   -public class PropertyBaseVO {
  13 +public class ProductPropertyBaseVO {
14 14  
15 15 @ApiModelProperty(value = "规格名称")
16 16 private String name;
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyCreateReqVO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyCreateReqVO.java 100755 → 100644
1 1 package cn.iocoder.yudao.module.product.controller.admin.property.vo;
2 2  
  3 +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.ProductPropertyValueCreateReqVO;
3 4 import lombok.*;
4   -import java.util.*;
5 5 import io.swagger.annotations.*;
6   -import javax.validation.constraints.*;
  6 +
  7 +import javax.validation.constraints.NotNull;
  8 +import java.util.List;
7 9  
8 10 @ApiModel("管理后台 - 规格名称创建 Request VO")
9 11 @Data
10 12 @EqualsAndHashCode(callSuper = true)
11 13 @ToString(callSuper = true)
12   -public class PropertyCreateReqVO extends PropertyBaseVO {
  14 +public class ProductPropertyCreateReqVO extends ProductPropertyBaseVO {
  15 +
  16 + @ApiModelProperty(value = "属性值")
  17 + @NotNull(message = "属性值不能为空")
  18 + List<ProductPropertyValueCreateReqVO> propertyValueList;
13 19  
14 20 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyExcelVO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyExcelVO.java 100755 → 100644
... ... @@ -12,7 +12,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
12 12 * @author 芋道源码
13 13 */
14 14 @Data
15   -public class PropertyExcelVO {
  15 +public class ProductPropertyExcelVO {
16 16  
17 17 @ExcelProperty("主键")
18 18 private Long id;
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyExportReqVO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyExportReqVO.java 100755 → 100644
... ... @@ -10,7 +10,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
10 10  
11 11 @ApiModel(value = "管理后台 - 规格名称 Excel 导出 Request VO", description = "参数和 PropertyPageReqVO 是一致的")
12 12 @Data
13   -public class PropertyExportReqVO {
  13 +public class ProductPropertyExportReqVO {
14 14  
15 15 @ApiModelProperty(value = "规格名称")
16 16 private String name;
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyPageReqVO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyPageReqVO.java 100755 → 100644
... ... @@ -12,7 +12,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
12 12 @Data
13 13 @EqualsAndHashCode(callSuper = true)
14 14 @ToString(callSuper = true)
15   -public class PropertyPageReqVO extends PageParam {
  15 +public class ProductPropertyPageReqVO extends PageParam {
16 16  
17 17 @ApiModelProperty(value = "规格名称")
18 18 private String name;
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyRespVO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyRespVO.java 100755 → 100644
1 1 package cn.iocoder.yudao.module.product.controller.admin.property.vo;
2 2  
  3 +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.ProductPropertyValueRespVO;
3 4 import lombok.*;
4 5 import java.util.*;
5 6 import io.swagger.annotations.*;
... ... @@ -8,7 +9,7 @@ import io.swagger.annotations.*;
8 9 @Data
9 10 @EqualsAndHashCode(callSuper = true)
10 11 @ToString(callSuper = true)
11   -public class PropertyRespVO extends PropertyBaseVO {
  12 +public class ProductPropertyRespVO extends ProductPropertyBaseVO {
12 13  
13 14 @ApiModelProperty(value = "主键", required = true)
14 15 private Long id;
... ... @@ -16,4 +17,7 @@ public class PropertyRespVO extends PropertyBaseVO {
16 17 @ApiModelProperty(value = "创建时间")
17 18 private Date createTime;
18 19  
  20 + @ApiModelProperty(value = "属性值")
  21 + private List<ProductPropertyValueRespVO> propertyValueList;
  22 +
19 23 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyUpdateReqVO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyUpdateReqVO.java 100755 → 100644
1 1 package cn.iocoder.yudao.module.product.controller.admin.property.vo;
2 2  
  3 +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.ProductPropertyValueCreateReqVO;
3 4 import lombok.*;
4   -import java.util.*;
5 5 import io.swagger.annotations.*;
6 6 import javax.validation.constraints.*;
  7 +import java.util.List;
7 8  
8 9 @ApiModel("管理后台 - 规格名称更新 Request VO")
9 10 @Data
10 11 @EqualsAndHashCode(callSuper = true)
11 12 @ToString(callSuper = true)
12   -public class PropertyUpdateReqVO extends PropertyBaseVO {
  13 +public class ProductPropertyUpdateReqVO extends ProductPropertyBaseVO {
13 14  
14 15 @ApiModelProperty(value = "主键", required = true)
15 16 @NotNull(message = "主键不能为空")
16 17 private Long id;
17 18  
  19 + @ApiModelProperty(value = "属性值")
  20 + @NotNull(message = "属性值不能为空")
  21 + List<ProductPropertyValueCreateReqVO> propertyValueList;
  22 +
18 23 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/PropertyValueController.java deleted
1   -package cn.iocoder.yudao.module.product.controller.admin.propertyvalue;
2   -
3   -import org.springframework.web.bind.annotation.*;
4   -import javax.annotation.Resource;
5   -import org.springframework.validation.annotation.Validated;
6   -import org.springframework.security.access.prepost.PreAuthorize;
7   -import io.swagger.annotations.*;
8   -
9   -import javax.validation.constraints.*;
10   -import javax.validation.*;
11   -import javax.servlet.http.*;
12   -import java.util.*;
13   -import java.io.IOException;
14   -
15   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
16   -import cn.iocoder.yudao.framework.common.pojo.CommonResult;
17   -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
18   -
19   -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
20   -
21   -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
22   -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
23   -
24   -import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*;
25   -import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValueDO;
26   -import cn.iocoder.yudao.module.product.convert.propertyvalue.PropertyValueConvert;
27   -import cn.iocoder.yudao.module.product.service.propertyvalue.PropertyValueService;
28   -
29   -@Api(tags = "管理后台 - 规格值")
30   -@RestController
31   -@RequestMapping("/product/property-value")
32   -@Validated
33   -public class PropertyValueController {
34   -
35   - @Resource
36   - private PropertyValueService propertyValueService;
37   -
38   - @PostMapping("/create")
39   - @ApiOperation("创建规格值")
40   - @PreAuthorize("@ss.hasPermission('product:property-value:create')")
41   - public CommonResult<Integer> createPropertyValue(@Valid @RequestBody PropertyValueCreateReqVO createReqVO) {
42   - return success(propertyValueService.createPropertyValue(createReqVO));
43   - }
44   -
45   - @PutMapping("/update")
46   - @ApiOperation("更新规格值")
47   - @PreAuthorize("@ss.hasPermission('product:property-value:update')")
48   - public CommonResult<Boolean> updatePropertyValue(@Valid @RequestBody PropertyValueUpdateReqVO updateReqVO) {
49   - propertyValueService.updatePropertyValue(updateReqVO);
50   - return success(true);
51   - }
52   -
53   - @DeleteMapping("/delete")
54   - @ApiOperation("删除规格值")
55   - @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Integer.class)
56   - @PreAuthorize("@ss.hasPermission('product:property-value:delete')")
57   - public CommonResult<Boolean> deletePropertyValue(@RequestParam("id") Integer id) {
58   - propertyValueService.deletePropertyValue(id);
59   - return success(true);
60   - }
61   -
62   - @GetMapping("/get")
63   - @ApiOperation("获得规格值")
64   - @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class)
65   - @PreAuthorize("@ss.hasPermission('product:property-value:query')")
66   - public CommonResult<PropertyValueRespVO> getPropertyValue(@RequestParam("id") Integer id) {
67   - PropertyValueDO propertyValue = propertyValueService.getPropertyValue(id);
68   - return success(PropertyValueConvert.INSTANCE.convert(propertyValue));
69   - }
70   -
71   - @GetMapping("/list")
72   - @ApiOperation("获得规格值列表")
73   - @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
74   - @PreAuthorize("@ss.hasPermission('product:property-value:query')")
75   - public CommonResult<List<PropertyValueRespVO>> getPropertyValueList(@RequestParam("ids") Collection<Integer> ids) {
76   - List<PropertyValueDO> list = propertyValueService.getPropertyValueList(ids);
77   - return success(PropertyValueConvert.INSTANCE.convertList(list));
78   - }
79   -
80   - @GetMapping("/page")
81   - @ApiOperation("获得规格值分页")
82   - @PreAuthorize("@ss.hasPermission('product:property-value:query')")
83   - public CommonResult<PageResult<PropertyValueRespVO>> getPropertyValuePage(@Valid PropertyValuePageReqVO pageVO) {
84   - PageResult<PropertyValueDO> pageResult = propertyValueService.getPropertyValuePage(pageVO);
85   - return success(PropertyValueConvert.INSTANCE.convertPage(pageResult));
86   - }
87   -
88   - @GetMapping("/export-excel")
89   - @ApiOperation("导出规格值 Excel")
90   - @PreAuthorize("@ss.hasPermission('product:property-value:export')")
91   - @OperateLog(type = EXPORT)
92   - public void exportPropertyValueExcel(@Valid PropertyValueExportReqVO exportReqVO,
93   - HttpServletResponse response) throws IOException {
94   - List<PropertyValueDO> list = propertyValueService.getPropertyValueList(exportReqVO);
95   - // 导出 Excel
96   - List<PropertyValueExcelVO> datas = PropertyValueConvert.INSTANCE.convertList02(list);
97   - ExcelUtils.write(response, "规格值.xls", "数据", PropertyValueExcelVO.class, datas);
98   - }
99   -
100   -}
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueBaseVO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueBaseVO.java 100755 → 100644
... ... @@ -10,7 +10,7 @@ import javax.validation.constraints.*;
10 10 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
11 11 */
12 12 @Data
13   -public class PropertyValueBaseVO {
  13 +public class ProductPropertyValueBaseVO {
14 14  
15 15 @ApiModelProperty(value = "规格键id")
16 16 private Long propertyId;
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueCreateReqVO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueCreateReqVO.java 100755 → 100644
1 1 package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo;
2 2  
3 3 import lombok.*;
4   -import java.util.*;
5 4 import io.swagger.annotations.*;
6   -import javax.validation.constraints.*;
7 5  
8 6 @ApiModel("管理后台 - 规格值创建 Request VO")
9 7 @Data
10 8 @EqualsAndHashCode(callSuper = true)
11 9 @ToString(callSuper = true)
12   -public class PropertyValueCreateReqVO extends PropertyValueBaseVO {
  10 +public class ProductPropertyValueCreateReqVO extends ProductPropertyValueBaseVO {
13 11  
14 12 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueRespVO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueRespVO.java 100755 → 100644
... ... @@ -8,7 +8,7 @@ import io.swagger.annotations.*;
8 8 @Data
9 9 @EqualsAndHashCode(callSuper = true)
10 10 @ToString(callSuper = true)
11   -public class PropertyValueRespVO extends PropertyValueBaseVO {
  11 +public class ProductPropertyValueRespVO extends ProductPropertyValueBaseVO {
12 12  
13 13 @ApiModelProperty(value = "主键", required = true)
14 14 private Integer id;
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueUpdateReqVO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueUpdateReqVO.java 100755 → 100644
1 1 package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo;
2 2  
3 3 import lombok.*;
4   -import java.util.*;
5 4 import io.swagger.annotations.*;
6 5 import javax.validation.constraints.*;
7 6  
... ... @@ -9,7 +8,7 @@ import javax.validation.constraints.*;
9 8 @Data
10 9 @EqualsAndHashCode(callSuper = true)
11 10 @ToString(callSuper = true)
12   -public class PropertyValueUpdateReqVO extends PropertyValueBaseVO {
  11 +public class ProductPropertyValueUpdateReqVO extends ProductPropertyValueBaseVO {
13 12  
14 13 @ApiModelProperty(value = "主键", required = true)
15 14 @NotNull(message = "主键不能为空")
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueExcelVO.java deleted
1   -package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo;
2   -
3   -import lombok.*;
4   -import java.util.*;
5   -import io.swagger.annotations.*;
6   -
7   -import com.alibaba.excel.annotation.ExcelProperty;
8   -
9   -/**
10   - * 规格值 Excel VO
11   - *
12   - * @author 芋道源码
13   - */
14   -@Data
15   -public class PropertyValueExcelVO {
16   -
17   - @ExcelProperty("主键")
18   - private Integer id;
19   -
20   - @ExcelProperty("规格键id")
21   - private Long propertyId;
22   -
23   - @ExcelProperty("规格值名字")
24   - private String name;
25   -
26   - @ExcelProperty("状态: 1 开启 ,2 禁用")
27   - private Integer status;
28   -
29   - @ExcelProperty("创建时间")
30   - private Date createTime;
31   -
32   -}
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueExportReqVO.java deleted
1   -package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo;
2   -
3   -import lombok.*;
4   -import java.util.*;
5   -import io.swagger.annotations.*;
6   -import cn.iocoder.yudao.framework.common.pojo.PageParam;
7   -import org.springframework.format.annotation.DateTimeFormat;
8   -
9   -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
10   -
11   -@ApiModel(value = "管理后台 - 规格值 Excel 导出 Request VO", description = "参数和 PropertyValuePageReqVO 是一致的")
12   -@Data
13   -public class PropertyValueExportReqVO {
14   -
15   - @ApiModelProperty(value = "规格键id")
16   - private Long propertyId;
17   -
18   - @ApiModelProperty(value = "规格值名字")
19   - private String name;
20   -
21   - @ApiModelProperty(value = "状态: 1 开启 ,2 禁用")
22   - private Integer status;
23   -
24   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
25   - @ApiModelProperty(value = "开始创建时间")
26   - private Date beginCreateTime;
27   -
28   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
29   - @ApiModelProperty(value = "结束创建时间")
30   - private Date endCreateTime;
31   -
32   -}
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValuePageReqVO.java deleted
1   -package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo;
2   -
3   -import lombok.*;
4   -import java.util.*;
5   -import io.swagger.annotations.*;
6   -import cn.iocoder.yudao.framework.common.pojo.PageParam;
7   -import org.springframework.format.annotation.DateTimeFormat;
8   -
9   -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
10   -
11   -@ApiModel("管理后台 - 规格值分页 Request VO")
12   -@Data
13   -@EqualsAndHashCode(callSuper = true)
14   -@ToString(callSuper = true)
15   -public class PropertyValuePageReqVO extends PageParam {
16   -
17   - @ApiModelProperty(value = "规格键id")
18   - private Long propertyId;
19   -
20   - @ApiModelProperty(value = "规格值名字")
21   - private String name;
22   -
23   - @ApiModelProperty(value = "状态: 1 开启 ,2 禁用")
24   - private Integer status;
25   -
26   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
27   - @ApiModelProperty(value = "开始创建时间")
28   - private Date beginCreateTime;
29   -
30   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
31   - @ApiModelProperty(value = "结束创建时间")
32   - private Date endCreateTime;
33   -
34   -}
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/PropertyConvert.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/ProductPropertyConvert.java 100755 → 100644
... ... @@ -4,10 +4,10 @@ import java.util.*;
4 4  
5 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6 6  
  7 +import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
7 8 import org.mapstruct.Mapper;
8 9 import org.mapstruct.factory.Mappers;
9 10 import cn.iocoder.yudao.module.product.controller.admin.property.vo.*;
10   -import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO;
11 11  
12 12 /**
13 13 * 规格名称 Convert
... ... @@ -15,20 +15,20 @@ import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO;
15 15 * @author 芋道源码
16 16 */
17 17 @Mapper
18   -public interface PropertyConvert {
  18 +public interface ProductPropertyConvert {
19 19  
20   - PropertyConvert INSTANCE = Mappers.getMapper(PropertyConvert.class);
  20 + ProductPropertyConvert INSTANCE = Mappers.getMapper(ProductPropertyConvert.class);
21 21  
22   - PropertyDO convert(PropertyCreateReqVO bean);
  22 + ProductPropertyDO convert(ProductPropertyCreateReqVO bean);
23 23  
24   - PropertyDO convert(PropertyUpdateReqVO bean);
  24 + ProductPropertyDO convert(ProductPropertyUpdateReqVO bean);
25 25  
26   - PropertyRespVO convert(PropertyDO bean);
  26 + ProductPropertyRespVO convert(ProductPropertyDO bean);
27 27  
28   - List<PropertyRespVO> convertList(List<PropertyDO> list);
  28 + List<ProductPropertyRespVO> convertList(List<ProductPropertyDO> list);
29 29  
30   - PageResult<PropertyRespVO> convertPage(PageResult<PropertyDO> page);
  30 + PageResult<ProductPropertyRespVO> convertPage(PageResult<ProductPropertyDO> page);
31 31  
32   - List<PropertyExcelVO> convertList02(List<PropertyDO> list);
  32 + List<ProductPropertyExcelVO> convertList02(List<ProductPropertyDO> list);
33 33  
34 34 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/PropertyValueConvert.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/ProductPropertyValueConvert.java 100755 → 100644
... ... @@ -4,10 +4,10 @@ import java.util.*;
4 4  
5 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6 6  
  7 +import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.ProductPropertyValueDO;
7 8 import org.mapstruct.Mapper;
8 9 import org.mapstruct.factory.Mappers;
9 10 import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*;
10   -import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValueDO;
11 11  
12 12 /**
13 13 * 规格值 Convert
... ... @@ -15,20 +15,20 @@ import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValu
15 15 * @author 芋道源码
16 16 */
17 17 @Mapper
18   -public interface PropertyValueConvert {
  18 +public interface ProductPropertyValueConvert {
19 19  
20   - PropertyValueConvert INSTANCE = Mappers.getMapper(PropertyValueConvert.class);
  20 + ProductPropertyValueConvert INSTANCE = Mappers.getMapper(ProductPropertyValueConvert.class);
21 21  
22   - PropertyValueDO convert(PropertyValueCreateReqVO bean);
  22 + ProductPropertyValueDO convert(ProductPropertyValueCreateReqVO bean);
23 23  
24   - PropertyValueDO convert(PropertyValueUpdateReqVO bean);
  24 + ProductPropertyValueDO convert(ProductPropertyValueUpdateReqVO bean);
25 25  
26   - PropertyValueRespVO convert(PropertyValueDO bean);
  26 + ProductPropertyValueRespVO convert(ProductPropertyValueDO bean);
27 27  
28   - List<PropertyValueRespVO> convertList(List<PropertyValueDO> list);
  28 + List<ProductPropertyValueRespVO> convertList(List<ProductPropertyValueDO> list);
29 29  
30   - PageResult<PropertyValueRespVO> convertPage(PageResult<PropertyValueDO> page);
  30 + PageResult<ProductPropertyValueRespVO> convertPage(PageResult<ProductPropertyValueDO> page);
31 31  
32   - List<PropertyValueExcelVO> convertList02(List<PropertyValueDO> list);
  32 + List<ProductPropertyValueDO> convertList03(List<ProductPropertyValueCreateReqVO> list);
33 33  
34 34 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/PropertyDO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java 100755 → 100644
... ... @@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
7 7 import com.baomidou.mybatisplus.annotation.TableName;
8 8 import lombok.*;
9 9  
10   -// TODO @franky:每个表名,都加个 Product 前缀哈。
11 10 /**
12 11 * 规格名称 DO
13 12 *
... ... @@ -21,7 +20,7 @@ import lombok.*;
21 20 @Builder
22 21 @NoArgsConstructor
23 22 @AllArgsConstructor
24   -public class PropertyDO extends BaseDO {
  23 +public class ProductPropertyDO extends BaseDO {
25 24  
26 25 /**
27 26 * 主键
... ... @@ -35,7 +34,7 @@ public class PropertyDO extends BaseDO {
35 34 /**
36 35 * 状态: 0 开启 ,1 禁用
37 36 *
38   - * TODO @franky:加个 枚举 {@link CommonStatusEnum} ,这样就能更好的知道
  37 + * {@link CommonStatusEnum}
39 38 */
40 39 private Integer status;
41 40  
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/propertyvalue/PropertyValueDO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/propertyvalue/ProductPropertyValueDO.java 100755 → 100644
1 1 package cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue;
2 2  
3 3 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
4   -import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO;
  4 +import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
5 5 import com.baomidou.mybatisplus.annotation.KeySequence;
6 6 import com.baomidou.mybatisplus.annotation.TableId;
7 7 import com.baomidou.mybatisplus.annotation.TableName;
... ... @@ -21,7 +21,7 @@ import lombok.*;
21 21 @Builder
22 22 @NoArgsConstructor
23 23 @AllArgsConstructor
24   -public class PropertyValueDO extends BaseDO {
  24 +public class ProductPropertyValueDO extends BaseDO {
25 25  
26 26 /**
27 27 * 主键
... ... @@ -31,7 +31,7 @@ public class PropertyValueDO extends BaseDO {
31 31 /**
32 32 * 规格键 id
33 33 *
34   - * TODO @franky:加个 关联 {@link PropertyDO#getId()} ,这样就能更好的知道
  34 + * TODO @franky:加个 关联 {@link ProductPropertyDO#getId()} ,这样就能更好的知道
35 35 */
36 36 private Long propertyId;
37 37 /**
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.product.dal.mysql.property;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  7 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  8 +import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
  9 +import org.apache.ibatis.annotations.Mapper;
  10 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.*;
  11 +
  12 +/**
  13 + * 规格名称 Mapper
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@Mapper
  18 +public interface ProductPropertyMapper extends BaseMapperX<ProductPropertyDO> {
  19 +
  20 + default PageResult<ProductPropertyDO> selectPage(ProductPropertyPageReqVO reqVO) {
  21 + return selectPage(reqVO, new LambdaQueryWrapperX<ProductPropertyDO>()
  22 + .likeIfPresent(ProductPropertyDO::getName, reqVO.getName())
  23 + .eqIfPresent(ProductPropertyDO::getStatus, reqVO.getStatus())
  24 + .betweenIfPresent(ProductPropertyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
  25 + .orderByDesc(ProductPropertyDO::getId));
  26 + }
  27 +
  28 + default List<ProductPropertyDO> selectList(ProductPropertyExportReqVO reqVO) {
  29 + return selectList(new LambdaQueryWrapperX<ProductPropertyDO>()
  30 + .likeIfPresent(ProductPropertyDO::getName, reqVO.getName())
  31 + .eqIfPresent(ProductPropertyDO::getStatus, reqVO.getStatus())
  32 + .betweenIfPresent(ProductPropertyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
  33 + .orderByDesc(ProductPropertyDO::getId));
  34 + }
  35 +
  36 +}
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/PropertyMapper.java deleted
1   -package cn.iocoder.yudao.module.product.dal.mysql.property;
2   -
3   -import java.util.*;
4   -
5   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
6   -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
7   -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
8   -import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO;
9   -import org.apache.ibatis.annotations.Mapper;
10   -import cn.iocoder.yudao.module.product.controller.admin.property.vo.*;
11   -
12   -/**
13   - * 规格名称 Mapper
14   - *
15   - * @author 芋道源码
16   - */
17   -@Mapper
18   -public interface PropertyMapper extends BaseMapperX<PropertyDO> {
19   -
20   - default PageResult<PropertyDO> selectPage(PropertyPageReqVO reqVO) {
21   - return selectPage(reqVO, new LambdaQueryWrapperX<PropertyDO>()
22   - .likeIfPresent(PropertyDO::getName, reqVO.getName())
23   - .eqIfPresent(PropertyDO::getStatus, reqVO.getStatus())
24   - .betweenIfPresent(PropertyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
25   - .orderByDesc(PropertyDO::getId));
26   - }
27   -
28   - default List<PropertyDO> selectList(PropertyExportReqVO reqVO) {
29   - return selectList(new LambdaQueryWrapperX<PropertyDO>()
30   - .likeIfPresent(PropertyDO::getName, reqVO.getName())
31   - .eqIfPresent(PropertyDO::getStatus, reqVO.getStatus())
32   - .betweenIfPresent(PropertyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
33   - .orderByDesc(PropertyDO::getId));
34   - }
35   -
36   -}
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/propertyvalue/ProductPropertyValueMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.product.dal.mysql.propertyvalue;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  6 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  7 +import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.ProductPropertyValueDO;
  8 +import org.apache.ibatis.annotations.Mapper;
  9 +
  10 +/**
  11 + * 规格值 Mapper
  12 + *
  13 + * @author 芋道源码
  14 + */
  15 +@Mapper
  16 +public interface ProductPropertyValueMapper extends BaseMapperX<ProductPropertyValueDO> {
  17 +
  18 + default List<ProductPropertyValueDO> getPropertyValueListByPropertyId(List<Long> propertyIds){
  19 + return selectList(new LambdaQueryWrapperX<ProductPropertyValueDO>()
  20 + .inIfPresent(ProductPropertyValueDO::getPropertyId, propertyIds));
  21 + }
  22 +
  23 + default void deletePropertyValueByPropertyId(Long propertyId){
  24 + LambdaQueryWrapperX<ProductPropertyValueDO> queryWrapperX = new LambdaQueryWrapperX<>();
  25 + queryWrapperX.eq(ProductPropertyValueDO::getPropertyId, propertyId)
  26 + .eq(ProductPropertyValueDO::getDeleted, false);
  27 + delete(queryWrapperX);
  28 + }
  29 +}
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/propertyvalue/PropertyValueMapper.java deleted
1   -package cn.iocoder.yudao.module.product.dal.mysql.propertyvalue;
2   -
3   -import java.util.*;
4   -
5   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
6   -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
7   -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
8   -import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValueDO;
9   -import org.apache.ibatis.annotations.Mapper;
10   -import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*;
11   -
12   -/**
13   - * 规格值 Mapper
14   - *
15   - * @author 芋道源码
16   - */
17   -@Mapper
18   -public interface PropertyValueMapper extends BaseMapperX<PropertyValueDO> {
19   -
20   - default PageResult<PropertyValueDO> selectPage(PropertyValuePageReqVO reqVO) {
21   - return selectPage(reqVO, new LambdaQueryWrapperX<PropertyValueDO>()
22   - .eqIfPresent(PropertyValueDO::getPropertyId, reqVO.getPropertyId())
23   - .likeIfPresent(PropertyValueDO::getName, reqVO.getName())
24   - .eqIfPresent(PropertyValueDO::getStatus, reqVO.getStatus())
25   - .betweenIfPresent(PropertyValueDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
26   - .orderByDesc(PropertyValueDO::getId));
27   - }
28   -
29   - default List<PropertyValueDO> selectList(PropertyValueExportReqVO reqVO) {
30   - return selectList(new LambdaQueryWrapperX<PropertyValueDO>()
31   - .eqIfPresent(PropertyValueDO::getPropertyId, reqVO.getPropertyId())
32   - .likeIfPresent(PropertyValueDO::getName, reqVO.getName())
33   - .eqIfPresent(PropertyValueDO::getStatus, reqVO.getStatus())
34   - .betweenIfPresent(PropertyValueDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
35   - .orderByDesc(PropertyValueDO::getId));
36   - }
37   -
38   -}
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/PropertyService.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyService.java 100755 → 100644
... ... @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.product.service.property;
3 3 import java.util.*;
4 4 import javax.validation.*;
5 5 import cn.iocoder.yudao.module.product.controller.admin.property.vo.*;
6   -import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO;
  6 +import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
7 7 import cn.iocoder.yudao.framework.common.pojo.PageResult;
8 8  
9 9 /**
... ... @@ -11,7 +11,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
11 11 *
12 12 * @author 芋道源码
13 13 */
14   -public interface PropertyService {
  14 +public interface ProductPropertyService {
15 15  
16 16 /**
17 17 * 创建规格名称
... ... @@ -19,14 +19,14 @@ public interface PropertyService {
19 19 * @param createReqVO 创建信息
20 20 * @return 编号
21 21 */
22   - Long createProperty(@Valid PropertyCreateReqVO createReqVO);
  22 + Long createProperty(@Valid ProductPropertyCreateReqVO createReqVO);
23 23  
24 24 /**
25 25 * 更新规格名称
26 26 *
27 27 * @param updateReqVO 更新信息
28 28 */
29   - void updateProperty(@Valid PropertyUpdateReqVO updateReqVO);
  29 + void updateProperty(@Valid ProductPropertyUpdateReqVO updateReqVO);
30 30  
31 31 /**
32 32 * 删除规格名称
... ... @@ -41,7 +41,7 @@ public interface PropertyService {
41 41 * @param id 编号
42 42 * @return 规格名称
43 43 */
44   - PropertyDO getProperty(Long id);
  44 + ProductPropertyDO getProperty(Long id);
45 45  
46 46 /**
47 47 * 获得规格名称列表
... ... @@ -49,7 +49,7 @@ public interface PropertyService {
49 49 * @param ids 编号
50 50 * @return 规格名称列表
51 51 */
52   - List<PropertyDO> getPropertyList(Collection<Long> ids);
  52 + List<ProductPropertyDO> getPropertyList(Collection<Long> ids);
53 53  
54 54 /**
55 55 * 获得规格名称分页
... ... @@ -57,7 +57,7 @@ public interface PropertyService {
57 57 * @param pageReqVO 分页查询
58 58 * @return 规格名称分页
59 59 */
60   - PageResult<PropertyDO> getPropertyPage(PropertyPageReqVO pageReqVO);
  60 + PageResult<ProductPropertyDO> getPropertyPage(ProductPropertyPageReqVO pageReqVO);
61 61  
62 62 /**
63 63 * 获得规格名称列表, 用于 Excel 导出
... ... @@ -65,6 +65,15 @@ public interface PropertyService {
65 65 * @param exportReqVO 查询条件
66 66 * @return 规格名称列表
67 67 */
68   - List<PropertyDO> getPropertyList(PropertyExportReqVO exportReqVO);
  68 + List<ProductPropertyDO> getPropertyList(ProductPropertyExportReqVO exportReqVO);
  69 +
  70 + /**
  71 + * 获取属性及属性值列表 分页
  72 + * @param pageReqVO
  73 + * @return
  74 + */
  75 + PageResult<ProductPropertyRespVO> getPropertyListPage(ProductPropertyPageReqVO pageReqVO);
  76 +
  77 + ProductPropertyRespVO getPropertyResp(Long id);
69 78  
70 79 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.product.service.property;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.*;
  5 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.ProductPropertyCreateReqVO;
  6 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.ProductPropertyUpdateReqVO;
  7 +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.ProductPropertyValueCreateReqVO;
  8 +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.ProductPropertyValueRespVO;
  9 +import cn.iocoder.yudao.module.product.convert.property.ProductPropertyConvert;
  10 +import cn.iocoder.yudao.module.product.convert.propertyvalue.ProductPropertyValueConvert;
  11 +import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
  12 +import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.ProductPropertyValueDO;
  13 +import cn.iocoder.yudao.module.product.dal.mysql.property.ProductPropertyMapper;
  14 +import cn.iocoder.yudao.module.product.service.propertyvalue.ProductPropertyValueService;
  15 +import org.springframework.stereotype.Service;
  16 +import org.springframework.transaction.annotation.Transactional;
  17 +import org.springframework.validation.annotation.Validated;
  18 +
  19 +import javax.annotation.Resource;
  20 +import java.util.Arrays;
  21 +import java.util.Collection;
  22 +import java.util.List;
  23 +import java.util.stream.Collectors;
  24 +
  25 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  26 +import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_NOT_EXISTS;
  27 +
  28 +/**
  29 + * 规格名称 Service 实现类
  30 + *
  31 + * @author 芋道源码
  32 + */
  33 +@Service
  34 +@Validated
  35 +public class ProductPropertyServiceImpl implements ProductPropertyService {
  36 +
  37 + @Resource
  38 + private ProductPropertyMapper productPropertyMapper;
  39 +
  40 + @Resource
  41 + private ProductPropertyValueService productPropertyValueService;
  42 +
  43 + @Override
  44 + @Transactional(rollbackFor = Exception.class)
  45 + public Long createProperty(ProductPropertyCreateReqVO createReqVO) {
  46 + // 插入
  47 + ProductPropertyDO property = ProductPropertyConvert.INSTANCE.convert(createReqVO);
  48 + productPropertyMapper.insert(property);
  49 +
  50 + //插入属性值
  51 + List<ProductPropertyValueCreateReqVO> propertyValueList = createReqVO.getPropertyValueList();
  52 + List<ProductPropertyValueDO> productPropertyValueDOList = ProductPropertyValueConvert.INSTANCE.convertList03(propertyValueList);
  53 + productPropertyValueDOList.stream().forEach(x-> x.setPropertyId(property.getId()));
  54 + productPropertyValueService.batchInsert(productPropertyValueDOList);
  55 + // 返回
  56 + return property.getId();
  57 + }
  58 +
  59 + @Override
  60 + @Transactional(rollbackFor = Exception.class)
  61 + public void updateProperty(ProductPropertyUpdateReqVO updateReqVO) {
  62 + // 校验存在
  63 + this.validatePropertyExists(updateReqVO.getId());
  64 + // 更新
  65 + ProductPropertyDO updateObj = ProductPropertyConvert.INSTANCE.convert(updateReqVO);
  66 + productPropertyMapper.updateById(updateObj);
  67 + //更新属性值,先删后加
  68 + productPropertyValueService.deletePropertyValueByPropertyId(updateReqVO.getId());
  69 + List<ProductPropertyValueCreateReqVO> propertyValueList = updateReqVO.getPropertyValueList();
  70 + List<ProductPropertyValueDO> productPropertyValueDOList = ProductPropertyValueConvert.INSTANCE.convertList03(propertyValueList);
  71 + productPropertyValueDOList.stream().forEach(x-> x.setPropertyId(updateReqVO.getId()));
  72 + productPropertyValueService.batchInsert(productPropertyValueDOList);
  73 + }
  74 +
  75 + @Override
  76 + public void deleteProperty(Long id) {
  77 + // 校验存在
  78 + this.validatePropertyExists(id);
  79 + // 删除
  80 + productPropertyMapper.deleteById(id);
  81 + //同步删除属性值
  82 + productPropertyValueService.deletePropertyValueByPropertyId(id);
  83 + }
  84 +
  85 + private void validatePropertyExists(Long id) {
  86 + if (productPropertyMapper.selectById(id) == null) {
  87 + throw exception(PROPERTY_NOT_EXISTS);
  88 + }
  89 + }
  90 +
  91 + @Override
  92 + public ProductPropertyDO getProperty(Long id) {
  93 + return productPropertyMapper.selectById(id);
  94 + }
  95 +
  96 + @Override
  97 + public List<ProductPropertyDO> getPropertyList(Collection<Long> ids) {
  98 + return productPropertyMapper.selectBatchIds(ids);
  99 + }
  100 +
  101 + @Override
  102 + public PageResult<ProductPropertyDO> getPropertyPage(ProductPropertyPageReqVO pageReqVO) {
  103 + return productPropertyMapper.selectPage(pageReqVO);
  104 + }
  105 +
  106 + @Override
  107 + public List<ProductPropertyDO> getPropertyList(ProductPropertyExportReqVO exportReqVO) {
  108 + return productPropertyMapper.selectList(exportReqVO);
  109 + }
  110 +
  111 + @Override
  112 + public PageResult<ProductPropertyRespVO> getPropertyListPage(ProductPropertyPageReqVO pageReqVO) {
  113 + //获取属性列表
  114 + PageResult<ProductPropertyDO> pageResult = productPropertyMapper.selectPage(pageReqVO);
  115 + PageResult<ProductPropertyRespVO> propertyRespVOPageResult = ProductPropertyConvert.INSTANCE.convertPage(pageResult);
  116 + List<Long> propertyIds = propertyRespVOPageResult.getList().stream().map(x -> x.getId()).collect(Collectors.toList());
  117 +
  118 + //获取属性值列表
  119 + List<ProductPropertyValueDO> productPropertyValueDOList = productPropertyValueService.getPropertyValueListByPropertyId(propertyIds);
  120 + List<ProductPropertyValueRespVO> propertyValueRespVOList = ProductPropertyValueConvert.INSTANCE.convertList(productPropertyValueDOList);
  121 + //组装一对多
  122 + propertyRespVOPageResult.getList().stream().forEach(x->{
  123 + Long propertyId = x.getId();
  124 + List<ProductPropertyValueRespVO> valueDOList = propertyValueRespVOList.stream().filter(v -> v.getPropertyId().equals(propertyId)).collect(Collectors.toList());
  125 + x.setPropertyValueList(valueDOList);
  126 + });
  127 + return propertyRespVOPageResult;
  128 + }
  129 +
  130 + @Override
  131 + public ProductPropertyRespVO getPropertyResp(Long id) {
  132 + //查询规格
  133 + ProductPropertyDO property = getProperty(id);
  134 + ProductPropertyRespVO propertyRespVO = ProductPropertyConvert.INSTANCE.convert(property);
  135 + //查询属性值
  136 + List<ProductPropertyValueDO> valueDOList = productPropertyValueService.getPropertyValueListByPropertyId(Arrays.asList(id));
  137 + List<ProductPropertyValueRespVO> propertyValueRespVOS = ProductPropertyValueConvert.INSTANCE.convertList(valueDOList);
  138 + //组装
  139 + propertyRespVO.setPropertyValueList(propertyValueRespVOS);
  140 + return propertyRespVO;
  141 + }
  142 +
  143 +}
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/PropertyServiceImpl.java deleted
1   -package cn.iocoder.yudao.module.product.service.property;
2   -
3   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
4   -import cn.iocoder.yudao.module.product.controller.admin.property.vo.PropertyCreateReqVO;
5   -import cn.iocoder.yudao.module.product.controller.admin.property.vo.PropertyExportReqVO;
6   -import cn.iocoder.yudao.module.product.controller.admin.property.vo.PropertyPageReqVO;
7   -import cn.iocoder.yudao.module.product.controller.admin.property.vo.PropertyUpdateReqVO;
8   -import cn.iocoder.yudao.module.product.convert.property.PropertyConvert;
9   -import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO;
10   -import cn.iocoder.yudao.module.product.dal.mysql.property.PropertyMapper;
11   -import org.springframework.stereotype.Service;
12   -import org.springframework.validation.annotation.Validated;
13   -
14   -import javax.annotation.Resource;
15   -import java.util.Collection;
16   -import java.util.List;
17   -
18   -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
19   -import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_NOT_EXISTS;
20   -
21   -/**
22   - * 规格名称 Service 实现类
23   - *
24   - * @author 芋道源码
25   - */
26   -@Service
27   -@Validated
28   -public class PropertyServiceImpl implements PropertyService {
29   -
30   - @Resource
31   - private PropertyMapper propertyMapper;
32   -
33   - @Override
34   - public Long createProperty(PropertyCreateReqVO createReqVO) {
35   - // 插入
36   - PropertyDO property = PropertyConvert.INSTANCE.convert(createReqVO);
37   - propertyMapper.insert(property);
38   - // 返回
39   - return property.getId();
40   - }
41   -
42   - @Override
43   - public void updateProperty(PropertyUpdateReqVO updateReqVO) {
44   - // 校验存在
45   - this.validatePropertyExists(updateReqVO.getId());
46   - // 更新
47   - PropertyDO updateObj = PropertyConvert.INSTANCE.convert(updateReqVO);
48   - propertyMapper.updateById(updateObj);
49   - }
50   -
51   - @Override
52   - public void deleteProperty(Long id) {
53   - // 校验存在
54   - this.validatePropertyExists(id);
55   - // 删除
56   - propertyMapper.deleteById(id);
57   - }
58   -
59   - private void validatePropertyExists(Long id) {
60   - if (propertyMapper.selectById(id) == null) {
61   - throw exception(PROPERTY_NOT_EXISTS);
62   - }
63   - }
64   -
65   - @Override
66   - public PropertyDO getProperty(Long id) {
67   - return propertyMapper.selectById(id);
68   - }
69   -
70   - @Override
71   - public List<PropertyDO> getPropertyList(Collection<Long> ids) {
72   - return propertyMapper.selectBatchIds(ids);
73   - }
74   -
75   - @Override
76   - public PageResult<PropertyDO> getPropertyPage(PropertyPageReqVO pageReqVO) {
77   - return propertyMapper.selectPage(pageReqVO);
78   - }
79   -
80   - @Override
81   - public List<PropertyDO> getPropertyList(PropertyExportReqVO exportReqVO) {
82   - return propertyMapper.selectList(exportReqVO);
83   - }
84   -
85   -}
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/PropertyValueServiceImpl.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/ProductProductPropertyValueServiceImpl.java 100755 → 100644
1 1 package cn.iocoder.yudao.module.product.service.propertyvalue;
2 2  
3   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
4   -import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.PropertyValueCreateReqVO;
5   -import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.PropertyValueExportReqVO;
6   -import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.PropertyValuePageReqVO;
7   -import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.PropertyValueUpdateReqVO;
8   -import cn.iocoder.yudao.module.product.convert.propertyvalue.PropertyValueConvert;
9   -import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValueDO;
10   -import cn.iocoder.yudao.module.product.dal.mysql.propertyvalue.PropertyValueMapper;
  3 +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*;
  4 +import cn.iocoder.yudao.module.product.convert.propertyvalue.ProductPropertyValueConvert;
  5 +import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.ProductPropertyValueDO;
  6 +import cn.iocoder.yudao.module.product.dal.mysql.propertyvalue.ProductPropertyValueMapper;
11 7 import org.springframework.stereotype.Service;
12 8 import org.springframework.validation.annotation.Validated;
13 9  
... ... @@ -25,29 +21,29 @@ import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_
25 21 */
26 22 @Service
27 23 @Validated
28   -public class PropertyValueServiceImpl implements PropertyValueService {
  24 +public class ProductProductPropertyValueServiceImpl implements ProductPropertyValueService {
29 25  
30 26 @Resource
31   - private PropertyValueMapper propertyValueMapper;
  27 + private ProductPropertyValueMapper productPropertyValueMapper;
32 28  
33 29 // TODO @franky:这个合并到 property 中。他们本身是在一起的哈。基本不存在只查询规格,而不查询规格值。
34 30  
35 31 @Override
36   - public Integer createPropertyValue(PropertyValueCreateReqVO createReqVO) {
  32 + public Integer createPropertyValue(ProductPropertyValueCreateReqVO createReqVO) {
37 33 // 插入
38   - PropertyValueDO propertyValue = PropertyValueConvert.INSTANCE.convert(createReqVO);
39   - propertyValueMapper.insert(propertyValue);
  34 + ProductPropertyValueDO propertyValue = ProductPropertyValueConvert.INSTANCE.convert(createReqVO);
  35 + productPropertyValueMapper.insert(propertyValue);
40 36 // 返回
41 37 return propertyValue.getId();
42 38 }
43 39  
44 40 @Override
45   - public void updatePropertyValue(PropertyValueUpdateReqVO updateReqVO) {
  41 + public void updatePropertyValue(ProductPropertyValueUpdateReqVO updateReqVO) {
46 42 // 校验存在
47 43 this.validatePropertyValueExists(updateReqVO.getId());
48 44 // 更新
49   - PropertyValueDO updateObj = PropertyValueConvert.INSTANCE.convert(updateReqVO);
50   - propertyValueMapper.updateById(updateObj);
  45 + ProductPropertyValueDO updateObj = ProductPropertyValueConvert.INSTANCE.convert(updateReqVO);
  46 + productPropertyValueMapper.updateById(updateObj);
51 47 }
52 48  
53 49 @Override
... ... @@ -55,33 +51,38 @@ public class PropertyValueServiceImpl implements PropertyValueService {
55 51 // 校验存在
56 52 this.validatePropertyValueExists(id);
57 53 // 删除
58   - propertyValueMapper.deleteById(id);
  54 + productPropertyValueMapper.deleteById(id);
59 55 }
60 56  
61 57 private void validatePropertyValueExists(Integer id) {
62   - if (propertyValueMapper.selectById(id) == null) {
  58 + if (productPropertyValueMapper.selectById(id) == null) {
63 59 throw exception(PROPERTY_VALUE_NOT_EXISTS);
64 60 }
65 61 }
66 62  
67 63 @Override
68   - public PropertyValueDO getPropertyValue(Integer id) {
69   - return propertyValueMapper.selectById(id);
  64 + public ProductPropertyValueDO getPropertyValue(Integer id) {
  65 + return productPropertyValueMapper.selectById(id);
70 66 }
71 67  
72 68 @Override
73   - public List<PropertyValueDO> getPropertyValueList(Collection<Integer> ids) {
74   - return propertyValueMapper.selectBatchIds(ids);
  69 + public List<ProductPropertyValueDO> getPropertyValueList(Collection<Integer> ids) {
  70 + return productPropertyValueMapper.selectBatchIds(ids);
75 71 }
76 72  
77 73 @Override
78   - public PageResult<PropertyValueDO> getPropertyValuePage(PropertyValuePageReqVO pageReqVO) {
79   - return propertyValueMapper.selectPage(pageReqVO);
  74 + public void batchInsert(List<ProductPropertyValueDO> propertyValues) {
  75 + productPropertyValueMapper.insertBatch(propertyValues);
80 76 }
81 77  
82 78 @Override
83   - public List<PropertyValueDO> getPropertyValueList(PropertyValueExportReqVO exportReqVO) {
84   - return propertyValueMapper.selectList(exportReqVO);
  79 + public List<ProductPropertyValueDO> getPropertyValueListByPropertyId(List<Long> propertyIds) {
  80 + return productPropertyValueMapper.getPropertyValueListByPropertyId(propertyIds);
  81 + }
  82 +
  83 + @Override
  84 + public void deletePropertyValueByPropertyId(Long propertyId) {
  85 + productPropertyValueMapper.deletePropertyValueByPropertyId(propertyId);
85 86 }
86 87  
87 88 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/PropertyValueService.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/ProductPropertyValueService.java 100755 → 100644
... ... @@ -3,15 +3,14 @@ package cn.iocoder.yudao.module.product.service.propertyvalue;
3 3 import java.util.*;
4 4 import javax.validation.*;
5 5 import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*;
6   -import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValueDO;
7   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.ProductPropertyValueDO;
8 7  
9 8 /**
10 9 * 规格值 Service 接口
11 10 *
12 11 * @author 芋道源码
13 12 */
14   -public interface PropertyValueService {
  13 +public interface ProductPropertyValueService {
15 14  
16 15 /**
17 16 * 创建规格值
... ... @@ -19,14 +18,14 @@ public interface PropertyValueService {
19 18 * @param createReqVO 创建信息
20 19 * @return 编号
21 20 */
22   - Integer createPropertyValue(@Valid PropertyValueCreateReqVO createReqVO);
  21 + Integer createPropertyValue(@Valid ProductPropertyValueCreateReqVO createReqVO);
23 22  
24 23 /**
25 24 * 更新规格值
26 25 *
27 26 * @param updateReqVO 更新信息
28 27 */
29   - void updatePropertyValue(@Valid PropertyValueUpdateReqVO updateReqVO);
  28 + void updatePropertyValue(@Valid ProductPropertyValueUpdateReqVO updateReqVO);
30 29  
31 30 /**
32 31 * 删除规格值
... ... @@ -41,7 +40,7 @@ public interface PropertyValueService {
41 40 * @param id 编号
42 41 * @return 规格值
43 42 */
44   - PropertyValueDO getPropertyValue(Integer id);
  43 + ProductPropertyValueDO getPropertyValue(Integer id);
45 44  
46 45 /**
47 46 * 获得规格值列表
... ... @@ -49,22 +48,24 @@ public interface PropertyValueService {
49 48 * @param ids 编号
50 49 * @return 规格值列表
51 50 */
52   - List<PropertyValueDO> getPropertyValueList(Collection<Integer> ids);
  51 + List<ProductPropertyValueDO> getPropertyValueList(Collection<Integer> ids);
53 52  
54 53 /**
55   - * 获得规格值分页
56   - *
57   - * @param pageReqVO 分页查询
58   - * @return 规格值分页
  54 + * 批量插入属性值
  55 + * @param propertyValues
59 56 */
60   - PageResult<PropertyValueDO> getPropertyValuePage(PropertyValuePageReqVO pageReqVO);
  57 + void batchInsert(List<ProductPropertyValueDO> propertyValues);
61 58  
62 59 /**
63   - * 获得规格值列表, 用于 Excel 导出
64   - *
65   - * @param exportReqVO 查询条件
66   - * @return 规格值列表
  60 + * 根据属性id查询
  61 + * @param propertyIds
  62 + * @return
67 63 */
68   - List<PropertyValueDO> getPropertyValueList(PropertyValueExportReqVO exportReqVO);
  64 + List<ProductPropertyValueDO> getPropertyValueListByPropertyId(List<Long> propertyIds);
69 65  
  66 + /**
  67 + * 根据属性id 删除
  68 + * @param propertyId
  69 + */
  70 + void deletePropertyValueByPropertyId(Long propertyId);
70 71 }
... ...
yudao-ui-admin/src/views/mall/product/property/index.vue
... ... @@ -24,16 +24,17 @@
24 24 <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
25 25 v-hasPermi="['product:property:create']">新增</el-button>
26 26 </el-col>
27   - <el-col :span="1.5">
28   - <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
29   - v-hasPermi="['product:property:export']">导出</el-button>
30   - </el-col>
31 27 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
32 28 </el-row>
33 29  
34 30 <!-- 列表 -->
35 31 <el-table v-loading="loading" :data="list">
36 32 <el-table-column label="规格名称" align="center" prop="name" />
  33 + <el-table-column label="规格名称" align="center" prop="propertyValueList">
  34 + <template slot-scope="scope">
  35 + <span>{{formatList(scope.row.propertyValueList)}}</span>
  36 + </template>
  37 + </el-table-column>
37 38 <el-table-column label="开启状态" align="center" prop="status">
38 39 <template slot-scope="scope">
39 40 <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/>
... ... @@ -74,19 +75,19 @@
74 75 <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="addPropertyValue()">添加</el-button>
75 76 </el-form-item>
76 77 <el-form-item
77   - v-for="(domain, index) in form.propertyValues"
  78 + v-for="(domain, index) in form.propertyValueList"
78 79 :key="domain.key"
79   - :prop="'propertyValues.' + index + '.value'"
  80 + :prop="'propertyValueList.' + index + '.name'"
80 81 :rules="{
81   - required: true, message: '域名不能为空', trigger: 'blur'
  82 + required: true, message: '属性值不能为空', trigger: 'blur'
82 83 }"
83 84 >
84 85 <el-row>
85 86 <el-col :span="18">
86   - <el-input v-model="domain.value"></el-input>
  87 + <el-input v-model="domain.name" size="mini"></el-input>
87 88 </el-col>
88 89 <el-col :span="6">
89   - <el-button @click.prevent="removePropertyValue(domain)">删除</el-button>
  90 + <el-button style="margin-left: 20px;" size="mini" @click.prevent="removePropertyValue(domain)">删除</el-button>
90 91 </el-col>
91 92 </el-row>
92 93 </el-form-item>
... ... @@ -134,8 +135,8 @@ export default {
134 135 form: {
135 136 name:'',
136 137 status:'',
137   - propertyValues: [{
138   - value: ''
  138 + propertyValueList: [{
  139 + name: ''
139 140 }],
140 141 },
141 142 // 表单校验
... ... @@ -171,12 +172,10 @@ export default {
171 172 id: undefined,
172 173 name: undefined,
173 174 status: undefined,
  175 + propertyValueList: [{
  176 + name: ''
  177 + }]
174 178 };
175   - this.form.propertyValues = [{
176   - key:'',
177   - value: ''
178   - }];
179   - console.log("this.form", this.form)
180 179 this.resetForm("form");
181 180 },
182 181 /** 搜索按钮操作 */
... ... @@ -194,7 +193,7 @@ export default {
194 193 handleAdd() {
195 194 this.reset();
196 195 this.open = true;
197   - this.title = "添加规格名称";
  196 + this.title = "添加规格";
198 197 },
199 198 /** 修改按钮操作 */
200 199 handleUpdate(row) {
... ... @@ -203,7 +202,7 @@ export default {
203 202 getProperty(id).then(response => {
204 203 this.form = response.data;
205 204 this.open = true;
206   - this.title = "修改规格名称";
  205 + this.title = "修改规格";
207 206 });
208 207 },
209 208 /** 提交按钮 */
... ... @@ -232,7 +231,7 @@ export default {
232 231 /** 删除按钮操作 */
233 232 handleDelete(row) {
234 233 const id = row.id;
235   - this.$modal.confirm('是否确认删除规格名称编号为"' + id + '"的数据项?').then(function() {
  234 + this.$modal.confirm('是否确认删除规格名称为"' + row.name + '"的数据项?').then(function() {
236 235 return deleteProperty(id);
237 236 }).then(() => {
238 237 this.getList();
... ... @@ -256,17 +255,25 @@ export default {
256 255 }).catch(() => {});
257 256 },
258 257 removePropertyValue(item) {
259   - var index = this.form.propertyValues.indexOf(item)
  258 + var index = this.form.propertyValueList.indexOf(item)
260 259 if (index !== -1) {
261   - this.form.propertyValues.splice(index, 1)
  260 + this.form.propertyValueList.splice(index, 1)
262 261 }
263 262 },
264 263 addPropertyValue() {
265   - console.log("this.form.propertyValues", this.form.propertyValues)
266   - this.form.propertyValues.push({
267   - value: '',
268   - key: Date.now()
  264 + this.form.propertyValueList.push({
  265 + name: ''
269 266 });
  267 + },
  268 + formatList(list) {
  269 + let str = ''
  270 + for (var i = 0; i < list.length; i++) {
  271 + str += list[i].name;
  272 + if(i != list.length-1){
  273 + str+="/";
  274 + }
  275 + }
  276 + return str
270 277 }
271 278 }
272 279 };
... ...