From 2bbfa402651482fe5bc68cebbc46c581549c95a3 Mon Sep 17 00:00:00 2001 From: franky <16621167566@163.com> Date: Tue, 17 May 2022 22:16:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=95=86=E5=93=81=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/mall.sql | 97 +++++----- .../product/enums/ErrorCodeConstants.java | 4 +- .../admin/attrkey/AttrKeyController.java | 100 ----------- .../admin/attrvalue/AttrValueController.java | 100 ----------- .../admin/property/PropertyController.java | 100 +++++++++++ .../vo/PropertyCreateReqVO.java} | 4 +- .../vo/PropertyExcelVO.java} | 18 +- .../vo/PropertyExportReqVO.java} | 18 +- .../vo/PropertyPageReqVO.java} | 16 +- .../vo/PropertyRespVO.java} | 6 +- .../vo/PropertyUpdateReqVO.java} | 6 +- .../PropertyValueController.java | 100 +++++++++++ .../vo/PropertyValueBaseVO.java} | 8 +- .../vo/PropertyValueCreateReqVO.java} | 4 +- .../vo/PropertyValueExcelVO.java} | 14 +- .../vo/PropertyValueExportReqVO.java} | 24 +-- .../vo/PropertyValuePageReqVO.java} | 22 +-- .../vo/PropertyValueRespVO.java} | 4 +- .../vo/PropertyValueUpdateReqVO.java} | 4 +- .../controller/admin/sku/vo/SkuBaseVO.java | 14 +- .../controller/admin/sku/vo/SkuExcelVO.java | 18 +- .../admin/sku/vo/SkuExportReqVO.java | 28 +-- .../controller/admin/sku/vo/SkuPageReqVO.java | 28 +-- .../controller/admin/spu/vo/SpuBaseVO.java | 17 +- .../controller/admin/spu/vo/SpuExcelVO.java | 21 +-- .../admin/spu/vo/SpuExportReqVO.java | 31 ++-- .../controller/admin/spu/vo/SpuPageReqVO.java | 31 ++-- .../convert/attrkey/AttrKeyConvert.java | 34 ---- .../convert/attrvalue/AttrValueConvert.java | 34 ---- .../convert/property/PropertyConvert.java | 34 ++++ .../propertyvalue/PropertyValueConvert.java | 34 ++++ .../product/dal/dataobject/sku/SkuDO.java | 14 +- .../product/dal/dataobject/spu/SpuDO.java | 18 +- .../dal/mysql/attrkey/AttrKeyMapper.java | 36 ---- .../dal/mysql/attrvalue/AttrValueMapper.java | 38 ---- .../dal/mysql/property/PropertyMapper.java | 36 ++++ .../propertyvalue/PropertyValueMapper.java | 38 ++++ .../product/dal/mysql/sku/SkuMapper.java | 12 +- .../product/dal/mysql/spu/SpuMapper.java | 14 +- .../service/attrkey/AttrKeyServiceImpl.java | 82 --------- .../attrvalue/AttrValueServiceImpl.java | 82 --------- .../PropertyService.java} | 22 +-- .../service/property/PropertyServiceImpl.java | 82 +++++++++ .../PropertyValueService.java} | 22 +-- .../PropertyValueServiceImpl.java | 82 +++++++++ .../attrkey/AttrKeyServiceImplTest.java | 168 ------------------ 46 files changed, 770 insertions(+), 949 deletions(-) delete mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/AttrKeyController.java delete mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/AttrValueController.java create mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/PropertyController.java rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/{attrkey/vo/AttrKeyCreateReqVO.java => property/vo/PropertyCreateReqVO.java} (65%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/{attrkey/vo/AttrKeyExcelVO.java => property/vo/PropertyExcelVO.java} (63%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/{attrkey/vo/AttrKeyExportReqVO.java => property/vo/PropertyExportReqVO.java} (74%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/{attrkey/vo/AttrKeyPageReqVO.java => property/vo/PropertyPageReqVO.java} (79%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/{attrkey/vo/AttrKeyRespVO.java => property/vo/PropertyRespVO.java} (69%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/{attrkey/vo/AttrKeyUpdateReqVO.java => property/vo/PropertyUpdateReqVO.java} (69%) create mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/PropertyValueController.java rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/{attrvalue/vo/AttrValueBaseVO.java => propertyvalue/vo/PropertyValueBaseVO.java} (74%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/{attrvalue/vo/AttrValueCreateReqVO.java => propertyvalue/vo/PropertyValueCreateReqVO.java} (62%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/{attrvalue/vo/AttrValueExcelVO.java => propertyvalue/vo/PropertyValueExcelVO.java} (73%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/{attrvalue/vo/AttrValueExportReqVO.java => propertyvalue/vo/PropertyValueExportReqVO.java} (78%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/{attrvalue/vo/AttrValuePageReqVO.java => propertyvalue/vo/PropertyValuePageReqVO.java} (83%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/{attrvalue/vo/AttrValueRespVO.java => propertyvalue/vo/PropertyValueRespVO.java} (71%) rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/{attrvalue/vo/AttrValueUpdateReqVO.java => propertyvalue/vo/PropertyValueUpdateReqVO.java} (71%) delete mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/attrkey/AttrKeyConvert.java delete mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/attrvalue/AttrValueConvert.java create mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/PropertyConvert.java create mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/PropertyValueConvert.java delete mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/attrkey/AttrKeyMapper.java delete mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/attrvalue/AttrValueMapper.java create mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/PropertyMapper.java create mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/propertyvalue/PropertyValueMapper.java delete mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/attrkey/AttrKeyServiceImpl.java delete mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/attrvalue/AttrValueServiceImpl.java rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/{attrkey/AttrKeyService.java => property/PropertyService.java} (59%) create mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/PropertyServiceImpl.java rename yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/{attrvalue/AttrValueService.java => propertyvalue/PropertyValueService.java} (54%) create mode 100755 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/PropertyValueServiceImpl.java delete mode 100755 yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/attrkey/AttrKeyServiceImplTest.java diff --git a/sql/mall.sql b/sql/mall.sql index 3f1142784..99df2a499 100644 --- a/sql/mall.sql +++ b/sql/mall.sql @@ -112,36 +112,40 @@ CREATE TABLE `market_activity` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='促销活动'; + + -- 规格名称表 -drop table if exists product_attr_key; -create table product_attr_key +drop table if exists product_property; +create table product_property ( - id int comment '主键', - create_time datetime default current_timestamp comment '创建时间', - update_time datetime default current_timestamp on update current_timestamp comment '更新时间', + id bigint comment '主键', + name varchar(64) comment '规格名称', + status tinyint comment '状态: 0 开启 ,1 禁用', + create_time datetime default current_timestamp comment '创建时间', + update_time datetime default current_timestamp on update current_timestamp comment '更新时间', creator varchar(64) comment '创建人', updater varchar(64) comment '更新人', + tenant_id bigint NOT NULL DEFAULT '0' COMMENT '租户编号', deleted bit(1) comment '状态', - attr_name varchar(64) comment '规格名称', - status tinyint comment '状态: 1 开启 ,2 禁用', primary key (id), - key idx_name (attr_name(32)) comment '规格名称索引' + key idx_name (name(32)) comment '规格名称索引' ) comment '规格名称' character set utf8mb4 collate utf8mb4_general_ci; -- 规格值表 -drop table if exists product_attr_value; -create table product_attr_value +drop table if exists product_property_value; +create table product_property_value ( - id int comment '主键', - create_time datetime default current_timestamp comment '创建时间', - update_time datetime default current_timestamp on update current_timestamp comment '更新时间', - creator varchar(64) comment '创建人', - updater varchar(64) comment '更新人', - deleted bit(1) comment '状态', - attr_key_id varchar(64) comment '规格键id', - attr_value_name varchar(128) comment '规格值名字', - status tinyint comment '状态: 1 开启 ,2 禁用', + id int comment '主键', + property_id bigint comment '规格键id', + name varchar(128) comment '规格值名字', + status tinyint comment '状态: 1 开启 ,2 禁用', + create_time datetime default current_timestamp comment '创建时间', + update_time datetime default current_timestamp on update current_timestamp comment '更新时间', + creator varchar(64) comment '创建人', + updater varchar(64) comment '更新人', + tenant_id bigint NOT NULL DEFAULT '0' COMMENT '租户编号', + deleted bit(1) comment '状态', primary key (id) ) comment '规格值' character set utf8mb4 collate utf8mb4_general_ci; @@ -150,23 +154,23 @@ create table product_attr_value drop table if exists product_spu; create table product_spu ( - id int comment '主键', - create_time datetime default current_timestamp comment '创建时间', - update_time datetime default current_timestamp on update current_timestamp comment '更新时间', - creator varchar(64) comment '创建人', - updater varchar(64) comment '更新人', - deleted bit(1) comment '状态', - name varchar(128) comment '商品名称', - visible bit(1) comment '上下架状态: true 上架,false 下架', - sell_point varchar(128) not null comment '卖点', - description text not null comment '描述', - cid int not null comment '分类id', - list_pic_url varchar(128) comment '列表图', - pic_urls varchar(1024) not null default '' comment '商品主图地址, 数组,以逗号分隔, 最多上传15张', - sort int not null default 0 comment '排序字段', - like_count int comment '点赞初始人数', - price int comment '价格', - quantity int comment '库存数量', + id int comment '主键', + name varchar(128) comment '商品名称', + sell_point varchar(128) not null comment '卖点', + description text not null comment '描述', + category_id bigint not null comment '分类id', + pic_urls varchar(1024) not null default '' comment '商品主图地址\n *\n * 数组,以逗号分隔\n 最多上传15张', + sort int not null default 0 comment '排序字段', + like_count int comment '点赞初始人数', + price int comment '价格 单位使用:分', + quantity int comment '库存数量', + status bit(1) comment '上下架状态: 0 上架(开启) 1 下架(禁用)', + create_time datetime default current_timestamp comment '创建时间', + update_time datetime default current_timestamp on update current_timestamp comment '更新时间', + creator varchar(64) comment '创建人', + updater varchar(64) comment '更新人', + tenant_id bigint NOT NULL DEFAULT '0' COMMENT '租户编号', + deleted bit(1) comment '状态', primary key (id) ) comment '商品spu' character set utf8mb4 collate utf8mb4_general_ci; @@ -177,19 +181,22 @@ drop table if exists product_sku; create table product_sku ( id int comment '主键', - create_time datetime default current_timestamp comment '创建时间', - update_time datetime default current_timestamp on update current_timestamp comment '更新时间', - creator varchar(64) comment '创建人', - updater varchar(64) comment '更新人', - deleted bit(1) comment '状态', - spu_id int not null comment 'spu编号', - sku_status tinyint comment '状态: 1-正常 2-禁用', - attrs varchar(64) not null comment '规格值数组, 以逗号隔开', + spu_id bigint not null comment 'spu编号', + properties varchar(64) not null comment '规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]', price int not null DEFAULT -1 comment '销售价格,单位:分', original_price int not null DEFAULT -1 comment '原价, 单位: 分', cost_price int not null DEFAULT -1 comment '成本价,单位: 分', bar_code varchar(64) not null comment '条形码', pic_url VARCHAR(128) not null comment '图片地址', + status tinyint comment '状态: 0-正常 1-禁用', + create_time datetime default current_timestamp comment '创建时间', + update_time datetime default current_timestamp on update current_timestamp comment '更新时间', + creator varchar(64) comment '创建人', + updater varchar(64) comment '更新人', + tenant_id bigint NOT NULL DEFAULT '0' COMMENT '租户编号', + deleted bit(1) comment '状态', primary key (id) ) comment '商品sku' character set utf8mb4 - collate utf8mb4_general_ci; \ No newline at end of file + collate utf8mb4_general_ci; + + diff --git a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java b/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java index 26cb49580..06ca657eb 100644 --- a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java +++ b/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java @@ -18,10 +18,10 @@ public interface ErrorCodeConstants { ErrorCode BRAND_NOT_EXISTS = new ErrorCode(1008002000, "品牌不存在"); // ========== 规格名称 1008003000 ========== - ErrorCode ATTR_KEY_NOT_EXISTS = new ErrorCode(1008003000, "规格名称不存在"); + ErrorCode PROPERTY_NOT_EXISTS = new ErrorCode(1008003000, "规格名称不存在"); // ========== 规格值 1008004000 ========== - ErrorCode ATTR_VALUE_NOT_EXISTS = new ErrorCode(1008004000, "规格值不存在"); + ErrorCode PROPERTY_VALUE_NOT_EXISTS = new ErrorCode(1008004000, "规格值不存在"); // ========== 商品spu 1008005000 ========== ErrorCode SPU_NOT_EXISTS = new ErrorCode(1008005000, "商品spu不存在"); diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/AttrKeyController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/AttrKeyController.java deleted file mode 100755 index 9e11a3e58..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/AttrKeyController.java +++ /dev/null @@ -1,100 +0,0 @@ -package cn.iocoder.yudao.module.product.controller.admin.attrkey; - -import org.springframework.web.bind.annotation.*; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.security.access.prepost.PreAuthorize; -import io.swagger.annotations.*; - -import javax.validation.constraints.*; -import javax.validation.*; -import javax.servlet.http.*; -import java.util.*; -import java.io.IOException; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; - -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; - -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; - -import cn.iocoder.yudao.module.product.controller.admin.attrkey.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.attrkey.AttrKeyDO; -import cn.iocoder.yudao.module.product.convert.attrkey.AttrKeyConvert; -import cn.iocoder.yudao.module.product.service.attrkey.AttrKeyService; - -@Api(tags = "管理后台 - 规格名称") -@RestController -@RequestMapping("/product/attr-key") -@Validated -public class AttrKeyController { - - @Resource - private AttrKeyService attrKeyService; - - @PostMapping("/create") - @ApiOperation("创建规格名称") - @PreAuthorize("@ss.hasPermission('product:attr-key:create')") - public CommonResult createAttrKey(@Valid @RequestBody AttrKeyCreateReqVO createReqVO) { - return success(attrKeyService.createAttrKey(createReqVO)); - } - - @PutMapping("/update") - @ApiOperation("更新规格名称") - @PreAuthorize("@ss.hasPermission('product:attr-key:update')") - public CommonResult updateAttrKey(@Valid @RequestBody AttrKeyUpdateReqVO updateReqVO) { - attrKeyService.updateAttrKey(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @ApiOperation("删除规格名称") - @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Integer.class) - @PreAuthorize("@ss.hasPermission('product:attr-key:delete')") - public CommonResult deleteAttrKey(@RequestParam("id") Integer id) { - attrKeyService.deleteAttrKey(id); - return success(true); - } - - @GetMapping("/get") - @ApiOperation("获得规格名称") - @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class) - @PreAuthorize("@ss.hasPermission('product:attr-key:query')") - public CommonResult getAttrKey(@RequestParam("id") Integer id) { - AttrKeyDO attrKey = attrKeyService.getAttrKey(id); - return success(AttrKeyConvert.INSTANCE.convert(attrKey)); - } - - @GetMapping("/list") - @ApiOperation("获得规格名称列表") - @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) - @PreAuthorize("@ss.hasPermission('product:attr-key:query')") - public CommonResult> getAttrKeyList(@RequestParam("ids") Collection ids) { - List list = attrKeyService.getAttrKeyList(ids); - return success(AttrKeyConvert.INSTANCE.convertList(list)); - } - - @GetMapping("/page") - @ApiOperation("获得规格名称分页") - @PreAuthorize("@ss.hasPermission('product:attr-key:query')") - public CommonResult> getAttrKeyPage(@Valid AttrKeyPageReqVO pageVO) { - PageResult pageResult = attrKeyService.getAttrKeyPage(pageVO); - return success(AttrKeyConvert.INSTANCE.convertPage(pageResult)); - } - - @GetMapping("/export-excel") - @ApiOperation("导出规格名称 Excel") - @PreAuthorize("@ss.hasPermission('product:attr-key:export')") - @OperateLog(type = EXPORT) - public void exportAttrKeyExcel(@Valid AttrKeyExportReqVO exportReqVO, - HttpServletResponse response) throws IOException { - List list = attrKeyService.getAttrKeyList(exportReqVO); - // 导出 Excel - List datas = AttrKeyConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "规格名称.xls", "数据", AttrKeyExcelVO.class, datas); - } - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/AttrValueController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/AttrValueController.java deleted file mode 100755 index d49596402..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/AttrValueController.java +++ /dev/null @@ -1,100 +0,0 @@ -package cn.iocoder.yudao.module.product.controller.admin.attrvalue; - -import org.springframework.web.bind.annotation.*; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.security.access.prepost.PreAuthorize; -import io.swagger.annotations.*; - -import javax.validation.constraints.*; -import javax.validation.*; -import javax.servlet.http.*; -import java.util.*; -import java.io.IOException; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; - -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; - -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; - -import cn.iocoder.yudao.module.product.controller.admin.attrvalue.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.attrvalue.AttrValueDO; -import cn.iocoder.yudao.module.product.convert.attrvalue.AttrValueConvert; -import cn.iocoder.yudao.module.product.service.attrvalue.AttrValueService; - -@Api(tags = "管理后台 - 规格值") -@RestController -@RequestMapping("/product/attr-value") -@Validated -public class AttrValueController { - - @Resource - private AttrValueService attrValueService; - - @PostMapping("/create") - @ApiOperation("创建规格值") - @PreAuthorize("@ss.hasPermission('product:attr-value:create')") - public CommonResult createAttrValue(@Valid @RequestBody AttrValueCreateReqVO createReqVO) { - return success(attrValueService.createAttrValue(createReqVO)); - } - - @PutMapping("/update") - @ApiOperation("更新规格值") - @PreAuthorize("@ss.hasPermission('product:attr-value:update')") - public CommonResult updateAttrValue(@Valid @RequestBody AttrValueUpdateReqVO updateReqVO) { - attrValueService.updateAttrValue(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @ApiOperation("删除规格值") - @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Integer.class) - @PreAuthorize("@ss.hasPermission('product:attr-value:delete')") - public CommonResult deleteAttrValue(@RequestParam("id") Integer id) { - attrValueService.deleteAttrValue(id); - return success(true); - } - - @GetMapping("/get") - @ApiOperation("获得规格值") - @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class) - @PreAuthorize("@ss.hasPermission('product:attr-value:query')") - public CommonResult getAttrValue(@RequestParam("id") Integer id) { - AttrValueDO attrValue = attrValueService.getAttrValue(id); - return success(AttrValueConvert.INSTANCE.convert(attrValue)); - } - - @GetMapping("/list") - @ApiOperation("获得规格值列表") - @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) - @PreAuthorize("@ss.hasPermission('product:attr-value:query')") - public CommonResult> getAttrValueList(@RequestParam("ids") Collection ids) { - List list = attrValueService.getAttrValueList(ids); - return success(AttrValueConvert.INSTANCE.convertList(list)); - } - - @GetMapping("/page") - @ApiOperation("获得规格值分页") - @PreAuthorize("@ss.hasPermission('product:attr-value:query')") - public CommonResult> getAttrValuePage(@Valid AttrValuePageReqVO pageVO) { - PageResult pageResult = attrValueService.getAttrValuePage(pageVO); - return success(AttrValueConvert.INSTANCE.convertPage(pageResult)); - } - - @GetMapping("/export-excel") - @ApiOperation("导出规格值 Excel") - @PreAuthorize("@ss.hasPermission('product:attr-value:export')") - @OperateLog(type = EXPORT) - public void exportAttrValueExcel(@Valid AttrValueExportReqVO exportReqVO, - HttpServletResponse response) throws IOException { - List list = attrValueService.getAttrValueList(exportReqVO); - // 导出 Excel - List datas = AttrValueConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "规格值.xls", "数据", AttrValueExcelVO.class, datas); - } - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/PropertyController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/PropertyController.java new file mode 100755 index 000000000..b35e38ca0 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/PropertyController.java @@ -0,0 +1,100 @@ +package cn.iocoder.yudao.module.product.controller.admin.property; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.annotations.*; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.product.controller.admin.property.vo.*; +import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO; +import cn.iocoder.yudao.module.product.convert.property.PropertyConvert; +import cn.iocoder.yudao.module.product.service.property.PropertyService; + +@Api(tags = "管理后台 - 规格名称") +@RestController +@RequestMapping("/product/property") +@Validated +public class PropertyController { + + @Resource + private PropertyService propertyService; + + @PostMapping("/create") + @ApiOperation("创建规格名称") + @PreAuthorize("@ss.hasPermission('product:property:create')") + public CommonResult createProperty(@Valid @RequestBody PropertyCreateReqVO createReqVO) { + return success(propertyService.createProperty(createReqVO)); + } + + @PutMapping("/update") + @ApiOperation("更新规格名称") + @PreAuthorize("@ss.hasPermission('product:property:update')") + public CommonResult updateProperty(@Valid @RequestBody PropertyUpdateReqVO updateReqVO) { + propertyService.updateProperty(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @ApiOperation("删除规格名称") + @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) + @PreAuthorize("@ss.hasPermission('product:property:delete')") + public CommonResult deleteProperty(@RequestParam("id") Long id) { + propertyService.deleteProperty(id); + return success(true); + } + + @GetMapping("/get") + @ApiOperation("获得规格名称") + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) + @PreAuthorize("@ss.hasPermission('product:property:query')") + public CommonResult getProperty(@RequestParam("id") Long id) { + PropertyDO property = propertyService.getProperty(id); + return success(PropertyConvert.INSTANCE.convert(property)); + } + + @GetMapping("/list") + @ApiOperation("获得规格名称列表") + @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) + @PreAuthorize("@ss.hasPermission('product:property:query')") + public CommonResult> getPropertyList(@RequestParam("ids") Collection ids) { + List list = propertyService.getPropertyList(ids); + return success(PropertyConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @ApiOperation("获得规格名称分页") + @PreAuthorize("@ss.hasPermission('product:property:query')") + public CommonResult> getPropertyPage(@Valid PropertyPageReqVO pageVO) { + PageResult pageResult = propertyService.getPropertyPage(pageVO); + return success(PropertyConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @ApiOperation("导出规格名称 Excel") + @PreAuthorize("@ss.hasPermission('product:property:export')") + @OperateLog(type = EXPORT) + public void exportPropertyExcel(@Valid PropertyExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = propertyService.getPropertyList(exportReqVO); + // 导出 Excel + List datas = PropertyConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "规格名称.xls", "数据", PropertyExcelVO.class, datas); + } + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyCreateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyCreateReqVO.java similarity index 65% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyCreateReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyCreateReqVO.java index bd79af8b7..4effd68b9 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyCreateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyCreateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.product.controller.admin.attrkey.vo; +package cn.iocoder.yudao.module.product.controller.admin.property.vo; import lombok.*; import java.util.*; @@ -9,6 +9,6 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class AttrKeyCreateReqVO extends AttrKeyBaseVO { +public class PropertyCreateReqVO extends PropertyBaseVO { } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyExcelVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyExcelVO.java similarity index 63% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyExcelVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyExcelVO.java index b27545967..eb82e8512 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyExcelVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyExcelVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.product.controller.admin.attrkey.vo; +package cn.iocoder.yudao.module.product.controller.admin.property.vo; import lombok.*; import java.util.*; @@ -12,18 +12,18 @@ import com.alibaba.excel.annotation.ExcelProperty; * @author 芋道源码 */ @Data -public class AttrKeyExcelVO { +public class PropertyExcelVO { @ExcelProperty("主键") - private Integer id; + private Long id; + + @ExcelProperty("规格名称") + private String name; + + @ExcelProperty("状态: 0 开启 ,1 禁用") + private Integer status; @ExcelProperty("创建时间") private Date createTime; - @ExcelProperty("规格名称") - private String attrName; - - @ExcelProperty("状态: 1 开启 ,2 禁用") - private Integer status; - } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyExportReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyExportReqVO.java similarity index 74% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyExportReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyExportReqVO.java index aa33e0977..0201ec5cf 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyExportReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyExportReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.product.controller.admin.attrkey.vo; +package cn.iocoder.yudao.module.product.controller.admin.property.vo; import lombok.*; import java.util.*; @@ -8,9 +8,15 @@ import org.springframework.format.annotation.DateTimeFormat; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel(value = "管理后台 - 规格名称 Excel 导出 Request VO", description = "参数和 AttrKeyPageReqVO 是一致的") +@ApiModel(value = "管理后台 - 规格名称 Excel 导出 Request VO", description = "参数和 PropertyPageReqVO 是一致的") @Data -public class AttrKeyExportReqVO { +public class PropertyExportReqVO { + + @ApiModelProperty(value = "规格名称") + private String name; + + @ApiModelProperty(value = "状态: 0 开启 ,1 禁用") + private Integer status; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始创建时间") @@ -20,10 +26,4 @@ public class AttrKeyExportReqVO { @ApiModelProperty(value = "结束创建时间") private Date endCreateTime; - @ApiModelProperty(value = "规格名称") - private String attrName; - - @ApiModelProperty(value = "状态: 1 开启 ,2 禁用") - private Integer status; - } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyPageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyPageReqVO.java similarity index 79% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyPageReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyPageReqVO.java index 3045d3e65..c6caf0b12 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyPageReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyPageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.product.controller.admin.attrkey.vo; +package cn.iocoder.yudao.module.product.controller.admin.property.vo; import lombok.*; import java.util.*; @@ -12,7 +12,13 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class AttrKeyPageReqVO extends PageParam { +public class PropertyPageReqVO extends PageParam { + + @ApiModelProperty(value = "规格名称") + private String name; + + @ApiModelProperty(value = "状态: 0 开启 ,1 禁用") + private Integer status; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始创建时间") @@ -22,10 +28,4 @@ public class AttrKeyPageReqVO extends PageParam { @ApiModelProperty(value = "结束创建时间") private Date endCreateTime; - @ApiModelProperty(value = "规格名称") - private String attrName; - - @ApiModelProperty(value = "状态: 1 开启 ,2 禁用") - private Integer status; - } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyRespVO.java similarity index 69% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyRespVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyRespVO.java index 0e6ce07a8..8b14f2ba2 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.product.controller.admin.attrkey.vo; +package cn.iocoder.yudao.module.product.controller.admin.property.vo; import lombok.*; import java.util.*; @@ -8,10 +8,10 @@ import io.swagger.annotations.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class AttrKeyRespVO extends AttrKeyBaseVO { +public class PropertyRespVO extends PropertyBaseVO { @ApiModelProperty(value = "主键", required = true) - private Integer id; + private Long id; @ApiModelProperty(value = "创建时间") private Date createTime; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyUpdateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyUpdateReqVO.java similarity index 69% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyUpdateReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyUpdateReqVO.java index b1b9f70b7..84b0b4ca7 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrkey/vo/AttrKeyUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyUpdateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.product.controller.admin.attrkey.vo; +package cn.iocoder.yudao.module.product.controller.admin.property.vo; import lombok.*; import java.util.*; @@ -9,10 +9,10 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class AttrKeyUpdateReqVO extends AttrKeyBaseVO { +public class PropertyUpdateReqVO extends PropertyBaseVO { @ApiModelProperty(value = "主键", required = true) @NotNull(message = "主键不能为空") - private Integer id; + private Long id; } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/PropertyValueController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/PropertyValueController.java new file mode 100755 index 000000000..78404e507 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/PropertyValueController.java @@ -0,0 +1,100 @@ +package cn.iocoder.yudao.module.product.controller.admin.propertyvalue; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.annotations.*; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*; +import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValueDO; +import cn.iocoder.yudao.module.product.convert.propertyvalue.PropertyValueConvert; +import cn.iocoder.yudao.module.product.service.propertyvalue.PropertyValueService; + +@Api(tags = "管理后台 - 规格值") +@RestController +@RequestMapping("/product/property-value") +@Validated +public class PropertyValueController { + + @Resource + private PropertyValueService propertyValueService; + + @PostMapping("/create") + @ApiOperation("创建规格值") + @PreAuthorize("@ss.hasPermission('product:property-value:create')") + public CommonResult createPropertyValue(@Valid @RequestBody PropertyValueCreateReqVO createReqVO) { + return success(propertyValueService.createPropertyValue(createReqVO)); + } + + @PutMapping("/update") + @ApiOperation("更新规格值") + @PreAuthorize("@ss.hasPermission('product:property-value:update')") + public CommonResult updatePropertyValue(@Valid @RequestBody PropertyValueUpdateReqVO updateReqVO) { + propertyValueService.updatePropertyValue(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @ApiOperation("删除规格值") + @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Integer.class) + @PreAuthorize("@ss.hasPermission('product:property-value:delete')") + public CommonResult deletePropertyValue(@RequestParam("id") Integer id) { + propertyValueService.deletePropertyValue(id); + return success(true); + } + + @GetMapping("/get") + @ApiOperation("获得规格值") + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class) + @PreAuthorize("@ss.hasPermission('product:property-value:query')") + public CommonResult getPropertyValue(@RequestParam("id") Integer id) { + PropertyValueDO propertyValue = propertyValueService.getPropertyValue(id); + return success(PropertyValueConvert.INSTANCE.convert(propertyValue)); + } + + @GetMapping("/list") + @ApiOperation("获得规格值列表") + @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) + @PreAuthorize("@ss.hasPermission('product:property-value:query')") + public CommonResult> getPropertyValueList(@RequestParam("ids") Collection ids) { + List list = propertyValueService.getPropertyValueList(ids); + return success(PropertyValueConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @ApiOperation("获得规格值分页") + @PreAuthorize("@ss.hasPermission('product:property-value:query')") + public CommonResult> getPropertyValuePage(@Valid PropertyValuePageReqVO pageVO) { + PageResult pageResult = propertyValueService.getPropertyValuePage(pageVO); + return success(PropertyValueConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @ApiOperation("导出规格值 Excel") + @PreAuthorize("@ss.hasPermission('product:property-value:export')") + @OperateLog(type = EXPORT) + public void exportPropertyValueExcel(@Valid PropertyValueExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = propertyValueService.getPropertyValueList(exportReqVO); + // 导出 Excel + List datas = PropertyValueConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "规格值.xls", "数据", PropertyValueExcelVO.class, datas); + } + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueBaseVO.java similarity index 74% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueBaseVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueBaseVO.java index 213536d5d..814911ccb 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueBaseVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueBaseVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.product.controller.admin.attrvalue.vo; +package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo; import lombok.*; import java.util.*; @@ -10,13 +10,13 @@ import javax.validation.constraints.*; * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 */ @Data -public class AttrValueBaseVO { +public class PropertyValueBaseVO { @ApiModelProperty(value = "规格键id") - private String attrKeyId; + private Long propertyId; @ApiModelProperty(value = "规格值名字") - private String attrValueName; + private String name; @ApiModelProperty(value = "状态: 1 开启 ,2 禁用") private Integer status; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueCreateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueCreateReqVO.java similarity index 62% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueCreateReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueCreateReqVO.java index f1fde199c..ac4857efd 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueCreateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueCreateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.product.controller.admin.attrvalue.vo; +package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo; import lombok.*; import java.util.*; @@ -9,6 +9,6 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class AttrValueCreateReqVO extends AttrValueBaseVO { +public class PropertyValueCreateReqVO extends PropertyValueBaseVO { } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueExcelVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueExcelVO.java similarity index 73% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueExcelVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueExcelVO.java index ba8deb080..59c368f79 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueExcelVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueExcelVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.product.controller.admin.attrvalue.vo; +package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo; import lombok.*; import java.util.*; @@ -12,21 +12,21 @@ import com.alibaba.excel.annotation.ExcelProperty; * @author 芋道源码 */ @Data -public class AttrValueExcelVO { +public class PropertyValueExcelVO { @ExcelProperty("主键") private Integer id; - @ExcelProperty("创建时间") - private Date createTime; - @ExcelProperty("规格键id") - private String attrKeyId; + private Long propertyId; @ExcelProperty("规格值名字") - private String attrValueName; + private String name; @ExcelProperty("状态: 1 开启 ,2 禁用") private Integer status; + @ExcelProperty("创建时间") + private Date createTime; + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueExportReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueExportReqVO.java similarity index 78% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueExportReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueExportReqVO.java index 0036dd2c2..6c76156b7 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueExportReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueExportReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.product.controller.admin.attrvalue.vo; +package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo; import lombok.*; import java.util.*; @@ -8,9 +8,18 @@ import org.springframework.format.annotation.DateTimeFormat; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel(value = "管理后台 - 规格值 Excel 导出 Request VO", description = "参数和 AttrValuePageReqVO 是一致的") +@ApiModel(value = "管理后台 - 规格值 Excel 导出 Request VO", description = "参数和 PropertyValuePageReqVO 是一致的") @Data -public class AttrValueExportReqVO { +public class PropertyValueExportReqVO { + + @ApiModelProperty(value = "规格键id") + private Long propertyId; + + @ApiModelProperty(value = "规格值名字") + private String name; + + @ApiModelProperty(value = "状态: 1 开启 ,2 禁用") + private Integer status; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始创建时间") @@ -20,13 +29,4 @@ public class AttrValueExportReqVO { @ApiModelProperty(value = "结束创建时间") private Date endCreateTime; - @ApiModelProperty(value = "规格键id") - private String attrKeyId; - - @ApiModelProperty(value = "规格值名字") - private String attrValueName; - - @ApiModelProperty(value = "状态: 1 开启 ,2 禁用") - private Integer status; - } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValuePageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValuePageReqVO.java similarity index 83% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValuePageReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValuePageReqVO.java index e9e534242..5308c42d1 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValuePageReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValuePageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.product.controller.admin.attrvalue.vo; +package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo; import lombok.*; import java.util.*; @@ -12,7 +12,16 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class AttrValuePageReqVO extends PageParam { +public class PropertyValuePageReqVO extends PageParam { + + @ApiModelProperty(value = "规格键id") + private Long propertyId; + + @ApiModelProperty(value = "规格值名字") + private String name; + + @ApiModelProperty(value = "状态: 1 开启 ,2 禁用") + private Integer status; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始创建时间") @@ -22,13 +31,4 @@ public class AttrValuePageReqVO extends PageParam { @ApiModelProperty(value = "结束创建时间") private Date endCreateTime; - @ApiModelProperty(value = "规格键id") - private String attrKeyId; - - @ApiModelProperty(value = "规格值名字") - private String attrValueName; - - @ApiModelProperty(value = "状态: 1 开启 ,2 禁用") - private Integer status; - } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueRespVO.java similarity index 71% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueRespVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueRespVO.java index 630a14e1c..ac30456d4 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.product.controller.admin.attrvalue.vo; +package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo; import lombok.*; import java.util.*; @@ -8,7 +8,7 @@ import io.swagger.annotations.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class AttrValueRespVO extends AttrValueBaseVO { +public class PropertyValueRespVO extends PropertyValueBaseVO { @ApiModelProperty(value = "主键", required = true) private Integer id; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueUpdateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueUpdateReqVO.java similarity index 71% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueUpdateReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueUpdateReqVO.java index 52d8d4d9d..1883192a7 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/attrvalue/vo/AttrValueUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueUpdateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.product.controller.admin.attrvalue.vo; +package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo; import lombok.*; import java.util.*; @@ -9,7 +9,7 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class AttrValueUpdateReqVO extends AttrValueBaseVO { +public class PropertyValueUpdateReqVO extends PropertyValueBaseVO { @ApiModelProperty(value = "主键", required = true) @NotNull(message = "主键不能为空") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuBaseVO.java index 135062fcf..b91be42c9 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuBaseVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuBaseVO.java @@ -14,14 +14,11 @@ public class SkuBaseVO { @ApiModelProperty(value = "spu编号", required = true) @NotNull(message = "spu编号不能为空") - private Integer spuId; + private Long spuId; - @ApiModelProperty(value = "状态: 1-正常 2-禁用") - private Integer skuStatus; - - @ApiModelProperty(value = "规格值数组, 以逗号隔开", required = true) - @NotNull(message = "规格值数组, 以逗号隔开不能为空") - private String attrs; + @ApiModelProperty(value = "规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]", required = true) + @NotNull(message = "规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]不能为空") + private String properties; @ApiModelProperty(value = "销售价格,单位:分", required = true) @NotNull(message = "销售价格,单位:分不能为空") @@ -43,4 +40,7 @@ public class SkuBaseVO { @NotNull(message = "图片地址不能为空") private String picUrl; + @ApiModelProperty(value = "状态: 0-正常 1-禁用") + private Integer status; + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExcelVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExcelVO.java index e9816b45e..60382739f 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExcelVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExcelVO.java @@ -17,17 +17,11 @@ public class SkuExcelVO { @ExcelProperty("主键") private Integer id; - @ExcelProperty("创建时间") - private Date createTime; - @ExcelProperty("spu编号") - private Integer spuId; + private Long spuId; - @ExcelProperty("状态: 1-正常 2-禁用") - private Integer skuStatus; - - @ExcelProperty("规格值数组, 以逗号隔开") - private String attrs; + @ExcelProperty("规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]") + private String properties; @ExcelProperty("销售价格,单位:分") private Integer price; @@ -44,4 +38,10 @@ public class SkuExcelVO { @ExcelProperty("图片地址") private String picUrl; + @ExcelProperty("状态: 0-正常 1-禁用") + private Integer status; + + @ExcelProperty("创建时间") + private Date createTime; + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExportReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExportReqVO.java index 91e21b2b0..d934bc64e 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExportReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExportReqVO.java @@ -12,22 +12,11 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @Data public class SkuExportReqVO { - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; - @ApiModelProperty(value = "spu编号") - private Integer spuId; + private Long spuId; - @ApiModelProperty(value = "状态: 1-正常 2-禁用") - private Integer skuStatus; - - @ApiModelProperty(value = "规格值数组, 以逗号隔开") - private String attrs; + @ApiModelProperty(value = "规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]") + private String properties; @ApiModelProperty(value = "销售价格,单位:分") private Integer price; @@ -44,4 +33,15 @@ public class SkuExportReqVO { @ApiModelProperty(value = "图片地址") private String picUrl; + @ApiModelProperty(value = "状态: 0-正常 1-禁用") + private Integer status; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始创建时间") + private Date beginCreateTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束创建时间") + private Date endCreateTime; + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuPageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuPageReqVO.java index 2d502bfb6..5536240aa 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuPageReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuPageReqVO.java @@ -14,22 +14,11 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @ToString(callSuper = true) public class SkuPageReqVO extends PageParam { - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; - @ApiModelProperty(value = "spu编号") - private Integer spuId; + private Long spuId; - @ApiModelProperty(value = "状态: 1-正常 2-禁用") - private Integer skuStatus; - - @ApiModelProperty(value = "规格值数组, 以逗号隔开") - private String attrs; + @ApiModelProperty(value = "规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]") + private String properties; @ApiModelProperty(value = "销售价格,单位:分") private Integer price; @@ -46,4 +35,15 @@ public class SkuPageReqVO extends PageParam { @ApiModelProperty(value = "图片地址") private String picUrl; + @ApiModelProperty(value = "状态: 0-正常 1-禁用") + private Integer status; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始创建时间") + private Date beginCreateTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束创建时间") + private Date endCreateTime; + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuBaseVO.java index d781bedd8..442fd34ba 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuBaseVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuBaseVO.java @@ -15,9 +15,6 @@ public class SpuBaseVO { @ApiModelProperty(value = "商品名称") private String name; - @ApiModelProperty(value = "上下架状态: true 上架,false 下架") - private Boolean visible; - @ApiModelProperty(value = "卖点", required = true) @NotNull(message = "卖点不能为空") private String sellPoint; @@ -28,13 +25,10 @@ public class SpuBaseVO { @ApiModelProperty(value = "分类id", required = true) @NotNull(message = "分类id不能为空") - private Integer cid; + private Long categoryId; - @ApiModelProperty(value = "列表图") - private String listPicUrl; - - @ApiModelProperty(value = "商品主图地址, 数组,以逗号分隔, 最多上传15张", required = true) - @NotNull(message = "商品主图地址, 数组,以逗号分隔, 最多上传15张不能为空") + @ApiModelProperty(value = "商品主图地址,* 数组,以逗号分隔,最多上传15张", required = true) + @NotNull(message = "商品主图地址,* 数组,以逗号分隔,最多上传15张不能为空") private String picUrls; @ApiModelProperty(value = "排序字段", required = true) @@ -44,10 +38,13 @@ public class SpuBaseVO { @ApiModelProperty(value = "点赞初始人数") private Integer likeCount; - @ApiModelProperty(value = "价格") + @ApiModelProperty(value = "价格 单位使用:分") private Integer price; @ApiModelProperty(value = "库存数量") private Integer quantity; + @ApiModelProperty(value = "上下架状态: 0 上架(开启) 1 下架(禁用)") + private Boolean status; + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExcelVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExcelVO.java index ca4b08b93..3a8816111 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExcelVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExcelVO.java @@ -17,15 +17,9 @@ public class SpuExcelVO { @ExcelProperty("主键") private Integer id; - @ExcelProperty("创建时间") - private Date createTime; - @ExcelProperty("商品名称") private String name; - @ExcelProperty("上下架状态: true 上架,false 下架") - private Boolean visible; - @ExcelProperty("卖点") private String sellPoint; @@ -33,12 +27,9 @@ public class SpuExcelVO { private String description; @ExcelProperty("分类id") - private Integer cid; + private Long categoryId; - @ExcelProperty("列表图") - private String listPicUrl; - - @ExcelProperty("商品主图地址, 数组,以逗号分隔, 最多上传15张") + @ExcelProperty("商品主图地址,* 数组,以逗号分隔,最多上传15张") private String picUrls; @ExcelProperty("排序字段") @@ -47,10 +38,16 @@ public class SpuExcelVO { @ExcelProperty("点赞初始人数") private Integer likeCount; - @ExcelProperty("价格") + @ExcelProperty("价格 单位使用:分") private Integer price; @ExcelProperty("库存数量") private Integer quantity; + @ExcelProperty("上下架状态: 0 上架(开启) 1 下架(禁用)") + private Boolean status; + + @ExcelProperty("创建时间") + private Date createTime; + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExportReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExportReqVO.java index 9b3665d48..93e390510 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExportReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExportReqVO.java @@ -12,20 +12,9 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @Data public class SpuExportReqVO { - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; - @ApiModelProperty(value = "商品名称") private String name; - @ApiModelProperty(value = "上下架状态: true 上架,false 下架") - private Boolean visible; - @ApiModelProperty(value = "卖点") private String sellPoint; @@ -33,12 +22,9 @@ public class SpuExportReqVO { private String description; @ApiModelProperty(value = "分类id") - private Integer cid; + private Long categoryId; - @ApiModelProperty(value = "列表图") - private String listPicUrl; - - @ApiModelProperty(value = "商品主图地址, 数组,以逗号分隔, 最多上传15张") + @ApiModelProperty(value = "商品主图地址,* 数组,以逗号分隔,最多上传15张") private String picUrls; @ApiModelProperty(value = "排序字段") @@ -47,10 +33,21 @@ public class SpuExportReqVO { @ApiModelProperty(value = "点赞初始人数") private Integer likeCount; - @ApiModelProperty(value = "价格") + @ApiModelProperty(value = "价格 单位使用:分") private Integer price; @ApiModelProperty(value = "库存数量") private Integer quantity; + @ApiModelProperty(value = "上下架状态: 0 上架(开启) 1 下架(禁用)") + private Boolean status; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始创建时间") + private Date beginCreateTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束创建时间") + private Date endCreateTime; + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuPageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuPageReqVO.java index 0323f7c11..59337a242 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuPageReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuPageReqVO.java @@ -14,20 +14,9 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @ToString(callSuper = true) public class SpuPageReqVO extends PageParam { - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; - @ApiModelProperty(value = "商品名称") private String name; - @ApiModelProperty(value = "上下架状态: true 上架,false 下架") - private Boolean visible; - @ApiModelProperty(value = "卖点") private String sellPoint; @@ -35,12 +24,9 @@ public class SpuPageReqVO extends PageParam { private String description; @ApiModelProperty(value = "分类id") - private Integer cid; + private Long categoryId; - @ApiModelProperty(value = "列表图") - private String listPicUrl; - - @ApiModelProperty(value = "商品主图地址, 数组,以逗号分隔, 最多上传15张") + @ApiModelProperty(value = "商品主图地址,* 数组,以逗号分隔,最多上传15张") private String picUrls; @ApiModelProperty(value = "排序字段") @@ -49,10 +35,21 @@ public class SpuPageReqVO extends PageParam { @ApiModelProperty(value = "点赞初始人数") private Integer likeCount; - @ApiModelProperty(value = "价格") + @ApiModelProperty(value = "价格 单位使用:分") private Integer price; @ApiModelProperty(value = "库存数量") private Integer quantity; + @ApiModelProperty(value = "上下架状态: 0 上架(开启) 1 下架(禁用)") + private Boolean status; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始创建时间") + private Date beginCreateTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束创建时间") + private Date endCreateTime; + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/attrkey/AttrKeyConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/attrkey/AttrKeyConvert.java deleted file mode 100755 index 28d87d138..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/attrkey/AttrKeyConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.yudao.module.product.convert.attrkey; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; -import cn.iocoder.yudao.module.product.controller.admin.attrkey.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.attrkey.AttrKeyDO; - -/** - * 规格名称 Convert - * - * @author 芋道源码 - */ -@Mapper -public interface AttrKeyConvert { - - AttrKeyConvert INSTANCE = Mappers.getMapper(AttrKeyConvert.class); - - AttrKeyDO convert(AttrKeyCreateReqVO bean); - - AttrKeyDO convert(AttrKeyUpdateReqVO bean); - - AttrKeyRespVO convert(AttrKeyDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/attrvalue/AttrValueConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/attrvalue/AttrValueConvert.java deleted file mode 100755 index 0414546d4..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/attrvalue/AttrValueConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.yudao.module.product.convert.attrvalue; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; -import cn.iocoder.yudao.module.product.controller.admin.attrvalue.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.attrvalue.AttrValueDO; - -/** - * 规格值 Convert - * - * @author 芋道源码 - */ -@Mapper -public interface AttrValueConvert { - - AttrValueConvert INSTANCE = Mappers.getMapper(AttrValueConvert.class); - - AttrValueDO convert(AttrValueCreateReqVO bean); - - AttrValueDO convert(AttrValueUpdateReqVO bean); - - AttrValueRespVO convert(AttrValueDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/PropertyConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/PropertyConvert.java new file mode 100755 index 000000000..520d7235e --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/PropertyConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.product.convert.property; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import cn.iocoder.yudao.module.product.controller.admin.property.vo.*; +import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO; + +/** + * 规格名称 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface PropertyConvert { + + PropertyConvert INSTANCE = Mappers.getMapper(PropertyConvert.class); + + PropertyDO convert(PropertyCreateReqVO bean); + + PropertyDO convert(PropertyUpdateReqVO bean); + + PropertyRespVO convert(PropertyDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/PropertyValueConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/PropertyValueConvert.java new file mode 100755 index 000000000..58ec93069 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/PropertyValueConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.product.convert.propertyvalue; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*; +import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValueDO; + +/** + * 规格值 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface PropertyValueConvert { + + PropertyValueConvert INSTANCE = Mappers.getMapper(PropertyValueConvert.class); + + PropertyValueDO convert(PropertyValueCreateReqVO bean); + + PropertyValueDO convert(PropertyValueUpdateReqVO bean); + + PropertyValueRespVO convert(PropertyValueDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/SkuDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/SkuDO.java index 6a8e096c2..3c0e32824 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/SkuDO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/SkuDO.java @@ -28,15 +28,11 @@ public class SkuDO extends BaseDO { /** * spu编号 */ - private Integer spuId; + private Long spuId; /** - * 状态: 1-正常 2-禁用 + * 规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }] */ - private Integer skuStatus; - /** - * 规格值数组, 以逗号隔开 - */ - private String attrs; + private String properties; /** * 销售价格,单位:分 */ @@ -57,5 +53,9 @@ public class SkuDO extends BaseDO { * 图片地址 */ private String picUrl; + /** + * 状态: 0-正常 1-禁用 + */ + private Integer status; } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/SpuDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/SpuDO.java index d66a7cdb0..b534e70e6 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/SpuDO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/SpuDO.java @@ -29,10 +29,6 @@ public class SpuDO extends BaseDO { * 商品名称 */ private String name; - /** - * 上下架状态: true 上架,false 下架 - */ - private Boolean visible; /** * 卖点 */ @@ -44,13 +40,9 @@ public class SpuDO extends BaseDO { /** * 分类id */ - private Integer cid; + private Long categoryId; /** - * 列表图 - */ - private String listPicUrl; - /** - * 商品主图地址, 数组,以逗号分隔, 最多上传15张 + * 商品主图地址,* 数组,以逗号分隔,最多上传15张 */ private String picUrls; /** @@ -62,12 +54,16 @@ public class SpuDO extends BaseDO { */ private Integer likeCount; /** - * 价格 + * 价格 单位使用:分 */ private Integer price; /** * 库存数量 */ private Integer quantity; + /** + * 上下架状态: 0 上架(开启) 1 下架(禁用) + */ + private Boolean status; } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/attrkey/AttrKeyMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/attrkey/AttrKeyMapper.java deleted file mode 100755 index 7df806d4b..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/attrkey/AttrKeyMapper.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.yudao.module.product.dal.mysql.attrkey; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.product.dal.dataobject.attrkey.AttrKeyDO; -import org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.product.controller.admin.attrkey.vo.*; - -/** - * 规格名称 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface AttrKeyMapper extends BaseMapperX { - - default PageResult selectPage(AttrKeyPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .betweenIfPresent(AttrKeyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .likeIfPresent(AttrKeyDO::getAttrName, reqVO.getAttrName()) - .eqIfPresent(AttrKeyDO::getStatus, reqVO.getStatus()) - .orderByDesc(AttrKeyDO::getId)); - } - - default List selectList(AttrKeyExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .betweenIfPresent(AttrKeyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .likeIfPresent(AttrKeyDO::getAttrName, reqVO.getAttrName()) - .eqIfPresent(AttrKeyDO::getStatus, reqVO.getStatus()) - .orderByDesc(AttrKeyDO::getId)); - } - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/attrvalue/AttrValueMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/attrvalue/AttrValueMapper.java deleted file mode 100755 index d29f47069..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/attrvalue/AttrValueMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.iocoder.yudao.module.product.dal.mysql.attrvalue; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.product.dal.dataobject.attrvalue.AttrValueDO; -import org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.product.controller.admin.attrvalue.vo.*; - -/** - * 规格值 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface AttrValueMapper extends BaseMapperX { - - default PageResult selectPage(AttrValuePageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .betweenIfPresent(AttrValueDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .eqIfPresent(AttrValueDO::getAttrKeyId, reqVO.getAttrKeyId()) - .likeIfPresent(AttrValueDO::getAttrValueName, reqVO.getAttrValueName()) - .eqIfPresent(AttrValueDO::getStatus, reqVO.getStatus()) - .orderByDesc(AttrValueDO::getId)); - } - - default List selectList(AttrValueExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .betweenIfPresent(AttrValueDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .eqIfPresent(AttrValueDO::getAttrKeyId, reqVO.getAttrKeyId()) - .likeIfPresent(AttrValueDO::getAttrValueName, reqVO.getAttrValueName()) - .eqIfPresent(AttrValueDO::getStatus, reqVO.getStatus()) - .orderByDesc(AttrValueDO::getId)); - } - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/PropertyMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/PropertyMapper.java new file mode 100755 index 000000000..3adb3cb1f --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/PropertyMapper.java @@ -0,0 +1,36 @@ +package cn.iocoder.yudao.module.product.dal.mysql.property; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.product.controller.admin.property.vo.*; + +/** + * 规格名称 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface PropertyMapper extends BaseMapperX { + + default PageResult selectPage(PropertyPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(PropertyDO::getName, reqVO.getName()) + .eqIfPresent(PropertyDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(PropertyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc(PropertyDO::getId)); + } + + default List selectList(PropertyExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(PropertyDO::getName, reqVO.getName()) + .eqIfPresent(PropertyDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(PropertyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc(PropertyDO::getId)); + } + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/propertyvalue/PropertyValueMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/propertyvalue/PropertyValueMapper.java new file mode 100755 index 000000000..305541783 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/propertyvalue/PropertyValueMapper.java @@ -0,0 +1,38 @@ +package cn.iocoder.yudao.module.product.dal.mysql.propertyvalue; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValueDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*; + +/** + * 规格值 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface PropertyValueMapper extends BaseMapperX { + + default PageResult selectPage(PropertyValuePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(PropertyValueDO::getPropertyId, reqVO.getPropertyId()) + .likeIfPresent(PropertyValueDO::getName, reqVO.getName()) + .eqIfPresent(PropertyValueDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(PropertyValueDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc(PropertyValueDO::getId)); + } + + default List selectList(PropertyValueExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(PropertyValueDO::getPropertyId, reqVO.getPropertyId()) + .likeIfPresent(PropertyValueDO::getName, reqVO.getName()) + .eqIfPresent(PropertyValueDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(PropertyValueDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc(PropertyValueDO::getId)); + } + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/SkuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/SkuMapper.java index a3d35cdc1..15b2468eb 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/SkuMapper.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/SkuMapper.java @@ -19,29 +19,29 @@ public interface SkuMapper extends BaseMapperX { default PageResult selectPage(SkuPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() - .betweenIfPresent(SkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) .eqIfPresent(SkuDO::getSpuId, reqVO.getSpuId()) - .eqIfPresent(SkuDO::getSkuStatus, reqVO.getSkuStatus()) - .eqIfPresent(SkuDO::getAttrs, reqVO.getAttrs()) + .eqIfPresent(SkuDO::getProperties, reqVO.getProperties()) .eqIfPresent(SkuDO::getPrice, reqVO.getPrice()) .eqIfPresent(SkuDO::getOriginalPrice, reqVO.getOriginalPrice()) .eqIfPresent(SkuDO::getCostPrice, reqVO.getCostPrice()) .eqIfPresent(SkuDO::getBarCode, reqVO.getBarCode()) .eqIfPresent(SkuDO::getPicUrl, reqVO.getPicUrl()) + .eqIfPresent(SkuDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(SkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) .orderByDesc(SkuDO::getId)); } default List selectList(SkuExportReqVO reqVO) { return selectList(new LambdaQueryWrapperX() - .betweenIfPresent(SkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) .eqIfPresent(SkuDO::getSpuId, reqVO.getSpuId()) - .eqIfPresent(SkuDO::getSkuStatus, reqVO.getSkuStatus()) - .eqIfPresent(SkuDO::getAttrs, reqVO.getAttrs()) + .eqIfPresent(SkuDO::getProperties, reqVO.getProperties()) .eqIfPresent(SkuDO::getPrice, reqVO.getPrice()) .eqIfPresent(SkuDO::getOriginalPrice, reqVO.getOriginalPrice()) .eqIfPresent(SkuDO::getCostPrice, reqVO.getCostPrice()) .eqIfPresent(SkuDO::getBarCode, reqVO.getBarCode()) .eqIfPresent(SkuDO::getPicUrl, reqVO.getPicUrl()) + .eqIfPresent(SkuDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(SkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) .orderByDesc(SkuDO::getId)); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/SpuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/SpuMapper.java index 5fabf5284..932e68f34 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/SpuMapper.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/SpuMapper.java @@ -19,35 +19,33 @@ public interface SpuMapper extends BaseMapperX { default PageResult selectPage(SpuPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() - .betweenIfPresent(SpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) .likeIfPresent(SpuDO::getName, reqVO.getName()) - .eqIfPresent(SpuDO::getVisible, reqVO.getVisible()) .eqIfPresent(SpuDO::getSellPoint, reqVO.getSellPoint()) .eqIfPresent(SpuDO::getDescription, reqVO.getDescription()) - .eqIfPresent(SpuDO::getCid, reqVO.getCid()) - .eqIfPresent(SpuDO::getListPicUrl, reqVO.getListPicUrl()) + .eqIfPresent(SpuDO::getCategoryId, reqVO.getCategoryId()) .eqIfPresent(SpuDO::getPicUrls, reqVO.getPicUrls()) .eqIfPresent(SpuDO::getSort, reqVO.getSort()) .eqIfPresent(SpuDO::getLikeCount, reqVO.getLikeCount()) .eqIfPresent(SpuDO::getPrice, reqVO.getPrice()) .eqIfPresent(SpuDO::getQuantity, reqVO.getQuantity()) + .eqIfPresent(SpuDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(SpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) .orderByDesc(SpuDO::getId)); } default List selectList(SpuExportReqVO reqVO) { return selectList(new LambdaQueryWrapperX() - .betweenIfPresent(SpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) .likeIfPresent(SpuDO::getName, reqVO.getName()) - .eqIfPresent(SpuDO::getVisible, reqVO.getVisible()) .eqIfPresent(SpuDO::getSellPoint, reqVO.getSellPoint()) .eqIfPresent(SpuDO::getDescription, reqVO.getDescription()) - .eqIfPresent(SpuDO::getCid, reqVO.getCid()) - .eqIfPresent(SpuDO::getListPicUrl, reqVO.getListPicUrl()) + .eqIfPresent(SpuDO::getCategoryId, reqVO.getCategoryId()) .eqIfPresent(SpuDO::getPicUrls, reqVO.getPicUrls()) .eqIfPresent(SpuDO::getSort, reqVO.getSort()) .eqIfPresent(SpuDO::getLikeCount, reqVO.getLikeCount()) .eqIfPresent(SpuDO::getPrice, reqVO.getPrice()) .eqIfPresent(SpuDO::getQuantity, reqVO.getQuantity()) + .eqIfPresent(SpuDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(SpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) .orderByDesc(SpuDO::getId)); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/attrkey/AttrKeyServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/attrkey/AttrKeyServiceImpl.java deleted file mode 100755 index cae54d836..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/attrkey/AttrKeyServiceImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -package cn.iocoder.yudao.module.product.service.attrkey; - -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; - -import java.util.*; -import cn.iocoder.yudao.module.product.controller.admin.attrkey.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.attrkey.AttrKeyDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import cn.iocoder.yudao.module.product.convert.attrkey.AttrKeyConvert; -import cn.iocoder.yudao.module.product.dal.mysql.attrkey.AttrKeyMapper; - -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; - -/** - * 规格名称 Service 实现类 - * - * @author 芋道源码 - */ -@Service -@Validated -public class AttrKeyServiceImpl implements AttrKeyService { - - @Resource - private AttrKeyMapper attrKeyMapper; - - @Override - public Integer createAttrKey(AttrKeyCreateReqVO createReqVO) { - // 插入 - AttrKeyDO attrKey = AttrKeyConvert.INSTANCE.convert(createReqVO); - attrKeyMapper.insert(attrKey); - // 返回 - return attrKey.getId(); - } - - @Override - public void updateAttrKey(AttrKeyUpdateReqVO updateReqVO) { - // 校验存在 - this.validateAttrKeyExists(updateReqVO.getId()); - // 更新 - AttrKeyDO updateObj = AttrKeyConvert.INSTANCE.convert(updateReqVO); - attrKeyMapper.updateById(updateObj); - } - - @Override - public void deleteAttrKey(Integer id) { - // 校验存在 - this.validateAttrKeyExists(id); - // 删除 - attrKeyMapper.deleteById(id); - } - - private void validateAttrKeyExists(Integer id) { - if (attrKeyMapper.selectById(id) == null) { - throw exception(ATTR_KEY_NOT_EXISTS); - } - } - - @Override - public AttrKeyDO getAttrKey(Integer id) { - return attrKeyMapper.selectById(id); - } - - @Override - public List getAttrKeyList(Collection ids) { - return attrKeyMapper.selectBatchIds(ids); - } - - @Override - public PageResult getAttrKeyPage(AttrKeyPageReqVO pageReqVO) { - return attrKeyMapper.selectPage(pageReqVO); - } - - @Override - public List getAttrKeyList(AttrKeyExportReqVO exportReqVO) { - return attrKeyMapper.selectList(exportReqVO); - } - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/attrvalue/AttrValueServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/attrvalue/AttrValueServiceImpl.java deleted file mode 100755 index 197dcbe19..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/attrvalue/AttrValueServiceImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -package cn.iocoder.yudao.module.product.service.attrvalue; - -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; - -import java.util.*; -import cn.iocoder.yudao.module.product.controller.admin.attrvalue.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.attrvalue.AttrValueDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import cn.iocoder.yudao.module.product.convert.attrvalue.AttrValueConvert; -import cn.iocoder.yudao.module.product.dal.mysql.attrvalue.AttrValueMapper; - -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; - -/** - * 规格值 Service 实现类 - * - * @author 芋道源码 - */ -@Service -@Validated -public class AttrValueServiceImpl implements AttrValueService { - - @Resource - private AttrValueMapper attrValueMapper; - - @Override - public Integer createAttrValue(AttrValueCreateReqVO createReqVO) { - // 插入 - AttrValueDO attrValue = AttrValueConvert.INSTANCE.convert(createReqVO); - attrValueMapper.insert(attrValue); - // 返回 - return attrValue.getId(); - } - - @Override - public void updateAttrValue(AttrValueUpdateReqVO updateReqVO) { - // 校验存在 - this.validateAttrValueExists(updateReqVO.getId()); - // 更新 - AttrValueDO updateObj = AttrValueConvert.INSTANCE.convert(updateReqVO); - attrValueMapper.updateById(updateObj); - } - - @Override - public void deleteAttrValue(Integer id) { - // 校验存在 - this.validateAttrValueExists(id); - // 删除 - attrValueMapper.deleteById(id); - } - - private void validateAttrValueExists(Integer id) { - if (attrValueMapper.selectById(id) == null) { - throw exception(ATTR_VALUE_NOT_EXISTS); - } - } - - @Override - public AttrValueDO getAttrValue(Integer id) { - return attrValueMapper.selectById(id); - } - - @Override - public List getAttrValueList(Collection ids) { - return attrValueMapper.selectBatchIds(ids); - } - - @Override - public PageResult getAttrValuePage(AttrValuePageReqVO pageReqVO) { - return attrValueMapper.selectPage(pageReqVO); - } - - @Override - public List getAttrValueList(AttrValueExportReqVO exportReqVO) { - return attrValueMapper.selectList(exportReqVO); - } - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/attrkey/AttrKeyService.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/PropertyService.java similarity index 59% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/attrkey/AttrKeyService.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/PropertyService.java index 09fe3c9f5..e1e372a83 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/attrkey/AttrKeyService.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/PropertyService.java @@ -1,9 +1,9 @@ -package cn.iocoder.yudao.module.product.service.attrkey; +package cn.iocoder.yudao.module.product.service.property; import java.util.*; import javax.validation.*; -import cn.iocoder.yudao.module.product.controller.admin.attrkey.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.attrkey.AttrKeyDO; +import cn.iocoder.yudao.module.product.controller.admin.property.vo.*; +import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; /** @@ -11,7 +11,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; * * @author 芋道源码 */ -public interface AttrKeyService { +public interface PropertyService { /** * 创建规格名称 @@ -19,21 +19,21 @@ public interface AttrKeyService { * @param createReqVO 创建信息 * @return 编号 */ - Integer createAttrKey(@Valid AttrKeyCreateReqVO createReqVO); + Long createProperty(@Valid PropertyCreateReqVO createReqVO); /** * 更新规格名称 * * @param updateReqVO 更新信息 */ - void updateAttrKey(@Valid AttrKeyUpdateReqVO updateReqVO); + void updateProperty(@Valid PropertyUpdateReqVO updateReqVO); /** * 删除规格名称 * * @param id 编号 */ - void deleteAttrKey(Integer id); + void deleteProperty(Long id); /** * 获得规格名称 @@ -41,7 +41,7 @@ public interface AttrKeyService { * @param id 编号 * @return 规格名称 */ - AttrKeyDO getAttrKey(Integer id); + PropertyDO getProperty(Long id); /** * 获得规格名称列表 @@ -49,7 +49,7 @@ public interface AttrKeyService { * @param ids 编号 * @return 规格名称列表 */ - List getAttrKeyList(Collection ids); + List getPropertyList(Collection ids); /** * 获得规格名称分页 @@ -57,7 +57,7 @@ public interface AttrKeyService { * @param pageReqVO 分页查询 * @return 规格名称分页 */ - PageResult getAttrKeyPage(AttrKeyPageReqVO pageReqVO); + PageResult getPropertyPage(PropertyPageReqVO pageReqVO); /** * 获得规格名称列表, 用于 Excel 导出 @@ -65,6 +65,6 @@ public interface AttrKeyService { * @param exportReqVO 查询条件 * @return 规格名称列表 */ - List getAttrKeyList(AttrKeyExportReqVO exportReqVO); + List getPropertyList(PropertyExportReqVO exportReqVO); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/PropertyServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/PropertyServiceImpl.java new file mode 100755 index 000000000..97ad86cdb --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/PropertyServiceImpl.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.product.service.property; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import cn.iocoder.yudao.module.product.controller.admin.property.vo.*; +import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.product.convert.property.PropertyConvert; +import cn.iocoder.yudao.module.product.dal.mysql.property.PropertyMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; + +/** + * 规格名称 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class PropertyServiceImpl implements PropertyService { + + @Resource + private PropertyMapper propertyMapper; + + @Override + public Long createProperty(PropertyCreateReqVO createReqVO) { + // 插入 + PropertyDO property = PropertyConvert.INSTANCE.convert(createReqVO); + propertyMapper.insert(property); + // 返回 + return property.getId(); + } + + @Override + public void updateProperty(PropertyUpdateReqVO updateReqVO) { + // 校验存在 + this.validatePropertyExists(updateReqVO.getId()); + // 更新 + PropertyDO updateObj = PropertyConvert.INSTANCE.convert(updateReqVO); + propertyMapper.updateById(updateObj); + } + + @Override + public void deleteProperty(Long id) { + // 校验存在 + this.validatePropertyExists(id); + // 删除 + propertyMapper.deleteById(id); + } + + private void validatePropertyExists(Long id) { + if (propertyMapper.selectById(id) == null) { + throw exception(PROPERTY_NOT_EXISTS); + } + } + + @Override + public PropertyDO getProperty(Long id) { + return propertyMapper.selectById(id); + } + + @Override + public List getPropertyList(Collection ids) { + return propertyMapper.selectBatchIds(ids); + } + + @Override + public PageResult getPropertyPage(PropertyPageReqVO pageReqVO) { + return propertyMapper.selectPage(pageReqVO); + } + + @Override + public List getPropertyList(PropertyExportReqVO exportReqVO) { + return propertyMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/attrvalue/AttrValueService.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/PropertyValueService.java similarity index 54% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/attrvalue/AttrValueService.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/PropertyValueService.java index cf5f52b91..0e04e4bd9 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/attrvalue/AttrValueService.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/PropertyValueService.java @@ -1,9 +1,9 @@ -package cn.iocoder.yudao.module.product.service.attrvalue; +package cn.iocoder.yudao.module.product.service.propertyvalue; import java.util.*; import javax.validation.*; -import cn.iocoder.yudao.module.product.controller.admin.attrvalue.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.attrvalue.AttrValueDO; +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*; +import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValueDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; /** @@ -11,7 +11,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; * * @author 芋道源码 */ -public interface AttrValueService { +public interface PropertyValueService { /** * 创建规格值 @@ -19,21 +19,21 @@ public interface AttrValueService { * @param createReqVO 创建信息 * @return 编号 */ - Integer createAttrValue(@Valid AttrValueCreateReqVO createReqVO); + Integer createPropertyValue(@Valid PropertyValueCreateReqVO createReqVO); /** * 更新规格值 * * @param updateReqVO 更新信息 */ - void updateAttrValue(@Valid AttrValueUpdateReqVO updateReqVO); + void updatePropertyValue(@Valid PropertyValueUpdateReqVO updateReqVO); /** * 删除规格值 * * @param id 编号 */ - void deleteAttrValue(Integer id); + void deletePropertyValue(Integer id); /** * 获得规格值 @@ -41,7 +41,7 @@ public interface AttrValueService { * @param id 编号 * @return 规格值 */ - AttrValueDO getAttrValue(Integer id); + PropertyValueDO getPropertyValue(Integer id); /** * 获得规格值列表 @@ -49,7 +49,7 @@ public interface AttrValueService { * @param ids 编号 * @return 规格值列表 */ - List getAttrValueList(Collection ids); + List getPropertyValueList(Collection ids); /** * 获得规格值分页 @@ -57,7 +57,7 @@ public interface AttrValueService { * @param pageReqVO 分页查询 * @return 规格值分页 */ - PageResult getAttrValuePage(AttrValuePageReqVO pageReqVO); + PageResult getPropertyValuePage(PropertyValuePageReqVO pageReqVO); /** * 获得规格值列表, 用于 Excel 导出 @@ -65,6 +65,6 @@ public interface AttrValueService { * @param exportReqVO 查询条件 * @return 规格值列表 */ - List getAttrValueList(AttrValueExportReqVO exportReqVO); + List getPropertyValueList(PropertyValueExportReqVO exportReqVO); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/PropertyValueServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/PropertyValueServiceImpl.java new file mode 100755 index 000000000..7c0a31cd4 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/PropertyValueServiceImpl.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.product.service.propertyvalue; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*; +import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValueDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.product.convert.propertyvalue.PropertyValueConvert; +import cn.iocoder.yudao.module.product.dal.mysql.propertyvalue.PropertyValueMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; + +/** + * 规格值 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class PropertyValueServiceImpl implements PropertyValueService { + + @Resource + private PropertyValueMapper propertyValueMapper; + + @Override + public Integer createPropertyValue(PropertyValueCreateReqVO createReqVO) { + // 插入 + PropertyValueDO propertyValue = PropertyValueConvert.INSTANCE.convert(createReqVO); + propertyValueMapper.insert(propertyValue); + // 返回 + return propertyValue.getId(); + } + + @Override + public void updatePropertyValue(PropertyValueUpdateReqVO updateReqVO) { + // 校验存在 + this.validatePropertyValueExists(updateReqVO.getId()); + // 更新 + PropertyValueDO updateObj = PropertyValueConvert.INSTANCE.convert(updateReqVO); + propertyValueMapper.updateById(updateObj); + } + + @Override + public void deletePropertyValue(Integer id) { + // 校验存在 + this.validatePropertyValueExists(id); + // 删除 + propertyValueMapper.deleteById(id); + } + + private void validatePropertyValueExists(Integer id) { + if (propertyValueMapper.selectById(id) == null) { + throw exception(PROPERTY_VALUE_NOT_EXISTS); + } + } + + @Override + public PropertyValueDO getPropertyValue(Integer id) { + return propertyValueMapper.selectById(id); + } + + @Override + public List getPropertyValueList(Collection ids) { + return propertyValueMapper.selectBatchIds(ids); + } + + @Override + public PageResult getPropertyValuePage(PropertyValuePageReqVO pageReqVO) { + return propertyValueMapper.selectPage(pageReqVO); + } + + @Override + public List getPropertyValueList(PropertyValueExportReqVO exportReqVO) { + return propertyValueMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/attrkey/AttrKeyServiceImplTest.java b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/attrkey/AttrKeyServiceImplTest.java deleted file mode 100755 index c32cc7462..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/attrkey/AttrKeyServiceImplTest.java +++ /dev/null @@ -1,168 +0,0 @@ -package cn.iocoder.yudao.module.product.service.attrkey; - -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.mock.mockito.MockBean; - -import javax.annotation.Resource; - -import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; - -import cn.iocoder.yudao.module.product.controller.admin.attrkey.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.attrkey.AttrKeyDO; -import cn.iocoder.yudao.module.product.dal.mysql.attrkey.AttrKeyMapper; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import javax.annotation.Resource; -import org.springframework.context.annotation.Import; -import java.util.*; - -import static cn.hutool.core.util.RandomUtil.*; -import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; -import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.*; - -/** -* {@link AttrKeyServiceImpl} 的单元测试类 -* -* @author 芋道源码 -*/ -@Import(AttrKeyServiceImpl.class) -public class AttrKeyServiceImplTest extends BaseDbUnitTest { - - @Resource - private AttrKeyServiceImpl attrKeyService; - - @Resource - private AttrKeyMapper attrKeyMapper; - - @Test - public void testCreateAttrKey_success() { - // 准备参数 - AttrKeyCreateReqVO reqVO = randomPojo(AttrKeyCreateReqVO.class); - - // 调用 - Integer attrKeyId = attrKeyService.createAttrKey(reqVO); - // 断言 - assertNotNull(attrKeyId); - // 校验记录的属性是否正确 - AttrKeyDO attrKey = attrKeyMapper.selectById(attrKeyId); - assertPojoEquals(reqVO, attrKey); - } - - @Test - public void testUpdateAttrKey_success() { - // mock 数据 - AttrKeyDO dbAttrKey = randomPojo(AttrKeyDO.class); - attrKeyMapper.insert(dbAttrKey);// @Sql: 先插入出一条存在的数据 - // 准备参数 - AttrKeyUpdateReqVO reqVO = randomPojo(AttrKeyUpdateReqVO.class, o -> { - o.setId(dbAttrKey.getId()); // 设置更新的 ID - }); - - // 调用 - attrKeyService.updateAttrKey(reqVO); - // 校验是否更新正确 - AttrKeyDO attrKey = attrKeyMapper.selectById(reqVO.getId()); // 获取最新的 - assertPojoEquals(reqVO, attrKey); - } - - @Test - public void testUpdateAttrKey_notExists() { - // 准备参数 - AttrKeyUpdateReqVO reqVO = randomPojo(AttrKeyUpdateReqVO.class); - - // 调用, 并断言异常 - assertServiceException(() -> attrKeyService.updateAttrKey(reqVO), ATTR_KEY_NOT_EXISTS); - } - - @Test - public void testDeleteAttrKey_success() { - // mock 数据 - AttrKeyDO dbAttrKey = randomPojo(AttrKeyDO.class); - attrKeyMapper.insert(dbAttrKey);// @Sql: 先插入出一条存在的数据 - // 准备参数 - Integer id = dbAttrKey.getId(); - - // 调用 - attrKeyService.deleteAttrKey(id); - // 校验数据不存在了 - assertNull(attrKeyMapper.selectById(id)); - } - - @Test - public void testDeleteAttrKey_notExists() { - // 准备参数 -// Integer id = randomIntegerId(); - Integer id = 1; - - // 调用, 并断言异常 - assertServiceException(() -> attrKeyService.deleteAttrKey(id), ATTR_KEY_NOT_EXISTS); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetAttrKeyPage() { - // mock 数据 - AttrKeyDO dbAttrKey = randomPojo(AttrKeyDO.class, o -> { // 等会查询到 - o.setCreateTime(null); - o.setAttrName(null); - o.setStatus(null); - }); - attrKeyMapper.insert(dbAttrKey); - // 测试 createTime 不匹配 - attrKeyMapper.insert(cloneIgnoreId(dbAttrKey, o -> o.setCreateTime(null))); - // 测试 attrName 不匹配 - attrKeyMapper.insert(cloneIgnoreId(dbAttrKey, o -> o.setAttrName(null))); - // 测试 status 不匹配 - attrKeyMapper.insert(cloneIgnoreId(dbAttrKey, o -> o.setStatus(null))); - // 准备参数 - AttrKeyPageReqVO reqVO = new AttrKeyPageReqVO(); - reqVO.setBeginCreateTime(null); - reqVO.setEndCreateTime(null); - reqVO.setAttrName(null); - reqVO.setStatus(null); - - // 调用 - PageResult pageResult = attrKeyService.getAttrKeyPage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbAttrKey, pageResult.getList().get(0)); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetAttrKeyList() { - // mock 数据 - AttrKeyDO dbAttrKey = randomPojo(AttrKeyDO.class, o -> { // 等会查询到 - o.setCreateTime(null); - o.setAttrName(null); - o.setStatus(null); - }); - attrKeyMapper.insert(dbAttrKey); - // 测试 createTime 不匹配 - attrKeyMapper.insert(cloneIgnoreId(dbAttrKey, o -> o.setCreateTime(null))); - // 测试 attrName 不匹配 - attrKeyMapper.insert(cloneIgnoreId(dbAttrKey, o -> o.setAttrName(null))); - // 测试 status 不匹配 - attrKeyMapper.insert(cloneIgnoreId(dbAttrKey, o -> o.setStatus(null))); - // 准备参数 - AttrKeyExportReqVO reqVO = new AttrKeyExportReqVO(); - reqVO.setBeginCreateTime(null); - reqVO.setEndCreateTime(null); - reqVO.setAttrName(null); - reqVO.setStatus(null); - - // 调用 - List list = attrKeyService.getAttrKeyList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbAttrKey, list.get(0)); - } - -}