From a4ca27d68c66c51a3c77645af5b51d0780047ff7 Mon Sep 17 00:00:00 2001 From: q2118cs Date: Mon, 11 May 2020 15:41:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E8=A7=84=E6=A0=BC=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- product/pom.xml | 1 + product/product-biz-api/pom.xml | 2 +- product/product-biz/pom.xml | 2 +- .../product/biz/bo/attr/ProductAttrBO.java | 9 +- .../biz/bo/attr/ProductAttrSimpleBO.java | 25 ++ .../bo/attr/ProductAttrSimpleWithValueBO.java | 18 ++ .../biz/bo/attr/ProductAttrValueBO.java | 4 + .../biz/bo/attr/ProductAttrValueSimpleBO.java | 24 ++ .../biz/bo/attr/ProductAttrWithValueBO.java | 18 ++ .../biz/convert/attr/ProductAttrConvert.java | 31 +- .../convert/product/ProductAttrConvert2.java | 58 ---- .../product/ProductAttrValueDO.java | 4 +- .../{product => attr}/ProductAttrAddDTO.java | 2 +- .../ProductAttrUpdateDTO.java | 2 +- .../ProductAttrValueAddDTO.java | 2 +- .../ProductAttrValueUpdateDTO.java | 2 +- .../biz/dto/product/ProductAttrPageDTO.java | 22 -- .../service/product/ProductAttrService.java | 43 ++- .../product/impl/ProductAttrServiceImpl.java | 304 +++++++++--------- product/product-rest/pom.xml | 2 +- .../admins/AdminsProductAttrController.java | 189 +++++------ .../rest/convert/attr/ProductAttrConvert.java | 28 +- .../request/attr/ProductAttrAddRequest.java | 20 ++ .../attr/ProductAttrUpdateRequest.java | 26 ++ .../attr/ProductAttrValueAddRequest.java | 27 ++ .../attr/ProductAttrValueUpdateRequest.java | 27 ++ .../attr/AdminsProductAttrSimpleResponse.java | 38 +++ .../response/attr/AdminsProductAttrVO.java | 24 ++ .../attr/AdminsProductAttrValueResponse.java | 26 ++ product/product-rpc-api/pom.xml | 2 +- product/product-rpc/pom.xml | 2 +- .../admins/AdminsProductAttrController.java | 3 +- .../admins/AdminsProductBrandController.java | 3 +- .../AdminsProductCategoryController.java | 3 +- .../admins/AdminsProductSpuController.java | 3 +- .../users/UserFavoriteController.java | 1 - 36 files changed, 622 insertions(+), 375 deletions(-) create mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrSimpleBO.java create mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrSimpleWithValueBO.java create mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrValueSimpleBO.java create mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrWithValueBO.java delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/product/ProductAttrConvert2.java rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/{product => attr}/ProductAttrAddDTO.java (86%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/{product => attr}/ProductAttrUpdateDTO.java (90%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/{product => attr}/ProductAttrValueAddDTO.java (90%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/{product => attr}/ProductAttrValueUpdateDTO.java (91%) delete mode 100644 product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrPageDTO.java create mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrAddRequest.java create mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrUpdateRequest.java create mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrValueAddRequest.java create mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrValueUpdateRequest.java create mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/attr/AdminsProductAttrSimpleResponse.java create mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/attr/AdminsProductAttrVO.java create mode 100644 product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/attr/AdminsProductAttrValueResponse.java diff --git a/product/pom.xml b/product/pom.xml index f4e48fe32..960d54248 100644 --- a/product/pom.xml +++ b/product/pom.xml @@ -12,6 +12,7 @@ product product pom + product-application product-rpc-api diff --git a/product/product-biz-api/pom.xml b/product/product-biz-api/pom.xml index 7c302c683..24925d7a7 100644 --- a/product/product-biz-api/pom.xml +++ b/product/product-biz-api/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - system + product cn.iocoder.mall 1.0-SNAPSHOT diff --git a/product/product-biz/pom.xml b/product/product-biz/pom.xml index 5fceb0b3b..1bb098eb3 100644 --- a/product/product-biz/pom.xml +++ b/product/product-biz/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - system + product cn.iocoder.mall 1.0-SNAPSHOT diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrBO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrBO.java index 855638bd7..5519c84e5 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrBO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrBO.java @@ -3,12 +3,12 @@ package cn.iocoder.mall.product.biz.bo.attr; import lombok.Data; import lombok.experimental.Accessors; +import java.io.Serializable; import java.util.Date; -import java.util.List; @Data @Accessors(chain = true) -public class ProductAttrBO { +public class ProductAttrBO implements Serializable { /** * 规格编号 @@ -26,8 +26,5 @@ public class ProductAttrBO { * 创建时间 */ private Date createTime; - /** - * 规格值数组 - */ - private List values; + } diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrSimpleBO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrSimpleBO.java new file mode 100644 index 000000000..c8b588b6c --- /dev/null +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrSimpleBO.java @@ -0,0 +1,25 @@ +package cn.iocoder.mall.product.biz.bo.attr; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 商品规格精简 VO + */ +@Data +@Accessors(chain = true) +public class ProductAttrSimpleBO implements Serializable { + + /** + * 规格编号 + */ + private Integer id; + /** + * 规格名 + */ + private String name; + + +} diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrSimpleWithValueBO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrSimpleWithValueBO.java new file mode 100644 index 000000000..8ace5c5c0 --- /dev/null +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrSimpleWithValueBO.java @@ -0,0 +1,18 @@ +package cn.iocoder.mall.product.biz.bo.attr; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.List; + +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +public class ProductAttrSimpleWithValueBO extends ProductAttrSimpleBO { + + /** + * 规格值数组 + */ + private List values; +} diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrValueBO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrValueBO.java index 1539b5030..50600fa6c 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrValueBO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrValueBO.java @@ -17,6 +17,10 @@ public class ProductAttrValueBO implements Serializable { * 规格值编号 */ private Integer id; + /** + * 规格编号 + */ + private Integer attrId; /** * 规格值名 */ diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrValueSimpleBO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrValueSimpleBO.java new file mode 100644 index 000000000..91d4db153 --- /dev/null +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrValueSimpleBO.java @@ -0,0 +1,24 @@ +package cn.iocoder.mall.product.biz.bo.attr; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 商品规格值 VO + */ +@Data +@Accessors(chain = true) +public class ProductAttrValueSimpleBO implements Serializable { + + /** + * 规格值编号 + */ + private Integer id; + /** + * 规格值名 + */ + private String name; + +} diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrWithValueBO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrWithValueBO.java new file mode 100644 index 000000000..b4fc489b4 --- /dev/null +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrWithValueBO.java @@ -0,0 +1,18 @@ +package cn.iocoder.mall.product.biz.bo.attr; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.List; + +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +public class ProductAttrWithValueBO extends ProductAttrBO { + + /** + * 规格值数组 + */ + private List values; +} diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/attr/ProductAttrConvert.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/attr/ProductAttrConvert.java index a32265009..fa047f97d 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/attr/ProductAttrConvert.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/attr/ProductAttrConvert.java @@ -1,10 +1,12 @@ package cn.iocoder.mall.product.biz.convert.attr; import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.product.biz.bo.attr.ProductAttrBO; -import cn.iocoder.mall.product.biz.bo.attr.ProductAttrValueBO; +import cn.iocoder.mall.product.biz.bo.attr.*; import cn.iocoder.mall.product.biz.dataobject.product.ProductAttrDO; import cn.iocoder.mall.product.biz.dataobject.product.ProductAttrValueDO; +import cn.iocoder.mall.product.biz.dto.attr.ProductAttrUpdateDTO; +import cn.iocoder.mall.product.biz.dto.attr.ProductAttrValueAddDTO; +import cn.iocoder.mall.product.biz.dto.attr.ProductAttrValueUpdateDTO; import com.baomidou.mybatisplus.core.metadata.IPage; import org.mapstruct.Mapper; import org.mapstruct.Mapping; @@ -19,8 +21,29 @@ public interface ProductAttrConvert { ProductAttrConvert INSTANCE = Mappers.getMapper(ProductAttrConvert.class); @Mapping(source = "records", target = "list") - PageResult convertPage(IPage bean); + PageResult convertPage(IPage bean); @Mappings({}) - List convertAttrValue(List values); + ProductAttrBO convertAttr(ProductAttrDO values); + + @Mappings({}) + ProductAttrValueBO convertAttrValue(ProductAttrValueDO productAttrValueDO); + + @Mappings({}) + List convertAttrValues(List values); + + @Mappings({}) + List convertAttrSimple(List attrs); + + @Mappings({}) + List convertAttrValueSimple(List values); + + @Mappings({}) + ProductAttrDO convertUpdate(ProductAttrUpdateDTO productAttrUpdateDTO); + + @Mappings({}) + ProductAttrValueDO convertValueAdd(ProductAttrValueAddDTO productAttrValueAddDTO); + + @Mappings({}) + ProductAttrValueDO convertValueUpdate(ProductAttrValueUpdateDTO productAttrValueUpdateDTO); } diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/product/ProductAttrConvert2.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/product/ProductAttrConvert2.java deleted file mode 100644 index df87e42ce..000000000 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/product/ProductAttrConvert2.java +++ /dev/null @@ -1,58 +0,0 @@ -package cn.iocoder.mall.product.biz.convert.product; - -import cn.iocoder.mall.product.biz.bo.product.*; -import cn.iocoder.mall.product.biz.dataobject.product.ProductAttrDO; -import cn.iocoder.mall.product.biz.dataobject.product.ProductAttrValueDO; -import cn.iocoder.mall.product.biz.dto.product.ProductAttrAddDTO; -import cn.iocoder.mall.product.biz.dto.product.ProductAttrUpdateDTO; -import cn.iocoder.mall.product.biz.dto.product.ProductAttrValueAddDTO; -import cn.iocoder.mall.product.biz.dto.product.ProductAttrValueUpdateDTO; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ProductAttrConvert2 { - - ProductAttrConvert2 INSTANCE = Mappers.getMapper(ProductAttrConvert2.class); - - @Mappings({}) - List convert(List attrs); - - @Mappings({}) - ProductAttrValueDetailBO convert(ProductAttrValueDO value); - - @Mappings({}) - List convert2(List values); - - @Mappings({}) - List convert3(List attrs); - - @Mappings({}) - ProductAttrValueSimpleBO convert3(ProductAttrValueDO value); // 保证 convert4 能够映射到这个方法 - - @Mappings({}) - List convert4(List values); - - @Mappings({}) - ProductAttrDO convert(ProductAttrAddDTO productAttrAddDTO); - - @Mappings({}) - ProductAttrDO convert(ProductAttrUpdateDTO productAttrUpdateDTO); - - @Mappings({}) - ProductAttrValueDO convert(ProductAttrValueAddDTO productAttrValueAddDTO); - - @Mappings({}) - ProductAttrValueDO convert(ProductAttrValueUpdateDTO productAttrValueUpdateDTO); - - @Mappings({}) - ProductAttrBO2 convert(ProductAttrDO productAttrDO); - - @Mappings({}) - ProductAttrValueBO convert2(ProductAttrValueDO productAttrValueDO); - - -} \ No newline at end of file diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductAttrValueDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductAttrValueDO.java index b4cef1862..2b44cf3c3 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductAttrValueDO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductAttrValueDO.java @@ -2,12 +2,14 @@ package cn.iocoder.mall.product.biz.dataobject.product; import cn.iocoder.mall.mybatis.dataobject.DeletableDO; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** * Product 规格值 */ @Data +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) public class ProductAttrValueDO extends DeletableDO { @@ -25,7 +27,7 @@ public class ProductAttrValueDO extends DeletableDO { private String name; /** * 状态 - * + *

* 1-正常 * 2-禁用 */ diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrAddDTO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/attr/ProductAttrAddDTO.java similarity index 86% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrAddDTO.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/attr/ProductAttrAddDTO.java index 870153fc4..ed3a64596 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrAddDTO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/attr/ProductAttrAddDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.dto.product; +package cn.iocoder.mall.product.biz.dto.attr; import lombok.Data; import lombok.experimental.Accessors; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrUpdateDTO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/attr/ProductAttrUpdateDTO.java similarity index 90% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrUpdateDTO.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/attr/ProductAttrUpdateDTO.java index 503e699ae..13fa35a18 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrUpdateDTO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/attr/ProductAttrUpdateDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.dto.product; +package cn.iocoder.mall.product.biz.dto.attr; import lombok.Data; import lombok.experimental.Accessors; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrValueAddDTO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/attr/ProductAttrValueAddDTO.java similarity index 90% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrValueAddDTO.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/attr/ProductAttrValueAddDTO.java index b7f4d8a73..aea837d1a 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrValueAddDTO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/attr/ProductAttrValueAddDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.dto.product; +package cn.iocoder.mall.product.biz.dto.attr; import lombok.Data; import lombok.experimental.Accessors; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrValueUpdateDTO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/attr/ProductAttrValueUpdateDTO.java similarity index 91% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrValueUpdateDTO.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/attr/ProductAttrValueUpdateDTO.java index a7ae3491d..8b5997772 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrValueUpdateDTO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/attr/ProductAttrValueUpdateDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.dto.product; +package cn.iocoder.mall.product.biz.dto.attr; import lombok.Data; import lombok.experimental.Accessors; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrPageDTO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrPageDTO.java deleted file mode 100644 index 49d4aaf68..000000000 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/product/ProductAttrPageDTO.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.mall.product.biz.dto.product; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; - -/** - * 商品规格分页 DTO - */ -@Data -@Accessors(chain = true) -public class ProductAttrPageDTO { - - private String name; - - @NotNull(message = "页码不能为空") - private Integer pageNo; - @NotNull(message = "每页条数不能为空") - private Integer pageSize; - -} diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductAttrService.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductAttrService.java index 36a34f4b7..1b81ac641 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductAttrService.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductAttrService.java @@ -4,14 +4,10 @@ import cn.iocoder.common.framework.constant.CommonStatusEnum; import cn.iocoder.common.framework.validator.InEnum; import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.product.biz.bo.attr.ProductAttrBO; -import cn.iocoder.mall.product.biz.bo.product.ProductAttrBO2; -import cn.iocoder.mall.product.biz.bo.product.ProductAttrSimpleBO; -import cn.iocoder.mall.product.biz.bo.product.ProductAttrValueBO; -import cn.iocoder.mall.product.biz.dto.attr.AdminProductAttrPageDTO; -import cn.iocoder.mall.product.biz.dto.product.ProductAttrAddDTO; -import cn.iocoder.mall.product.biz.dto.product.ProductAttrUpdateDTO; -import cn.iocoder.mall.product.biz.dto.product.ProductAttrValueAddDTO; -import cn.iocoder.mall.product.biz.dto.product.ProductAttrValueUpdateDTO; +import cn.iocoder.mall.product.biz.bo.attr.ProductAttrSimpleWithValueBO; +import cn.iocoder.mall.product.biz.bo.attr.ProductAttrValueBO; +import cn.iocoder.mall.product.biz.bo.attr.ProductAttrWithValueBO; +import cn.iocoder.mall.product.biz.dto.attr.*; import java.util.List; @@ -22,7 +18,7 @@ public interface ProductAttrService { * @param productAttrPageDTO 查询参数 * @return 规格分页信息 */ - PageResult getProductAttrPage(AdminProductAttrPageDTO productAttrPageDTO); + PageResult getProductAttrPage(AdminProductAttrPageDTO productAttrPageDTO); /** * 获得规格属性数组 @@ -31,14 +27,35 @@ public interface ProductAttrService { * * @return 规格属性数组 */ - List getProductAttrList(); + List getProductAttrList(); - ProductAttrBO2 addProductAttr(Integer adminId, ProductAttrAddDTO productAttrAddDTO); + /** + * 添加商品规格 + * + * @param adminId 操作人ID + * @param productAttrAddDTO 添加参数 + * @return 添加的规格 + */ + ProductAttrBO addProductAttr(Integer adminId, ProductAttrAddDTO productAttrAddDTO); + /** + * 更新规格 + * + * @param adminId 操作人 + * @param productAttrUpdateDTO 更新规格 + * @return 成功标识 + */ Boolean updateProductAttr(Integer adminId, ProductAttrUpdateDTO productAttrUpdateDTO); - Boolean updateProductAttrStatus(Integer adminId, Integer productAttrId, - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status); + /** + * 更新规格状态 + * + * @param adminId 操作人 + * @param productAttrId 规格ID + * @param status 状态 + * @return 成功标识 + */ + Boolean updateProductAttrStatus(Integer adminId, Integer productAttrId, Integer status); ProductAttrValueBO addProductAttrValue(Integer adminId, ProductAttrValueAddDTO productAttrValueAddDTO); diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductAttrServiceImpl.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductAttrServiceImpl.java index 3c40f8098..4199697c1 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductAttrServiceImpl.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductAttrServiceImpl.java @@ -5,21 +5,16 @@ import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; import cn.iocoder.mall.product.biz.bo.attr.ProductAttrBO; +import cn.iocoder.mall.product.biz.bo.attr.ProductAttrSimpleWithValueBO; +import cn.iocoder.mall.product.biz.bo.attr.ProductAttrValueBO; +import cn.iocoder.mall.product.biz.bo.attr.ProductAttrWithValueBO; import cn.iocoder.mall.product.biz.bo.product.ProductAttrAndValuePairBO; -import cn.iocoder.mall.product.biz.bo.product.ProductAttrBO2; -import cn.iocoder.mall.product.biz.bo.product.ProductAttrSimpleBO; -import cn.iocoder.mall.product.biz.bo.product.ProductAttrValueBO; import cn.iocoder.mall.product.biz.convert.attr.ProductAttrConvert; -import cn.iocoder.mall.product.biz.convert.product.ProductAttrConvert2; import cn.iocoder.mall.product.biz.dao.product.ProductAttrMapper; import cn.iocoder.mall.product.biz.dao.product.ProductAttrValueMapper; import cn.iocoder.mall.product.biz.dataobject.product.ProductAttrDO; import cn.iocoder.mall.product.biz.dataobject.product.ProductAttrValueDO; -import cn.iocoder.mall.product.biz.dto.attr.AdminProductAttrPageDTO; -import cn.iocoder.mall.product.biz.dto.product.ProductAttrAddDTO; -import cn.iocoder.mall.product.biz.dto.product.ProductAttrUpdateDTO; -import cn.iocoder.mall.product.biz.dto.product.ProductAttrValueAddDTO; -import cn.iocoder.mall.product.biz.dto.product.ProductAttrValueUpdateDTO; +import cn.iocoder.mall.product.biz.dto.attr.*; import cn.iocoder.mall.product.biz.enums.ProductErrorCodeEnum; import cn.iocoder.mall.product.biz.enums.product.ProductAttrConstants; import cn.iocoder.mall.product.biz.service.product.ProductAttrService; @@ -27,8 +22,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.google.common.collect.ImmutableListMultimap; -import com.google.common.collect.Multimaps; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -51,14 +44,14 @@ public class ProductAttrServiceImpl implements ProductAttrService { private ProductAttrValueMapper productAttrValueMapper; @Override - public PageResult getProductAttrPage(AdminProductAttrPageDTO productAttrPageDTO) { + public PageResult getProductAttrPage(AdminProductAttrPageDTO productAttrPageDTO) { //查询分页 Page page = new Page<>(productAttrPageDTO.getPageNo(), productAttrPageDTO.getPageSize()); LambdaQueryWrapper queryWrapper = Wrappers.query().lambda() .like(StringUtils.isNotBlank(productAttrPageDTO.getName()), ProductAttrDO::getName, productAttrPageDTO.getName()) .eq(ProductAttrDO::getDeleted, false); IPage attrPage = productAttrMapper.selectPage(page, queryWrapper); - PageResult productAttrPage = ProductAttrConvert.INSTANCE.convertPage(attrPage); + PageResult productAttrPage = ProductAttrConvert.INSTANCE.convertPage(attrPage); // 将规格值拼接上去 if (!CollectionUtil.isEmpty(productAttrPage.getList())) { Set attrIds = productAttrPage.getList().stream().map(ProductAttrBO::getId).collect(Collectors.toSet()); @@ -66,14 +59,151 @@ public class ProductAttrServiceImpl implements ProductAttrService { .in(ProductAttrValueDO::getAttrId, attrIds) .eq(ProductAttrValueDO::getDeleted, false)); Map> attrValueMap = attrValues.stream().collect(Collectors.groupingBy(ProductAttrValueDO::getAttrId)); - for (ProductAttrBO productAttrBO : productAttrPage.getList()) { - productAttrBO.setValues(ProductAttrConvert.INSTANCE.convertAttrValue(attrValueMap.get(productAttrBO.getId()))); + for (ProductAttrWithValueBO item : productAttrPage.getList()) { + item.setValues(ProductAttrConvert.INSTANCE.convertAttrValues(attrValueMap.get(item.getId()))); } } - // 返回结果 return productAttrPage; } + @Override + public List getProductAttrList() { + // 查询所有开启的规格数组 + List attrDos = productAttrMapper.selectList(Wrappers.query().lambda() + .in(ProductAttrDO::getStatus, ProductAttrConstants.ATTR_STATUS_ENABLE) + .eq(ProductAttrDO::getDeleted, false)); + // 如果为空,则返回空 + if (attrDos.isEmpty()) { + return Collections.emptyList(); + } + List attrs = ProductAttrConvert.INSTANCE.convertAttrSimple(attrDos); + // 将规格值拼接上去 + List attrValues = productAttrValueMapper.selectList(Wrappers.query().lambda() + .in(ProductAttrValueDO::getStatus, ProductAttrConstants.ATTR_STATUS_ENABLE) + .eq(ProductAttrValueDO::getDeleted, false)); + Map> attrValueMap = attrValues.stream().collect(Collectors.groupingBy(ProductAttrValueDO::getAttrId)); + for (ProductAttrSimpleWithValueBO item : attrs) { + item.setValues(ProductAttrConvert.INSTANCE.convertAttrValueSimple(attrValueMap.get(item.getId()))); + } + return attrs; + } + + @Override + public ProductAttrBO addProductAttr(Integer adminId, ProductAttrAddDTO productAttrAddDTO) { + // 校验规格名不重复 + int count = productAttrMapper.selectCount(Wrappers.query().lambda() + .eq(ProductAttrDO::getName, productAttrAddDTO.getName()) + .eq(ProductAttrDO::getDeleted, false)); + if (count > 0) { + throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_EXISTS.getCode()); + } + // 插入到数据库 + ProductAttrDO productAttrDO = new ProductAttrDO().setName(productAttrAddDTO.getName()) + .setStatus(ProductAttrConstants.ATTR_STATUS_ENABLE); + productAttrDO.setCreateTime(new Date()); + productAttrDO.setDeleted(DeletedStatusEnum.DELETED_NO.getValue()); + productAttrMapper.insert(productAttrDO); + // 返回成功 + return ProductAttrConvert.INSTANCE.convertAttr(productAttrDO); + } + + @Override + public Boolean updateProductAttr(Integer adminId, ProductAttrUpdateDTO productAttrUpdateDTO) { + // 校验存在 + if (productAttrMapper.selectById(productAttrUpdateDTO.getId()) == null) { + throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_NOT_EXIST.getCode()); + } + // 校验规格名不重复 + ProductAttrDO existsAttrDO = productAttrMapper.selectOne(Wrappers.query().lambda() + .eq(ProductAttrDO::getName, productAttrUpdateDTO.getName()) + .eq(ProductAttrDO::getDeleted, false)); + if (existsAttrDO != null && !existsAttrDO.getId().equals(productAttrUpdateDTO.getId())) { + throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_EXISTS.getCode()); + } + // 更新到数据库 + ProductAttrDO updateProductAttr = ProductAttrConvert.INSTANCE.convertUpdate(productAttrUpdateDTO); + updateProductAttr.setUpdateTime(new Date()); + int i = productAttrMapper.updateById(updateProductAttr); + // 返回成功 + return i > 0; + } + + + @Override + public Boolean updateProductAttrStatus(Integer adminId, Integer productAttrId, Integer status) { + // 校验存在 + ProductAttrDO productAttrDO = productAttrMapper.selectById(productAttrId); + if (productAttrDO == null) { + throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_NOT_EXIST.getCode()); + } + // 校验状态 + if (productAttrDO.getStatus().equals(status)) { + throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_STATUS_EQUALS.getCode()); + } + // 更新到数据库 + ProductAttrDO updateProductAttr = new ProductAttrDO().setId(productAttrId).setStatus(status); + int i = productAttrMapper.updateById(updateProductAttr); + return i > 0; + } + + @Override + public ProductAttrValueBO addProductAttrValue(Integer adminId, ProductAttrValueAddDTO productAttrValueAddDTO) { + // 校验规格名不重复 + int count = productAttrValueMapper.selectCount(Wrappers.query().lambda() + .eq(ProductAttrValueDO::getName, productAttrValueAddDTO.getName()) + .eq(ProductAttrValueDO::getAttrId, productAttrValueAddDTO.getAttrId()) + .eq(ProductAttrValueDO::getDeleted, false)); + if (count > 0) { + throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_VALUE_EXISTS.getCode()); + } + // 插入到数据库 + ProductAttrValueDO productAttrValueDO = ProductAttrConvert.INSTANCE.convertValueAdd(productAttrValueAddDTO) + .setStatus(ProductAttrConstants.ATTR_VALUE_STATUS_ENABLE); + productAttrValueDO.setCreateTime(new Date()); + productAttrValueDO.setDeleted(DeletedStatusEnum.DELETED_NO.getValue()); + productAttrValueMapper.insert(productAttrValueDO); + return ProductAttrConvert.INSTANCE.convertAttrValue(productAttrValueDO); + } + + @Override + public Boolean updateProductAttrValue(Integer adminId, ProductAttrValueUpdateDTO productAttrValueUpdateDTO) { + // 校验存在 + ProductAttrValueDO productAttrValueDO = productAttrValueMapper.selectById(productAttrValueUpdateDTO.getId()); + if (productAttrValueDO == null) { + throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_VALUE_NOT_EXIST.getCode()); + } + // 校验规格名不重复 + ProductAttrValueDO existsAttrDO = productAttrValueMapper.selectOne(Wrappers.query().lambda() + .eq(ProductAttrValueDO::getName, productAttrValueDO.getName()) + .eq(ProductAttrValueDO::getAttrId, productAttrValueDO.getAttrId()) + .eq(ProductAttrValueDO::getDeleted, false)); + if (existsAttrDO != null && !existsAttrDO.getId().equals(productAttrValueUpdateDTO.getId())) { + throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_VALUE_EXISTS.getCode()); + } + // 更新到数据库 + ProductAttrValueDO updateProductValue = ProductAttrConvert.INSTANCE.convertValueUpdate(productAttrValueUpdateDTO); + updateProductValue.setUpdateTime(new Date()); + int i = productAttrValueMapper.updateById(updateProductValue); + return i > 0; + } + + @Override + public Boolean updateProductAttrValueStatus(Integer adminId, Integer productAttrValueId, Integer status) { + // 校验存在 + ProductAttrValueDO productAttrValueDO = productAttrValueMapper.selectById(productAttrValueId); + if (productAttrValueDO == null) { + throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_VALUE_NOT_EXIST.getCode()); + } + // 校验状态 + if (productAttrValueDO.getStatus().equals(status)) { + throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_VALUE_STATUS_EQUALS.getCode()); + } + // 更新到数据库 + ProductAttrValueDO updateProductAttrValue = new ProductAttrValueDO().setId(productAttrValueId).setStatus(status); + int i = productAttrValueMapper.updateById(updateProductAttrValue); + return i > 0; + } + public List validProductAttrAndValue(Set productAttrValueIds, boolean validStatus) { // 首先,校验规格值 List attrValues = productAttrValueMapper.selectBatchIds(productAttrValueIds); @@ -110,146 +240,4 @@ public class ProductAttrServiceImpl implements ProductAttrService { .setAttrValueId(productAttrValueDO.getId()).setAttrValueName(productAttrValueDO.getName())).collect(Collectors.toList()); } - - - @Override - public List getProductAttrList() { - // 查询所有开启的规格数组 - List attrDos = productAttrMapper.selectList(Wrappers.query().lambda() - .in(ProductAttrDO::getStatus, ProductAttrConstants.ATTR_STATUS_ENABLE) - .eq(ProductAttrDO::getDeleted, false)); - List attrs = ProductAttrConvert2.INSTANCE.convert3(attrDos); - // 如果为空,则返回空 - if (attrs.isEmpty()) { - return Collections.emptyList(); - } - // 将规格值拼接上去 - List attrValues = productAttrValueMapper.selectList(Wrappers.query().lambda() - .in(ProductAttrValueDO::getStatus, ProductAttrConstants.ATTR_STATUS_ENABLE) - .eq(ProductAttrValueDO::getDeleted, false)); - // KEY 是 attrId ,VALUE 是 ProductAttrValueDO 数组 - ImmutableListMultimap attrValueMap = Multimaps.index(attrValues, ProductAttrValueDO::getAttrId); - for (ProductAttrSimpleBO productAttrSimpleBO : attrs) { - productAttrSimpleBO.setValues(ProductAttrConvert2.INSTANCE.convert4(((attrValueMap).get(productAttrSimpleBO.getId())))); - } - return attrs; - } - - @Override - public ProductAttrBO2 addProductAttr(Integer adminId, ProductAttrAddDTO productAttrAddDTO) { - // 校验规格名不重复 - int count = productAttrMapper.selectCount(Wrappers.query().lambda() - .eq(ProductAttrDO::getName, productAttrAddDTO.getName()) - .eq(ProductAttrDO::getDeleted, false)); - if (count > 0) { - throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_EXISTS.getCode()); - } - // 插入到数据库 - ProductAttrDO productAttrDO = ProductAttrConvert2.INSTANCE.convert(productAttrAddDTO) - .setStatus(ProductAttrConstants.ATTR_STATUS_ENABLE); - productAttrDO.setCreateTime(new Date()); - productAttrDO.setDeleted(DeletedStatusEnum.DELETED_NO.getValue()); - productAttrMapper.insert(productAttrDO); - // 返回成功 - return ProductAttrConvert2.INSTANCE.convert(productAttrDO); - } - - @Override - public Boolean updateProductAttr(Integer adminId, ProductAttrUpdateDTO productAttrUpdateDTO) { - // 校验存在 - if (productAttrMapper.selectById(productAttrUpdateDTO.getId()) == null) { - throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_NOT_EXIST.getCode()); - } - // 校验规格名不重复 - ProductAttrDO existsAttrDO = productAttrMapper.selectOne(Wrappers.query().lambda() - .eq(ProductAttrDO::getName, productAttrUpdateDTO.getName()) - .eq(ProductAttrDO::getDeleted, false)); - if (existsAttrDO != null && !existsAttrDO.getId().equals(productAttrUpdateDTO.getId())) { - throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_EXISTS.getCode()); - } - // 更新到数据库 - ProductAttrDO updateProductAttr = ProductAttrConvert2.INSTANCE.convert(productAttrUpdateDTO); - productAttrMapper.updateById(updateProductAttr); - // 返回成功 - return true; - } - - @Override - public Boolean updateProductAttrStatus(Integer adminId, Integer productAttrId, Integer status) { - // 校验存在 - ProductAttrDO productAttrDO = productAttrMapper.selectById(productAttrId); - if (productAttrDO == null) { - throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_NOT_EXIST.getCode()); - } - // 校验状态 - if (productAttrDO.getStatus().equals(status)) { - throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_STATUS_EQUALS.getCode()); - } - // 更新到数据库 - ProductAttrDO updateProductAttr = new ProductAttrDO().setId(productAttrId).setStatus(status); - productAttrMapper.updateById(updateProductAttr); - // 返回成功 - return true; - } - - @Override - public ProductAttrValueBO addProductAttrValue(Integer adminId, ProductAttrValueAddDTO productAttrValueAddDTO) { - // 校验规格名不重复 - int count = productAttrValueMapper.selectCount(Wrappers.query().lambda() - .eq(ProductAttrValueDO::getName, productAttrValueAddDTO.getName()) - .eq(ProductAttrValueDO::getAttrId, productAttrValueAddDTO.getAttrId()) - .eq(ProductAttrValueDO::getDeleted, false)); - if (count > 0) { - throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_VALUE_EXISTS.getCode()); - } - // 插入到数据库 - ProductAttrValueDO productAttrValueDO = ProductAttrConvert2.INSTANCE.convert(productAttrValueAddDTO) - .setStatus(ProductAttrConstants.ATTR_VALUE_STATUS_ENABLE); - productAttrValueDO.setCreateTime(new Date()); - productAttrValueDO.setDeleted(DeletedStatusEnum.DELETED_NO.getValue()); - productAttrValueMapper.insert(productAttrValueDO); - // 返回成功 - return ProductAttrConvert2.INSTANCE.convert2(productAttrValueDO); - } - - @Override - public Boolean updateProductAttrValue(Integer adminId, ProductAttrValueUpdateDTO productAttrValueUpdateDTO) { - // 校验存在 - ProductAttrValueDO productAttrValueDO = productAttrValueMapper.selectById(productAttrValueUpdateDTO.getId()); - if (productAttrValueDO == null) { - throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_VALUE_NOT_EXIST.getCode()); - } - // 校验规格名不重复 - ProductAttrValueDO existsAttrDO = productAttrValueMapper.selectOne(Wrappers.query().lambda() - .eq(ProductAttrValueDO::getName, productAttrValueDO.getName()) - .eq(ProductAttrValueDO::getAttrId, productAttrValueDO.getAttrId()) - .eq(ProductAttrValueDO::getDeleted, false)); - if (existsAttrDO != null && !existsAttrDO.getId().equals(productAttrValueUpdateDTO.getId())) { - throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_VALUE_EXISTS.getCode()); - } - // 更新到数据库 - ProductAttrValueDO updateProductValue = ProductAttrConvert2.INSTANCE.convert(productAttrValueUpdateDTO); - productAttrValueMapper.updateById(updateProductValue); - // 返回成功 - return true; - } - - @Override - public Boolean updateProductAttrValueStatus(Integer adminId, Integer productAttrValueId, Integer status) { - // 校验存在 - ProductAttrValueDO productAttrValueDO = productAttrValueMapper.selectById(productAttrValueId); - if (productAttrValueDO == null) { - throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_VALUE_NOT_EXIST.getCode()); - } - // 校验状态 - if (productAttrValueDO.getStatus().equals(status)) { - throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_ATTR_VALUE_STATUS_EQUALS.getCode()); - } - // 更新到数据库 - ProductAttrValueDO updateProductAttrValue = new ProductAttrValueDO().setId(productAttrValueId).setStatus(status); - productAttrValueMapper.updateById(updateProductAttrValue); - // 返回成功 - return true; - } - } diff --git a/product/product-rest/pom.xml b/product/product-rest/pom.xml index 3ff0fd551..a7f299091 100644 --- a/product/product-rest/pom.xml +++ b/product/product-rest/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - system + product cn.iocoder.mall 1.0-SNAPSHOT diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/admins/AdminsProductAttrController.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/admins/AdminsProductAttrController.java index f6bbb50f0..fd46ee49d 100644 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/admins/AdminsProductAttrController.java +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/admins/AdminsProductAttrController.java @@ -3,17 +3,30 @@ package cn.iocoder.mall.product.rest.controller.admins; import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.product.biz.bo.attr.ProductAttrBO; -import cn.iocoder.mall.product.biz.dto.attr.AdminProductAttrPageDTO; +import cn.iocoder.mall.product.biz.bo.attr.ProductAttrSimpleWithValueBO; +import cn.iocoder.mall.product.biz.bo.attr.ProductAttrValueBO; +import cn.iocoder.mall.product.biz.bo.attr.ProductAttrWithValueBO; +import cn.iocoder.mall.product.biz.dto.attr.*; import cn.iocoder.mall.product.biz.service.product.ProductAttrService; import cn.iocoder.mall.product.rest.convert.attr.ProductAttrConvert; import cn.iocoder.mall.product.rest.request.attr.AdminProductAttrPageRequest; +import cn.iocoder.mall.product.rest.request.attr.ProductAttrAddRequest; +import cn.iocoder.mall.product.rest.request.attr.ProductAttrUpdateRequest; +import cn.iocoder.mall.product.rest.request.attr.ProductAttrValueAddRequest; import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrPageResponse; +import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrSimpleResponse; +import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrVO; +import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrValueResponse; +import cn.iocoder.mall.security.core.context.AdminSecurityContextHolder; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; /** * 商品规格 @@ -34,100 +47,88 @@ public class AdminsProductAttrController { @ApiOperation("获得规格分页") public CommonResult> attrPage(AdminProductAttrPageRequest request) { AdminProductAttrPageDTO pageDTO = ProductAttrConvert.INSTANCE.convert(request); - PageResult productAttrPage = productAttrService.getProductAttrPage(pageDTO); + PageResult productAttrPage = productAttrService.getProductAttrPage(pageDTO); PageResult adminPageResponse = ProductAttrConvert.INSTANCE.convertPage(productAttrPage); return CommonResult.success(adminPageResponse); } -// @GetMapping("/attr/tree") -// @ApiOperation(value = "获得规格树结构", notes = "该接口返回的信息更为精简。一般用于前端缓存数据字典到本地。") -// public CommonResult> tree() { -// // 查询全列表 -// List result = productAttrService.getProductAttrList(); -// // 返回结果 -// return success(ProductAttrConvert.INSTANCE.convert(result)); -// } -// -// @PostMapping("/attr/add") -// @ApiOperation(value = "创建商品规格") -// @ApiImplicitParams({ -// @ApiImplicitParam(name = "name", value = "规格名", required = true, example = "颜色") -// }) -// public CommonResult addAttr(@RequestParam("name") String name) { -// // 创建 ProductAttrAddDTO 对象 -// ProductAttrAddDTO productAttrAddDTO = new ProductAttrAddDTO().setName(name); -// // 添加 -// ProductAttrBO result = productAttrService.addProductAttr(AdminSecurityContextHolder.getContext().getAdminId(), productAttrAddDTO); -// // 返回结果 -// return success(ProductAttrConvert.INSTANCE.convert3(result)); -// } -// -// @PostMapping("/attr/update") -// @ApiOperation(value = "修改商品规格") -// @ApiImplicitParams({ -// @ApiImplicitParam(name = "id", value = "规格编号", required = true, example = "1"), -// @ApiImplicitParam(name = "name", value = "规格名", required = true, example = "颜色") -// }) -// public CommonResult updateAttr(@RequestParam("id") Integer id, -// @RequestParam("name") String name) { -// // 创建 ProductAttrUpdateDTO 对象 -// ProductAttrUpdateDTO productAttrUpdateDTO = new ProductAttrUpdateDTO().setId(id).setName(name); -// // 更新 -// return success(productAttrService.updateProductAttr(AdminSecurityContextHolder.getContext().getAdminId(), productAttrUpdateDTO)); -// } -// -// @PostMapping("/attr/update_status") -// @ApiOperation(value = "修改商品规格状态") -// @ApiImplicitParams({ -// @ApiImplicitParam(name = "id", value = "规格编号", required = true, example = "100"), -// @ApiImplicitParam(name = "status", value = "状态", required = true, example = "1") -// }) -// public CommonResult updateAttrStatus(@RequestParam("id") Integer id, -// @RequestParam("status") Integer status) { -// return success(productAttrService.updateProductAttrStatus(AdminSecurityContextHolder.getContext().getAdminId(), id, status)); -// } -// -// // TODO 芋艿 暂时不考虑 delete Attr 。因为关联逻辑比较多 -// -// @PostMapping("/attr_value/add") -// @ApiOperation(value = "创建商品规格值") -// @ApiImplicitParams({ -// @ApiImplicitParam(name = "attrId", value = "规格编号", required = true, example = "100"), -// @ApiImplicitParam(name = "name", value = "规格值", required = true, example = "蓝色") -// }) -// public CommonResult addAttrValue(@RequestParam("attrId") Integer attrId, -// @RequestParam("name") String name) { -// // 创建 ProductAttrValueAddDTO 对象 -// ProductAttrValueAddDTO productAttrValueAddDTO = new ProductAttrValueAddDTO().setAttrId(attrId).setName(name); -// // 添加 -// ProductAttrValueBO result = productAttrService.addProductAttrValue(AdminSecurityContextHolder.getContext().getAdminId(), productAttrValueAddDTO); -// // 返回结果 -// return success(ProductAttrConvert.INSTANCE.convert4(result)); -// } -// -// @PostMapping("/attr_value/update") -// @ApiOperation(value = "修改商品规格值") -// @ApiImplicitParams({ -// @ApiImplicitParam(name = "id", value = "规格值编号", required = true, example = "100"), -// @ApiImplicitParam(name = "name", value = "规格值", required = true, example = "蓝色") -// }) -// public CommonResult updateAttrValue(@RequestParam("id") Integer id, -// @RequestParam("name") String name) { -// // 创建 ProductAttrValueUpdateDTO 对象 -// ProductAttrValueUpdateDTO productAttrValueUpdateDTO = new ProductAttrValueUpdateDTO().setId(id).setName(name); -// // 更新 -// return success(productAttrService.updateProductAttrValue(AdminSecurityContextHolder.getContext().getAdminId(), productAttrValueUpdateDTO)); -// } -// -// @PostMapping("/attr_value/update_status") -// @ApiImplicitParams({ -// @ApiImplicitParam(name = "id", value = "规格编号", required = true, example = "100"), -// @ApiImplicitParam(name = "status", value = "状态", required = true, example = "1") -// }) -// public CommonResult updateAttrValueStatus(@RequestParam("id") Integer id, -// @RequestParam("status") Integer status) { -// return success(productAttrService.updateProductAttrValueStatus(AdminSecurityContextHolder.getContext().getAdminId(), id, status)); -// } + @GetMapping("/attr/tree") + @ApiOperation(value = "获得规格树结构", notes = "该接口返回的信息更为精简。一般用于前端缓存数据字典到本地。") + public CommonResult> tree() { + // 查询全列表 + List result = productAttrService.getProductAttrList(); + return CommonResult.success(ProductAttrConvert.INSTANCE.convertSimple(result)); + } + + @PostMapping("/attr/add") + @ApiOperation(value = "创建商品规格") + public CommonResult addAttr(@Validated ProductAttrAddRequest addRequest) { + // 创建 ProductAttrAddDTO 对象 + ProductAttrAddDTO productAttrAddDTO = new ProductAttrAddDTO().setName(addRequest.getName()); + // 添加 + ProductAttrBO result = productAttrService.addProductAttr(AdminSecurityContextHolder.getContext().getAdminId(), productAttrAddDTO); + return CommonResult.success(ProductAttrConvert.INSTANCE.convertAttr(result)); + } + + @PostMapping("/attr/update") + @ApiOperation(value = "修改商品规格") + public CommonResult updateAttr(@Validated ProductAttrUpdateRequest updateRequest) { + ProductAttrUpdateDTO productAttrUpdateDTO = ProductAttrConvert.INSTANCE.convertUpdate(updateRequest); + // 更新 + return CommonResult.success(productAttrService.updateProductAttr(AdminSecurityContextHolder.getContext().getAdminId(), productAttrUpdateDTO)); + } + + @PostMapping("/attr/update_status") + @ApiOperation(value = "修改商品规格状态") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "规格编号", required = true, example = "100"), + @ApiImplicitParam(name = "status", value = "状态", required = true, example = "1") + }) + public CommonResult updateAttrStatus(@RequestParam("id") Integer id, + @RequestParam("status") Integer status) { + return CommonResult.success(productAttrService.updateProductAttrStatus(AdminSecurityContextHolder.getContext().getAdminId(), id, status)); + } + + // TODO 芋艿 暂时不考虑 delete Attr 。因为关联逻辑比较多 + + @PostMapping("/attr_value/add") + @ApiOperation(value = "创建商品规格值") + @ApiImplicitParams({ + @ApiImplicitParam(name = "attrId", value = "规格编号", required = true, example = "100"), + @ApiImplicitParam(name = "name", value = "规格值", required = true, example = "蓝色") + }) + public CommonResult addAttrValue(@Validated ProductAttrValueAddRequest addRequest) { + // 创建 ProductAttrValueAddDTO 对象 + ProductAttrValueAddDTO productAttrValueAddDTO = new ProductAttrValueAddDTO().setAttrId(addRequest.getAttrId()).setName(addRequest.getName()); + // 添加 + ProductAttrValueBO result = productAttrService.addProductAttrValue(AdminSecurityContextHolder.getContext().getAdminId(), productAttrValueAddDTO); + // 返回结果 + return CommonResult.success(ProductAttrConvert.INSTANCE.convertAddResponse(result)); + } + + @PostMapping("/attr_value/update") + @ApiOperation(value = "修改商品规格值") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "规格值编号", required = true, example = "100"), + @ApiImplicitParam(name = "name", value = "规格值", required = true, example = "蓝色") + }) + public CommonResult updateAttrValue(@RequestParam("id") Integer id, + @RequestParam("name") String name) { + // 创建 ProductAttrValueUpdateDTO 对象 + ProductAttrValueUpdateDTO productAttrValueUpdateDTO = new ProductAttrValueUpdateDTO().setId(id).setName(name); + // 更新 + return CommonResult.success(productAttrService.updateProductAttrValue(AdminSecurityContextHolder.getContext().getAdminId(), productAttrValueUpdateDTO)); + } + + @PostMapping("/attr_value/update_status") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "规格编号", required = true, example = "100"), + @ApiImplicitParam(name = "status", value = "状态", required = true, example = "1") + }) + public CommonResult updateAttrValueStatus(@RequestParam("id") Integer id, + @RequestParam("status") Integer status) { + return CommonResult.success(productAttrService.updateProductAttrValueStatus(AdminSecurityContextHolder.getContext().getAdminId(), id, status)); + } // TODO 芋艿 暂时不考虑 delete Attr Value 。因为关联逻辑比较多 diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/convert/attr/ProductAttrConvert.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/convert/attr/ProductAttrConvert.java index 13415d7c9..c6b315c82 100644 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/convert/attr/ProductAttrConvert.java +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/convert/attr/ProductAttrConvert.java @@ -2,18 +2,44 @@ package cn.iocoder.mall.product.rest.convert.attr; import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.product.biz.bo.attr.ProductAttrBO; +import cn.iocoder.mall.product.biz.bo.attr.ProductAttrSimpleWithValueBO; +import cn.iocoder.mall.product.biz.bo.attr.ProductAttrValueBO; +import cn.iocoder.mall.product.biz.bo.attr.ProductAttrWithValueBO; import cn.iocoder.mall.product.biz.dto.attr.AdminProductAttrPageDTO; +import cn.iocoder.mall.product.biz.dto.attr.ProductAttrUpdateDTO; import cn.iocoder.mall.product.rest.request.attr.AdminProductAttrPageRequest; +import cn.iocoder.mall.product.rest.request.attr.ProductAttrUpdateRequest; import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrPageResponse; +import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrSimpleResponse; +import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrVO; +import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrValueResponse; import org.mapstruct.Mapper; +import org.mapstruct.Mappings; import org.mapstruct.factory.Mappers; +import java.util.List; + @Mapper public interface ProductAttrConvert { ProductAttrConvert INSTANCE = Mappers.getMapper(ProductAttrConvert.class); + @Mappings({}) AdminProductAttrPageDTO convert(AdminProductAttrPageRequest bean); - PageResult convertPage(PageResult productAttrPage); + @Mappings({}) + PageResult convertPage(PageResult productAttrPage); + + @Mappings({}) + List convertSimple(List simpleList); + + @Mappings({}) + AdminsProductAttrVO convertAttr(ProductAttrBO attrBO); + + @Mappings({}) + ProductAttrUpdateDTO convertUpdate(ProductAttrUpdateRequest updateRequest); + + @Mappings({}) + AdminsProductAttrValueResponse convertAddResponse(ProductAttrValueBO result); } + diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrAddRequest.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrAddRequest.java new file mode 100644 index 000000000..9ceb12f9a --- /dev/null +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrAddRequest.java @@ -0,0 +1,20 @@ +package cn.iocoder.mall.product.rest.request.attr; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; + +/** + * 规格添加 + */ +@Data +@Accessors(chain = true) +public class ProductAttrAddRequest { + + @ApiModelProperty(name = "name", value = "规格名", required = true, example = "颜色") + @NotEmpty(message = "规格名不能为空") + private String name; + +} diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrUpdateRequest.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrUpdateRequest.java new file mode 100644 index 000000000..745a34f5a --- /dev/null +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrUpdateRequest.java @@ -0,0 +1,26 @@ +package cn.iocoder.mall.product.rest.request.attr; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * 规格修改 + */ +@Data +@Accessors(chain = true) +public class ProductAttrUpdateRequest { + + @ApiModelProperty(name = "id", value = "规格编号", required = true, example = "1") + @NotNull(message = "规格编号不能为空") + private Integer id; + + @ApiModelProperty(name = "name", value = "规格名", required = true, example = "颜色") + @NotEmpty(message = "规格名不能为空") + private String name; + + +} diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrValueAddRequest.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrValueAddRequest.java new file mode 100644 index 000000000..244d8f186 --- /dev/null +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrValueAddRequest.java @@ -0,0 +1,27 @@ +package cn.iocoder.mall.product.rest.request.attr; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * Product 规格值添加 DTO + */ +@Data +@Accessors(chain = true) +public class ProductAttrValueAddRequest { + + @ApiModelProperty(name = "attrId", value = "规格编号", required = true, example = "1") + @NotNull(message = "规格编号不能为空") + private Integer attrId; + /** + * 名称 + */ + @ApiModelProperty(name = "name", value = "规格值名", required = true, example = "红色") + @NotEmpty(message = "规格值名不能为空") + private String name; + +} diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrValueUpdateRequest.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrValueUpdateRequest.java new file mode 100644 index 000000000..e2cabaa85 --- /dev/null +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/attr/ProductAttrValueUpdateRequest.java @@ -0,0 +1,27 @@ +package cn.iocoder.mall.product.rest.request.attr; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * Product 规格值修改 DTO + *

+ * 注意,不允许修改所属规格 + */ +@Data +@Accessors(chain = true) +public class ProductAttrValueUpdateRequest { + + @ApiModelProperty(name = "id", value = "规格值编号", required = true, example = "1") + @NotNull(message = "规格值编号不能为空") + private Integer id; + + @ApiModelProperty(name = "id", value = "规格值编号", required = true, example = "1") + @NotEmpty(message = "规格名不能为空") + private String name; + +} diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/attr/AdminsProductAttrSimpleResponse.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/attr/AdminsProductAttrSimpleResponse.java new file mode 100644 index 000000000..4b797a686 --- /dev/null +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/attr/AdminsProductAttrSimpleResponse.java @@ -0,0 +1,38 @@ +package cn.iocoder.mall.product.rest.response.attr; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +@ApiModel(value = "商品规格精简 VO", description = "带有规格值数组") +@Data +@Accessors(chain = true) +public class AdminsProductAttrSimpleResponse { + + @ApiModelProperty(value = "规格编号", required = true, example = "1") + private Integer id; + @ApiModelProperty(value = "规格名", required = true, example = "颜色") + private String name; + @ApiModelProperty(value = "规格值数组", required = true) + private List values; + + @ApiModel("规格值") + @Data + @Accessors(chain = true) + public static class ProductAttrValue { + + /** + * 规格值编号 + */ + @ApiModelProperty(value = "规格值编号", required = true, example = "1") + private Integer id; + /** + * 规格值名 + */ + @ApiModelProperty(value = "规格值名", required = true, example = "小") + private String name; + } +} diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/attr/AdminsProductAttrVO.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/attr/AdminsProductAttrVO.java new file mode 100644 index 000000000..5d62ffb7f --- /dev/null +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/attr/AdminsProductAttrVO.java @@ -0,0 +1,24 @@ +package cn.iocoder.mall.product.rest.response.attr; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; + +@ApiModel(value = "商品规格 VO", description = "不带有规格值数组") +@Data +@Accessors(chain = true) +public class AdminsProductAttrVO { + + @ApiModelProperty(value = "规格编号", required = true, example = "1") + private Integer id; + @ApiModelProperty(value = "规格名", required = true, example = "颜色") + private String name; + @ApiModelProperty(value = "状态", required = true, example = "1") + private Integer status; + @ApiModelProperty(value = "创建时间", required = true, example = "时间戳") + private Date createTime; + +} diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/attr/AdminsProductAttrValueResponse.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/attr/AdminsProductAttrValueResponse.java new file mode 100644 index 000000000..03de4b578 --- /dev/null +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/attr/AdminsProductAttrValueResponse.java @@ -0,0 +1,26 @@ +package cn.iocoder.mall.product.rest.response.attr; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; + +@ApiModel(value = "商品规格值 VO") +@Data +@Accessors(chain = true) +public class AdminsProductAttrValueResponse { + + @ApiModelProperty(value = "规格值编号", required = true, example = "1") + private Integer id; + @ApiModelProperty(value = "规格编号", required = true, example = "1") + private Integer attrId; + @ApiModelProperty(value = "规格名", required = true, example = "颜色") + private String name; + @ApiModelProperty(value = "状态", required = true, example = "1") + private Integer status; + @ApiModelProperty(value = "创建时间", required = true, example = "时间戳") + private Date createTime; + +} diff --git a/product/product-rpc-api/pom.xml b/product/product-rpc-api/pom.xml index 8cb7a6478..489ccc46b 100644 --- a/product/product-rpc-api/pom.xml +++ b/product/product-rpc-api/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - system + product cn.iocoder.mall 1.0-SNAPSHOT diff --git a/product/product-rpc/pom.xml b/product/product-rpc/pom.xml index 010865b94..86830e45c 100644 --- a/product/product-rpc/pom.xml +++ b/product/product-rpc/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - system + product cn.iocoder.mall 1.0-SNAPSHOT diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductAttrController.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductAttrController.java index 3b2a406c0..f19574d6b 100644 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductAttrController.java +++ b/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductAttrController.java @@ -1,7 +1,6 @@ package cn.iocoder.mall.product.application.controller.admins; import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder; import cn.iocoder.mall.product.api.ProductAttrService; import cn.iocoder.mall.product.api.bo.ProductAttrBO; import cn.iocoder.mall.product.api.bo.ProductAttrPageBO; @@ -13,12 +12,12 @@ import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrPageVO; import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrSimpleVO; import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrVO; import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrValueVO; +import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.dubbo.config.annotation.Reference; -import org.springframework.web.bind.annotation.*; import java.util.List; diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductBrandController.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductBrandController.java index 470b69c90..440219781 100644 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductBrandController.java +++ b/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductBrandController.java @@ -1,7 +1,6 @@ package cn.iocoder.mall.product.application.controller.admins; import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder; import cn.iocoder.mall.product.api.ProductBrandService; import cn.iocoder.mall.product.api.bo.ProductBrandBO; import cn.iocoder.mall.product.api.bo.ProductBrangPageBO; @@ -11,12 +10,12 @@ import cn.iocoder.mall.product.api.dto.ProductBrandUpdateDTO; import cn.iocoder.mall.product.application.convert.ProductBrandConvert; import cn.iocoder.mall.product.application.vo.admins.AdminsProductBrandVO; import cn.iocoder.mall.product.application.vo.admins.AdminsProductBrangPageVO; +import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.dubbo.config.annotation.Reference; -import org.springframework.web.bind.annotation.*; import static cn.iocoder.common.framework.vo.CommonResult.success; diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductCategoryController.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductCategoryController.java index b9a468ce9..b65644ca6 100644 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductCategoryController.java +++ b/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductCategoryController.java @@ -1,7 +1,6 @@ package cn.iocoder.mall.product.application.controller.admins; import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder; import cn.iocoder.mall.product.api.ProductCategoryService; import cn.iocoder.mall.product.api.bo.ProductCategoryBO; import cn.iocoder.mall.product.api.constant.ProductCategoryConstants; @@ -10,12 +9,12 @@ import cn.iocoder.mall.product.api.dto.ProductCategoryUpdateDTO; import cn.iocoder.mall.product.application.convert.ProductCategoryConvert; import cn.iocoder.mall.product.application.vo.admins.AdminsProductCategoryTreeNodeVO; import cn.iocoder.mall.product.application.vo.admins.AdminsProductCategoryVO; +import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.dubbo.config.annotation.Reference; -import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.Comparator; diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductSpuController.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductSpuController.java index db3b6727c..08790e193 100644 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductSpuController.java +++ b/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductSpuController.java @@ -1,7 +1,6 @@ package cn.iocoder.mall.product.application.controller.admins; import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder; import cn.iocoder.mall.product.api.ProductSpuService; import cn.iocoder.mall.product.api.bo.ProductSpuBO; import cn.iocoder.mall.product.api.bo.ProductSpuDetailBO; @@ -11,13 +10,13 @@ import cn.iocoder.mall.product.application.convert.ProductSpuConvert; import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuDetailVO; import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuPageVO; import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuVO; +import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder; import com.alibaba.fastjson.JSON; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.dubbo.config.annotation.Reference; -import org.springframework.web.bind.annotation.*; import java.util.Collection; import java.util.List; diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/users/UserFavoriteController.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/users/UserFavoriteController.java index 1fe9d33fc..b0ad41255 100644 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/users/UserFavoriteController.java +++ b/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/users/UserFavoriteController.java @@ -10,7 +10,6 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.dubbo.config.annotation.Reference; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; /** * 用户收藏