From 03857426aa2fa524d037307e0045b2d4ce4ba14b Mon Sep 17 00:00:00 2001 From: jwf1173 <1553713823@qq.com> Date: Tue, 12 May 2020 18:23:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=95=86=E5=93=81=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProductAttrConstants.java | 2 +- .../category/ProductCategoryConstants.java | 10 ++++ .../category/ProductCategoryStatusEnum.java | 46 +++++++++++++++++++ .../product/ProductCategoryConstants.java | 19 -------- .../{product => spu}/ProductSpuConstants.java | 2 +- .../biz/convert/attr/ProductAttrConvert.java | 4 +- .../convert/brand/ProductBrandConvert.java | 2 +- .../category/ProductCategoryConvert.java | 10 +++- .../convert/product/ProductSpuConvert.java | 6 +-- .../UserProductSpuCollectionsConvert.java | 2 +- .../{product => attr}/ProductAttrMapper.java | 4 +- .../ProductAttrValueMapper.java | 4 +- .../ProductBrandMapper.java | 4 +- .../ProductCategoryMapper.java | 6 +-- .../{product => spu}/ProductSkuMapper.java | 4 +- .../{product => spu}/ProductSpuMapper.java | 4 +- .../UserProductSpuCollectionsMapper.java | 4 +- .../{product => attr}/ProductAttrDO.java | 2 +- .../{product => attr}/ProductAttrValueDO.java | 2 +- .../{product => brand}/ProductBrandDO.java | 2 +- .../ProductCategoryDO.java | 2 +- .../{product => spu}/ProductSkuDO.java | 3 +- .../{product => spu}/ProductSpuDO.java | 2 +- .../UserProductSpuCollectionsDO.java | 2 +- .../{product => stock}/ProductStockDO.java | 2 +- .../{product => attr}/ProductAttrService.java | 2 +- .../impl => attr}/ProductAttrServiceImpl.java | 17 ++++--- .../ProductBrandService.java | 2 +- .../ProductBrandServiceImpl.java | 7 ++- .../ProductCategoryService.java | 4 +- .../ProductCategoryServiceImpl.java | 37 +++++++-------- .../{product => spu}/ProductSpuService.java | 2 +- .../impl => spu}/ProductSpuServiceImpl.java | 19 ++++---- .../resources/mapper/ProductSpuMapper.xml | 2 +- .../attr/AdminsProductAttrController.java | 2 +- .../brand/AdminsProductBrandController.java | 2 +- .../AdminsProductCategoryController.java | 18 ++++---- ...java => AdminsProductCategoryConvert.java} | 6 +-- .../AdminsProductCategoryAddRequest.java | 2 +- .../AdminsProductCategoryUpdateRequest.java | 2 +- ...insProductCategoryUpdateStatusRequest.java | 2 +- .../AdminsProductCategoryAddResponse.java | 2 +- ...AdminsProductCategoryTreeNodeResponse.java | 2 +- .../product/rpc/rpc/ProductSpuRpcImpl.java | 2 +- .../system/biz/service/user/UserService.java | 7 ++- 45 files changed, 165 insertions(+), 124 deletions(-) rename product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/{product => attr}/ProductAttrConstants.java (90%) create mode 100644 product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/category/ProductCategoryConstants.java create mode 100644 product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/category/ProductCategoryStatusEnum.java delete mode 100644 product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/product/ProductCategoryConstants.java rename product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/{product => spu}/ProductSpuConstants.java (81%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/{product => attr}/ProductAttrMapper.java (61%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/{product => attr}/ProductAttrValueMapper.java (62%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/{product => brand}/ProductBrandMapper.java (92%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/{product => category}/ProductCategoryMapper.java (55%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/{product => spu}/ProductSkuMapper.java (83%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/{product => spu}/ProductSpuMapper.java (62%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/{product => spu}/UserProductSpuCollectionsMapper.java (91%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/{product => attr}/ProductAttrDO.java (88%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/{product => attr}/ProductAttrValueDO.java (91%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/{product => brand}/ProductBrandDO.java (91%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/{product => category}/ProductCategoryDO.java (93%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/{product => spu}/ProductSkuDO.java (90%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/{product => spu}/ProductSpuDO.java (96%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/{product => spu}/UserProductSpuCollectionsDO.java (95%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/{product => stock}/ProductStockDO.java (92%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/{product => attr}/ProductAttrService.java (97%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/{product/impl => attr}/ProductAttrServiceImpl.java (95%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/{product => brand}/ProductBrandService.java (95%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/{product/impl => brand}/ProductBrandServiceImpl.java (91%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/{product => category}/ProductCategoryService.java (92%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/{product/impl => category}/ProductCategoryServiceImpl.java (82%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/{product => spu}/ProductSpuService.java (83%) rename product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/{product/impl => spu}/ProductSpuServiceImpl.java (76%) rename product/product-rest/src/main/java/cn/iocoder/mall/product/rest/convert/category/{ProductCategoryConvert.java => AdminsProductCategoryConvert.java} (92%) diff --git a/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/product/ProductAttrConstants.java b/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/attr/ProductAttrConstants.java similarity index 90% rename from product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/product/ProductAttrConstants.java rename to product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/attr/ProductAttrConstants.java index ea3f9a802..b65aac0a1 100644 --- a/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/product/ProductAttrConstants.java +++ b/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/attr/ProductAttrConstants.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.enums.product; +package cn.iocoder.mall.product.biz.enums.attr; public class ProductAttrConstants { diff --git a/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/category/ProductCategoryConstants.java b/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/category/ProductCategoryConstants.java new file mode 100644 index 000000000..0613d0b76 --- /dev/null +++ b/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/category/ProductCategoryConstants.java @@ -0,0 +1,10 @@ +package cn.iocoder.mall.product.biz.enums.category; + +public class ProductCategoryConstants { + + /** + * 父分类编号 - 根节点 + */ + public static final Integer PID_ROOT = 0; + +} \ No newline at end of file diff --git a/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/category/ProductCategoryStatusEnum.java b/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/category/ProductCategoryStatusEnum.java new file mode 100644 index 000000000..f90d4670f --- /dev/null +++ b/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/category/ProductCategoryStatusEnum.java @@ -0,0 +1,46 @@ +package cn.iocoder.mall.product.biz.enums.category; + +import cn.iocoder.common.framework.core.IntArrayValuable; + +import java.util.Arrays; + +/** + * @Author: jiangweifan + * @Date: 2020/5/12 + * @Description: 商品分类状态枚举 + */ +public enum ProductCategoryStatusEnum implements IntArrayValuable { + + ENABLED(1, "启用"), + DISABLED(2, "禁用"); + + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductCategoryStatusEnum::getStatus).toArray(); + + /** + * 状态 + */ + private final Integer status; + /** + * 描述 + */ + private final String name; + + ProductCategoryStatusEnum(Integer status, String name) { + this.status = status; + this.name = name; + } + + public Integer getStatus() { + return status; + } + + public String getName() { + return name; + } + + @Override + public int[] array() { + return ARRAYS; + } + +} diff --git a/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/product/ProductCategoryConstants.java b/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/product/ProductCategoryConstants.java deleted file mode 100644 index e533545ea..000000000 --- a/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/product/ProductCategoryConstants.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.mall.product.biz.enums.product; - -public class ProductCategoryConstants { - - /** - * 状态 - 开启 - */ - public static final Integer STATUS_ENABLE = 1; - /** - * 状态 - 关闭 - */ - public static final Integer STATUS_DISABLE = 2; - - /** - * 父分类编号 - 根节点 - */ - public static final Integer PID_ROOT = 0; - -} \ No newline at end of file diff --git a/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/product/ProductSpuConstants.java b/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/spu/ProductSpuConstants.java similarity index 81% rename from product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/product/ProductSpuConstants.java rename to product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/spu/ProductSpuConstants.java index 6e04c4509..366545e81 100644 --- a/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/product/ProductSpuConstants.java +++ b/product/product-biz-api/src/main/java/cn/iocoder/mall/product/biz/enums/spu/ProductSpuConstants.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.enums.product; +package cn.iocoder.mall.product.biz.enums.spu; public class ProductSpuConstants { 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 fa047f97d..4da67ed90 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 @@ -2,8 +2,8 @@ package cn.iocoder.mall.product.biz.convert.attr; import cn.iocoder.common.framework.vo.PageResult; 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.dataobject.attr.ProductAttrDO; +import cn.iocoder.mall.product.biz.dataobject.attr.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; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/brand/ProductBrandConvert.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/brand/ProductBrandConvert.java index 7c7e64d22..e0784cdac 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/brand/ProductBrandConvert.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/brand/ProductBrandConvert.java @@ -2,7 +2,7 @@ package cn.iocoder.mall.product.biz.convert.brand; import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO; -import cn.iocoder.mall.product.biz.dataobject.product.ProductBrandDO; +import cn.iocoder.mall.product.biz.dataobject.brand.ProductBrandDO; import cn.iocoder.mall.product.biz.dto.brand.ProductBrandAddDTO; import cn.iocoder.mall.product.biz.dto.brand.ProductBrandUpdateDTO; import com.baomidou.mybatisplus.core.metadata.IPage; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/category/ProductCategoryConvert.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/category/ProductCategoryConvert.java index 8bcdba78d..47d7fd2fa 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/category/ProductCategoryConvert.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/category/ProductCategoryConvert.java @@ -1,9 +1,10 @@ package cn.iocoder.mall.product.biz.convert.category; import cn.iocoder.mall.product.biz.bo.category.ProductCategoryBO; -import cn.iocoder.mall.product.biz.dataobject.product.ProductCategoryDO; +import cn.iocoder.mall.product.biz.dataobject.category.ProductCategoryDO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryAddDTO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateDTO; +import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateStatusDTO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; import java.util.List; @@ -47,4 +48,11 @@ public interface ProductCategoryConvert { */ ProductCategoryDO convertToDO(ProductCategoryUpdateDTO productCategoryUpdateDTO); + /** + * 更新商品分类状态 - DTO转换DO + * @param productCategoryUpdateStatusDTO + * @return + */ + ProductCategoryDO convertToDO(ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO); + } \ No newline at end of file diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/product/ProductSpuConvert.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/product/ProductSpuConvert.java index 4c7ea79a0..bc4f871d7 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/product/ProductSpuConvert.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/product/ProductSpuConvert.java @@ -2,9 +2,9 @@ package cn.iocoder.mall.product.biz.convert.product; import cn.iocoder.common.framework.util.StringUtil; import cn.iocoder.mall.product.biz.bo.product.*; -import cn.iocoder.mall.product.biz.dataobject.product.ProductCategoryDO; -import cn.iocoder.mall.product.biz.dataobject.product.ProductSkuDO; -import cn.iocoder.mall.product.biz.dataobject.product.ProductSpuDO; +import cn.iocoder.mall.product.biz.dataobject.category.ProductCategoryDO; +import cn.iocoder.mall.product.biz.dataobject.spu.ProductSkuDO; +import cn.iocoder.mall.product.biz.dataobject.spu.ProductSpuDO; import cn.iocoder.mall.product.biz.dto.product.ProductSkuAddOrUpdateDTO; import cn.iocoder.mall.product.biz.dto.product.ProductSpuAddDTO; import cn.iocoder.mall.product.biz.dto.product.ProductSpuUpdateDTO; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/product/UserProductSpuCollectionsConvert.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/product/UserProductSpuCollectionsConvert.java index 9007cd0ab..2b9146848 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/product/UserProductSpuCollectionsConvert.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/convert/product/UserProductSpuCollectionsConvert.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.product.biz.convert.product; import cn.iocoder.mall.product.biz.bo.product.UserProductSpuCollectionsBO; -import cn.iocoder.mall.product.biz.dataobject.product.UserProductSpuCollectionsDO; +import cn.iocoder.mall.product.biz.dataobject.spu.UserProductSpuCollectionsDO; import cn.iocoder.mall.product.biz.dto.product.UserProductSpuCollectionsAddDTO; import cn.iocoder.mall.product.biz.dto.product.UserProductSpuCollectionsUpdateDTO; import org.mapstruct.Mapper; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductAttrMapper.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/attr/ProductAttrMapper.java similarity index 61% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductAttrMapper.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/attr/ProductAttrMapper.java index 4421c0185..0903da75b 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductAttrMapper.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/attr/ProductAttrMapper.java @@ -1,6 +1,6 @@ -package cn.iocoder.mall.product.biz.dao.product; +package cn.iocoder.mall.product.biz.dao.attr; -import cn.iocoder.mall.product.biz.dataobject.product.ProductAttrDO; +import cn.iocoder.mall.product.biz.dataobject.attr.ProductAttrDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.springframework.stereotype.Repository; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductAttrValueMapper.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/attr/ProductAttrValueMapper.java similarity index 62% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductAttrValueMapper.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/attr/ProductAttrValueMapper.java index a8b42a22c..466b73972 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductAttrValueMapper.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/attr/ProductAttrValueMapper.java @@ -1,6 +1,6 @@ -package cn.iocoder.mall.product.biz.dao.product; +package cn.iocoder.mall.product.biz.dao.attr; -import cn.iocoder.mall.product.biz.dataobject.product.ProductAttrValueDO; +import cn.iocoder.mall.product.biz.dataobject.attr.ProductAttrValueDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.springframework.stereotype.Repository; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductBrandMapper.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/brand/ProductBrandMapper.java similarity index 92% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductBrandMapper.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/brand/ProductBrandMapper.java index 09c402ed3..9ba2513df 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductBrandMapper.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/brand/ProductBrandMapper.java @@ -1,6 +1,6 @@ -package cn.iocoder.mall.product.biz.dao.product; +package cn.iocoder.mall.product.biz.dao.brand; -import cn.iocoder.mall.product.biz.dataobject.product.ProductBrandDO; +import cn.iocoder.mall.product.biz.dataobject.brand.ProductBrandDO; import cn.iocoder.mall.product.biz.dto.brand.ProductBrandPageDTO; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductCategoryMapper.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/category/ProductCategoryMapper.java similarity index 55% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductCategoryMapper.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/category/ProductCategoryMapper.java index 93843e69e..792a19e81 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductCategoryMapper.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/category/ProductCategoryMapper.java @@ -1,9 +1,7 @@ -package cn.iocoder.mall.product.biz.dao.product; +package cn.iocoder.mall.product.biz.dao.category; -import cn.iocoder.mall.product.biz.dataobject.product.ProductBrandDO; -import cn.iocoder.mall.product.biz.dataobject.product.ProductCategoryDO; +import cn.iocoder.mall.product.biz.dataobject.category.ProductCategoryDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Update; import org.springframework.stereotype.Repository; /** diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductSkuMapper.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/spu/ProductSkuMapper.java similarity index 83% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductSkuMapper.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/spu/ProductSkuMapper.java index f0df9a044..da316d205 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductSkuMapper.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/spu/ProductSkuMapper.java @@ -1,6 +1,6 @@ -package cn.iocoder.mall.product.biz.dao.product; +package cn.iocoder.mall.product.biz.dao.spu; -import cn.iocoder.mall.product.biz.dataobject.product.ProductSkuDO; +import cn.iocoder.mall.product.biz.dataobject.spu.ProductSkuDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import org.springframework.stereotype.Repository; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductSpuMapper.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/spu/ProductSpuMapper.java similarity index 62% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductSpuMapper.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/spu/ProductSpuMapper.java index eab4e069a..3e21a2d0e 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductSpuMapper.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/spu/ProductSpuMapper.java @@ -1,6 +1,6 @@ -package cn.iocoder.mall.product.biz.dao.product; +package cn.iocoder.mall.product.biz.dao.spu; -import cn.iocoder.mall.product.biz.dataobject.product.ProductSpuDO; +import cn.iocoder.mall.product.biz.dataobject.spu.ProductSpuDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.springframework.stereotype.Repository; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/UserProductSpuCollectionsMapper.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/spu/UserProductSpuCollectionsMapper.java similarity index 91% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/UserProductSpuCollectionsMapper.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/spu/UserProductSpuCollectionsMapper.java index bfde4fc9f..9e1037d2b 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/UserProductSpuCollectionsMapper.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/spu/UserProductSpuCollectionsMapper.java @@ -1,6 +1,6 @@ -package cn.iocoder.mall.product.biz.dao.product; +package cn.iocoder.mall.product.biz.dao.spu; -import cn.iocoder.mall.product.biz.dataobject.product.UserProductSpuCollectionsDO; +import cn.iocoder.mall.product.biz.dataobject.spu.UserProductSpuCollectionsDO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductAttrDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/attr/ProductAttrDO.java similarity index 88% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductAttrDO.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/attr/ProductAttrDO.java index f4fb446eb..4ce7f0ec0 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductAttrDO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/attr/ProductAttrDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.dataobject.product; +package cn.iocoder.mall.product.biz.dataobject.attr; import cn.iocoder.mall.mybatis.dataobject.DeletableDO; import lombok.Data; 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/attr/ProductAttrValueDO.java similarity index 91% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductAttrValueDO.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/attr/ProductAttrValueDO.java index 2b44cf3c3..dcb78ab92 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/attr/ProductAttrValueDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.dataobject.product; +package cn.iocoder.mall.product.biz.dataobject.attr; import cn.iocoder.mall.mybatis.dataobject.DeletableDO; import lombok.Data; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductBrandDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/brand/ProductBrandDO.java similarity index 91% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductBrandDO.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/brand/ProductBrandDO.java index 7ef635763..d2ccd6508 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductBrandDO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/brand/ProductBrandDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.dataobject.product; +package cn.iocoder.mall.product.biz.dataobject.brand; import cn.iocoder.mall.mybatis.dataobject.DeletableDO; import lombok.Data; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductCategoryDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/category/ProductCategoryDO.java similarity index 93% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductCategoryDO.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/category/ProductCategoryDO.java index 118850000..6eff17238 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductCategoryDO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/category/ProductCategoryDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.dataobject.product; +package cn.iocoder.mall.product.biz.dataobject.category; import cn.iocoder.mall.mybatis.dataobject.DeletableDO; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductSkuDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSkuDO.java similarity index 90% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductSkuDO.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSkuDO.java index 41a3b2fbd..c457b59ae 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductSkuDO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSkuDO.java @@ -1,6 +1,7 @@ -package cn.iocoder.mall.product.biz.dataobject.product; +package cn.iocoder.mall.product.biz.dataobject.spu; import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.product.biz.dataobject.attr.ProductAttrDO; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductSpuDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSpuDO.java similarity index 96% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductSpuDO.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSpuDO.java index fb0d1363d..3bbcdfe46 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductSpuDO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSpuDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.dataobject.product; +package cn.iocoder.mall.product.biz.dataobject.spu; import cn.iocoder.mall.mybatis.dataobject.DeletableDO; import lombok.Data; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/UserProductSpuCollectionsDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/UserProductSpuCollectionsDO.java similarity index 95% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/UserProductSpuCollectionsDO.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/UserProductSpuCollectionsDO.java index eb1c3fd2d..abbc1435a 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/UserProductSpuCollectionsDO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/UserProductSpuCollectionsDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.dataobject.product; +package cn.iocoder.mall.product.biz.dataobject.spu; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductStockDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/stock/ProductStockDO.java similarity index 92% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductStockDO.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/stock/ProductStockDO.java index b1da3fd51..b56005915 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductStockDO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/stock/ProductStockDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.dataobject.product; +package cn.iocoder.mall.product.biz.dataobject.stock; import lombok.Data; import lombok.experimental.Accessors; 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/attr/ProductAttrService.java similarity index 97% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductAttrService.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/attr/ProductAttrService.java index 4cb93a0d9..32ade77fa 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/attr/ProductAttrService.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.service.product; +package cn.iocoder.mall.product.biz.service.attr; import cn.iocoder.common.framework.constant.CommonStatusEnum; import cn.iocoder.common.framework.validator.InEnum; 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/attr/ProductAttrServiceImpl.java similarity index 95% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductAttrServiceImpl.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/attr/ProductAttrServiceImpl.java index 2c493eaaf..4551e9f2f 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/attr/ProductAttrServiceImpl.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.service.product.impl; +package cn.iocoder.mall.product.biz.service.attr; import cn.iocoder.common.framework.util.CollectionUtil; import cn.iocoder.common.framework.util.ServiceExceptionUtil; @@ -10,14 +10,13 @@ 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.convert.attr.ProductAttrConvert; -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.dao.attr.ProductAttrMapper; +import cn.iocoder.mall.product.biz.dao.attr.ProductAttrValueMapper; +import cn.iocoder.mall.product.biz.dataobject.attr.ProductAttrDO; +import cn.iocoder.mall.product.biz.dataobject.attr.ProductAttrValueDO; 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; +import cn.iocoder.mall.product.biz.enums.attr.ProductAttrConstants; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -32,8 +31,8 @@ import java.util.stream.Collectors; /** * 商品规格 Service 实现类 * - * @see cn.iocoder.mall.product.biz.dataobject.product.ProductAttrDO - * @see cn.iocoder.mall.product.biz.dataobject.product.ProductAttrValueDO + * @see ProductAttrDO + * @see ProductAttrValueDO */ @Service public class ProductAttrServiceImpl implements ProductAttrService { diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductBrandService.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandService.java similarity index 95% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductBrandService.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandService.java index 711158054..d2a60d0ab 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductBrandService.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandService.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.service.product; +package cn.iocoder.mall.product.biz.service.brand; import cn.iocoder.common.framework.vo.PageResult; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductBrandServiceImpl.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandServiceImpl.java similarity index 91% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductBrandServiceImpl.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandServiceImpl.java index fd97831e7..6cecf2b16 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductBrandServiceImpl.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandServiceImpl.java @@ -1,17 +1,16 @@ -package cn.iocoder.mall.product.biz.service.product.impl; +package cn.iocoder.mall.product.biz.service.brand; 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.brand.ProductBrandBO; import cn.iocoder.mall.product.biz.convert.brand.ProductBrandConvert; -import cn.iocoder.mall.product.biz.dao.product.ProductBrandMapper; -import cn.iocoder.mall.product.biz.dataobject.product.ProductBrandDO; +import cn.iocoder.mall.product.biz.dao.brand.ProductBrandMapper; +import cn.iocoder.mall.product.biz.dataobject.brand.ProductBrandDO; import cn.iocoder.mall.product.biz.dto.brand.ProductBrandAddDTO; import cn.iocoder.mall.product.biz.dto.brand.ProductBrandPageDTO; import cn.iocoder.mall.product.biz.dto.brand.ProductBrandUpdateDTO; import cn.iocoder.mall.product.biz.enums.ProductErrorCodeEnum; -import cn.iocoder.mall.product.biz.service.product.ProductBrandService; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import org.springframework.beans.factory.annotation.Autowired; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductCategoryService.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryService.java similarity index 92% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductCategoryService.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryService.java index e05b48b98..2590d78bc 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductCategoryService.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryService.java @@ -1,10 +1,11 @@ -package cn.iocoder.mall.product.biz.service.product; +package cn.iocoder.mall.product.biz.service.category; import cn.iocoder.mall.product.biz.bo.category.ProductCategoryBO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryAddDTO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryDeleteDTO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateDTO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateStatusDTO; +import org.springframework.validation.annotation.Validated; import javax.validation.Valid; import java.util.List; @@ -15,6 +16,7 @@ import java.util.List; * @Date: 2020/5/6 * @Description: 商品分类 - 服务层 */ +@Validated public interface ProductCategoryService { /** diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductCategoryServiceImpl.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryServiceImpl.java similarity index 82% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductCategoryServiceImpl.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryServiceImpl.java index deedebddc..31e34bcef 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductCategoryServiceImpl.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryServiceImpl.java @@ -1,22 +1,21 @@ -package cn.iocoder.mall.product.biz.service.product.impl; +package cn.iocoder.mall.product.biz.service.category; import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; import cn.iocoder.mall.product.biz.bo.category.ProductCategoryBO; import cn.iocoder.mall.product.biz.convert.category.ProductCategoryConvert; -import cn.iocoder.mall.product.biz.dao.product.ProductCategoryMapper; -import cn.iocoder.mall.product.biz.dataobject.product.ProductCategoryDO; +import cn.iocoder.mall.product.biz.dao.category.ProductCategoryMapper; +import cn.iocoder.mall.product.biz.dataobject.category.ProductCategoryDO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryAddDTO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryDeleteDTO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateDTO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateStatusDTO; -import cn.iocoder.mall.product.biz.enums.product.ProductCategoryConstants; -import cn.iocoder.mall.product.biz.service.product.ProductCategoryService; +import cn.iocoder.mall.product.biz.enums.category.ProductCategoryConstants; +import cn.iocoder.mall.product.biz.enums.category.ProductCategoryStatusEnum; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - +import java.util.Arrays; import java.util.Date; import java.util.List; @@ -28,7 +27,6 @@ import static cn.iocoder.mall.product.biz.enums.ProductErrorCodeEnum.*; * @Description: 商品分类 - 服务实现层 */ @Service -@Validated public class ProductCategoryServiceImpl implements ProductCategoryService { @Autowired @@ -55,7 +53,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { validParent(productCategoryAddDTO.getPid()); // 保存到数据库 ProductCategoryDO productCategory = ProductCategoryConvert.INSTANCE.convertToDO(productCategoryAddDTO) - .setStatus(ProductCategoryConstants.STATUS_ENABLE); + .setStatus(ProductCategoryStatusEnum.ENABLED.getStatus()); productCategory.setCreateTime(new Date()); productCategory.setDeleted(DeletedStatusEnum.DELETED_NO.getValue()); productCategoryMapper.insert(productCategory); @@ -87,8 +85,8 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_PARENT_NOT_EXISTS); } // 更新到数据库 - ProductCategoryDO productCategoryDO = ProductCategoryConvert.INSTANCE.convertToDO(productCategoryUpdateDTO); - productCategoryMapper.updateById(productCategoryDO); + ProductCategoryDO updateProductCategory = ProductCategoryConvert.INSTANCE.convertToDO(productCategoryUpdateDTO); + productCategoryMapper.updateById(updateProductCategory); // TODO 伟帆 操作日志 return true; } @@ -100,25 +98,22 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { */ @Override public Boolean updateProductCategoryStatus(ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO) { - Integer productCategoryId = productCategoryUpdateStatusDTO.getId(); - Integer status = productCategoryUpdateStatusDTO.getStatus(); // 校验商品分类是否存在 - ProductCategoryDO productCategoryDO = productCategoryMapper.selectById(productCategoryId); + ProductCategoryDO productCategoryDO = productCategoryMapper.selectById(productCategoryUpdateStatusDTO.getId()); if (productCategoryDO == null) { throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_NOT_EXISTS); } // 判断更新状态是否存在 - if (!ProductCategoryConstants.STATUS_ENABLE.equals(status) - && !ProductCategoryConstants.STATUS_DISABLE.equals(status)) { + if (Arrays.stream(ProductCategoryStatusEnum.ARRAYS).noneMatch(status -> status == productCategoryUpdateStatusDTO.getStatus())) { throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_STATUS_NOT_EXISTS); } // 如果状态相同,则返回错误 - if (productCategoryDO.getStatus().equals(status)) { + if (productCategoryDO.getStatus().equals(productCategoryUpdateStatusDTO.getStatus())) { throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_STATUS_EQUALS); } - // 更新商品分类 - productCategoryDO.setId(productCategoryId).setStatus(status); - productCategoryMapper.updateById(productCategoryDO); + // 更新商品分类状态 + ProductCategoryDO updateCategoryStatus = ProductCategoryConvert.INSTANCE.convertToDO(productCategoryUpdateStatusDTO); + productCategoryMapper.updateById(updateCategoryStatus); // TODO 伟帆 操作日志 return true; } @@ -137,7 +132,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_NOT_EXISTS); } // 只有禁用的商品分类才可以删除 - if (ProductCategoryConstants.STATUS_ENABLE.equals(productCategory.getStatus())) { + if (ProductCategoryStatusEnum.ENABLED.getStatus().equals(productCategory.getStatus())) { throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_DELETE_ONLY_DISABLE); } // 只有不存在子分类才可以删除 diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductSpuService.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/spu/ProductSpuService.java similarity index 83% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductSpuService.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/spu/ProductSpuService.java index 696ae9e5d..3119fa85e 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductSpuService.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/spu/ProductSpuService.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.product.biz.service.product; +package cn.iocoder.mall.product.biz.service.spu; import cn.iocoder.mall.product.biz.bo.product.ProductSpuDetailBO; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductSpuServiceImpl.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/spu/ProductSpuServiceImpl.java similarity index 76% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductSpuServiceImpl.java rename to product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/spu/ProductSpuServiceImpl.java index 4bbe44599..c4f111329 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductSpuServiceImpl.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/spu/ProductSpuServiceImpl.java @@ -1,20 +1,19 @@ -package cn.iocoder.mall.product.biz.service.product.impl; +package cn.iocoder.mall.product.biz.service.spu; import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.util.StringUtil; import cn.iocoder.mall.product.biz.bo.product.ProductAttrAndValuePairBO; import cn.iocoder.mall.product.biz.bo.product.ProductSpuDetailBO; import cn.iocoder.mall.product.biz.convert.product.ProductSpuConvert; -import cn.iocoder.mall.product.biz.dao.product.ProductCategoryMapper; -import cn.iocoder.mall.product.biz.dao.product.ProductSkuMapper; -import cn.iocoder.mall.product.biz.dao.product.ProductSpuMapper; -import cn.iocoder.mall.product.biz.dataobject.product.ProductCategoryDO; -import cn.iocoder.mall.product.biz.dataobject.product.ProductSkuDO; -import cn.iocoder.mall.product.biz.dataobject.product.ProductSpuDO; +import cn.iocoder.mall.product.biz.dao.category.ProductCategoryMapper; +import cn.iocoder.mall.product.biz.dao.spu.ProductSkuMapper; +import cn.iocoder.mall.product.biz.dao.spu.ProductSpuMapper; +import cn.iocoder.mall.product.biz.dataobject.category.ProductCategoryDO; +import cn.iocoder.mall.product.biz.dataobject.spu.ProductSkuDO; +import cn.iocoder.mall.product.biz.dataobject.spu.ProductSpuDO; import cn.iocoder.mall.product.biz.enums.ProductErrorCodeEnum; -import cn.iocoder.mall.product.biz.enums.product.ProductSpuConstants; -import cn.iocoder.mall.product.biz.service.product.ProductAttrService; -import cn.iocoder.mall.product.biz.service.product.ProductSpuService; +import cn.iocoder.mall.product.biz.enums.spu.ProductSpuConstants; +import cn.iocoder.mall.product.biz.service.attr.ProductAttrService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.Assert; diff --git a/product/product-biz/src/main/resources/mapper/ProductSpuMapper.xml b/product/product-biz/src/main/resources/mapper/ProductSpuMapper.xml index dc3d2b7c7..7289e7d6d 100644 --- a/product/product-biz/src/main/resources/mapper/ProductSpuMapper.xml +++ b/product/product-biz/src/main/resources/mapper/ProductSpuMapper.xml @@ -1,6 +1,6 @@ - + diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/attr/AdminsProductAttrController.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/attr/AdminsProductAttrController.java index ed1d27911..ce06cba69 100644 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/attr/AdminsProductAttrController.java +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/attr/AdminsProductAttrController.java @@ -7,7 +7,7 @@ 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.biz.service.attr.ProductAttrService; import cn.iocoder.mall.product.rest.convert.attr.ProductAttrConvert; import cn.iocoder.mall.product.rest.request.attr.ProductAttrPageRequest; import cn.iocoder.mall.product.rest.request.attr.ProductAttrAddRequest; diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/brand/AdminsProductBrandController.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/brand/AdminsProductBrandController.java index 8c8770354..79814d9f3 100644 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/brand/AdminsProductBrandController.java +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/brand/AdminsProductBrandController.java @@ -6,7 +6,7 @@ import cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO; import cn.iocoder.mall.product.biz.dto.brand.ProductBrandAddDTO; import cn.iocoder.mall.product.biz.dto.brand.ProductBrandPageDTO; import cn.iocoder.mall.product.biz.dto.brand.ProductBrandUpdateDTO; -import cn.iocoder.mall.product.biz.service.product.ProductBrandService; +import cn.iocoder.mall.product.biz.service.brand.ProductBrandService; import cn.iocoder.mall.product.rest.convert.brand.ProductBrandConvert; import cn.iocoder.mall.product.rest.request.brand.ProductBrandAddRequest; import cn.iocoder.mall.product.rest.request.brand.ProductBrandPageRequest; diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/category/AdminsProductCategoryController.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/category/AdminsProductCategoryController.java index 96d548d7f..daf7b64d9 100644 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/category/AdminsProductCategoryController.java +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/category/AdminsProductCategoryController.java @@ -7,9 +7,9 @@ import cn.iocoder.mall.product.biz.dto.category.ProductCategoryAddDTO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryDeleteDTO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateDTO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateStatusDTO; -import cn.iocoder.mall.product.biz.enums.product.ProductCategoryConstants; -import cn.iocoder.mall.product.biz.service.product.ProductCategoryService; -import cn.iocoder.mall.product.rest.convert.category.ProductCategoryConvert; +import cn.iocoder.mall.product.biz.enums.category.ProductCategoryConstants; +import cn.iocoder.mall.product.biz.service.category.ProductCategoryService; +import cn.iocoder.mall.product.rest.convert.category.AdminsProductCategoryConvert; import cn.iocoder.mall.product.rest.request.category.AdminsProductCategoryAddRequest; import cn.iocoder.mall.product.rest.request.category.AdminsProductCategoryUpdateRequest; import cn.iocoder.mall.product.rest.request.category.AdminsProductCategoryUpdateStatusRequest; @@ -46,7 +46,7 @@ public class AdminsProductCategoryController { public CommonResult> tree() { List productCategories = productCategoryService.getAllProductCategory(); // 创建 ProductCategoryTreeNodeVO Map - Map treeNodeMap = productCategories.stream().collect(Collectors.toMap(ProductCategoryBO::getId, ProductCategoryConvert.INSTANCE::convertToTreeNodeResponse)); + Map treeNodeMap = productCategories.stream().collect(Collectors.toMap(ProductCategoryBO::getId, AdminsProductCategoryConvert.INSTANCE::convertToTreeNodeResponse)); // 处理父子关系 treeNodeMap.values().stream() .filter(node -> !node.getPid().equals(ProductCategoryConstants.PID_ROOT)) @@ -71,18 +71,18 @@ public class AdminsProductCategoryController { @ApiOperation(value = "创建商品分类") public CommonResult add(AdminsProductCategoryAddRequest adminsProductCategoryAddRequest) { // 转换 ProductCategoryAddDTO 对象 - ProductCategoryAddDTO productCategoryAddDTO = ProductCategoryConvert.INSTANCE.convertToAddDTO(AdminSecurityContextHolder.getContext().getAdminId(), adminsProductCategoryAddRequest); + ProductCategoryAddDTO productCategoryAddDTO = AdminsProductCategoryConvert.INSTANCE.convertToAddDTO(AdminSecurityContextHolder.getContext().getAdminId(), adminsProductCategoryAddRequest); // 创建商品分类 ProductCategoryBO addProductCategoryBO = productCategoryService.addProductCategory(productCategoryAddDTO); // 返回结果 - return success(ProductCategoryConvert.INSTANCE.convertToAddResponse(addProductCategoryBO)); + return success(AdminsProductCategoryConvert.INSTANCE.convertToAddResponse(addProductCategoryBO)); } @PostMapping("/update") @ApiOperation(value = "更新商品分类") public CommonResult update(AdminsProductCategoryUpdateRequest adminsProductCategoryUpdateRequest) { // 创建 ProductCategoryUpdateDTO 对象 - ProductCategoryUpdateDTO productCategoryUpdateDTO = ProductCategoryConvert.INSTANCE.convertToUpdateDTO(AdminSecurityContextHolder.getContext().getAdminId(), adminsProductCategoryUpdateRequest); + ProductCategoryUpdateDTO productCategoryUpdateDTO = AdminsProductCategoryConvert.INSTANCE.convertToUpdateDTO(AdminSecurityContextHolder.getContext().getAdminId(), adminsProductCategoryUpdateRequest); // 更新商品分类 return success(productCategoryService.updateProductCategory(productCategoryUpdateDTO)); } @@ -91,7 +91,7 @@ public class AdminsProductCategoryController { @ApiOperation(value = "更新商品分类状态") public CommonResult updateStatus(AdminsProductCategoryUpdateStatusRequest adminsProductCategoryUpdateStatusRequest) { // 创建 ProductCategoryUpdateStatusDTO 对象 - ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO = ProductCategoryConvert.INSTANCE.convertToUpdateStatusDTO(AdminSecurityContextHolder.getContext().getAdminId(), + ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO = AdminsProductCategoryConvert.INSTANCE.convertToUpdateStatusDTO(AdminSecurityContextHolder.getContext().getAdminId(), adminsProductCategoryUpdateStatusRequest); // 更新商品分类状态 return success(productCategoryService.updateProductCategoryStatus(productCategoryUpdateStatusDTO)); @@ -102,7 +102,7 @@ public class AdminsProductCategoryController { @ApiImplicitParam(name = "id", value = "商品分类编号", required = true, example = "1") public CommonResult delete(@RequestParam("id") Integer id) { // 创建 ProductCategoryDeleteDTO 对象 - ProductCategoryDeleteDTO productCategoryDeleteDTO = ProductCategoryConvert.INSTANCE.convertToDeleteDTO(AdminSecurityContextHolder.getContext().getAdminId(), id); + ProductCategoryDeleteDTO productCategoryDeleteDTO = AdminsProductCategoryConvert.INSTANCE.convertToDeleteDTO(AdminSecurityContextHolder.getContext().getAdminId(), id); // 删除商品分类 return success(productCategoryService.deleteProductCategory(productCategoryDeleteDTO)); } diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/convert/category/ProductCategoryConvert.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/convert/category/AdminsProductCategoryConvert.java similarity index 92% rename from product/product-rest/src/main/java/cn/iocoder/mall/product/rest/convert/category/ProductCategoryConvert.java rename to product/product-rest/src/main/java/cn/iocoder/mall/product/rest/convert/category/AdminsProductCategoryConvert.java index 50cddef0b..200119eab 100644 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/convert/category/ProductCategoryConvert.java +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/convert/category/AdminsProductCategoryConvert.java @@ -16,12 +16,12 @@ import org.mapstruct.factory.Mappers; /** * @Author: jiangweifan * @Date: 2020/5/6 - * @Description: 商品分类 - API层数据转换 + * @Description: 管理员 - 商品分类 - API层数据转换 */ @Mapper -public interface ProductCategoryConvert { +public interface AdminsProductCategoryConvert { - ProductCategoryConvert INSTANCE = Mappers.getMapper(ProductCategoryConvert.class); + AdminsProductCategoryConvert INSTANCE = Mappers.getMapper(AdminsProductCategoryConvert.class); /** * 商品分类列表 - BO转换Response diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryAddRequest.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryAddRequest.java index 367032123..65e9e4cfe 100644 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryAddRequest.java +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryAddRequest.java @@ -10,7 +10,7 @@ import javax.validation.constraints.NotNull; /** * @Author: jiangweifan * @Date: 2020/5/6 - * @Description: 商品分类 - 创建商品分类Request + * @Description: 管理员 - 商品分类 - 创建商品分类Request */ @ApiModel("创建商品分类Request") @Data diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateRequest.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateRequest.java index 27dd4a6ff..c16e4abbf 100644 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateRequest.java +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateRequest.java @@ -10,7 +10,7 @@ import javax.validation.constraints.NotNull; /** * @Author: jiangweifan * @Date: 2020/5/6 - * @Description: 商品分类 - 更新商品分类Request + * @Description: 管理员 - 商品分类 - 更新商品分类Request */ @ApiModel("更新商品分类Request") @Data diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateStatusRequest.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateStatusRequest.java index d572e89ba..82106b636 100644 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateStatusRequest.java +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/request/category/AdminsProductCategoryUpdateStatusRequest.java @@ -10,7 +10,7 @@ import javax.validation.constraints.NotNull; /** * @Author: jiangweifan * @Date: 2020/5/6 - * @Description: 商品分类 - 更新商品分类状态Request + * @Description: 管理员 - 商品分类 - 更新商品分类状态Request */ @ApiModel("更新商品分类状态Request") @Data diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryAddResponse.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryAddResponse.java index b86b6e2aa..3b713e3a4 100644 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryAddResponse.java +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryAddResponse.java @@ -9,7 +9,7 @@ import java.util.Date; /** * @Author: jiangweifan * @Date: 2020/5/6 - * @Description: 商品分类 - 新增商品分类Response + * @Description: 管理员 - 商品分类 - 新增商品分类Response */ @ApiModel("创建商品分类Response") @Data diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryTreeNodeResponse.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryTreeNodeResponse.java index 24ed628ad..c6ec1b782 100644 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryTreeNodeResponse.java +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/response/category/AdminsProductCategoryTreeNodeResponse.java @@ -11,7 +11,7 @@ import java.util.List; /** * @Author: jiangweifan * @Date: 2020/5/6 - * @Description: 商品分类 - 分类树Response + * @Description: 管理员 - 商品分类 - 分类树Response */ @ApiModel("商品分类树节点") @Data diff --git a/product/product-rpc/src/main/java/cn/iocoder/mall/product/rpc/rpc/ProductSpuRpcImpl.java b/product/product-rpc/src/main/java/cn/iocoder/mall/product/rpc/rpc/ProductSpuRpcImpl.java index 04af31b0c..69449c6a9 100644 --- a/product/product-rpc/src/main/java/cn/iocoder/mall/product/rpc/rpc/ProductSpuRpcImpl.java +++ b/product/product-rpc/src/main/java/cn/iocoder/mall/product/rpc/rpc/ProductSpuRpcImpl.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.product.rpc.rpc; import cn.iocoder.mall.product.biz.bo.product.ProductSpuDetailBO; -import cn.iocoder.mall.product.biz.service.product.ProductSpuService; +import cn.iocoder.mall.product.biz.service.spu.ProductSpuService; import cn.iocoder.mall.product.rpc.api.ProductSpuRpc; import cn.iocoder.mall.product.rpc.convert.ProductSpuConvert; import cn.iocoder.mall.product.rpc.response.ProductSpuDetailResponse; diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/user/UserService.java b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/user/UserService.java index aefeeff25..2bc3173f7 100644 --- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/user/UserService.java +++ b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/user/UserService.java @@ -7,10 +7,13 @@ import cn.iocoder.mall.system.biz.dto.oatuh2.OAuth2MobileCodeAuthenticateDTO; import cn.iocoder.mall.system.biz.dto.user.UserPageDTO; import cn.iocoder.mall.system.biz.dto.user.UserUpdateDTO; import cn.iocoder.mall.system.biz.dto.user.UserUpdateStatusDTO; +import org.springframework.validation.annotation.Validated; +import javax.validation.Valid; /** * 用户 Service 接口 */ +@Validated public interface UserService { UserAuthenticateBO authenticate(OAuth2MobileCodeAuthenticateDTO authenticateDTO); @@ -29,13 +32,13 @@ public interface UserService { * @param userUpdateDTO * @return */ - Boolean updateUserInfo(UserUpdateDTO userUpdateDTO); + Boolean updateUserInfo(@Valid UserUpdateDTO userUpdateDTO); /** * 更新用户状态 * @param userUpdateStatusDTO * @return */ - Boolean updateUserStatus(UserUpdateStatusDTO userUpdateStatusDTO); + Boolean updateUserStatus(@Valid UserUpdateStatusDTO userUpdateStatusDTO); }