From 80c8dd3553aa8864218f36c9397c7361be4db869 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Fri, 8 May 2020 07:32:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=86=E7=B1=BB=EF=BC=8C?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=20REVIEW?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/product/biz/bo/category/ProductCategoryAddBO.java | 1 + .../product/biz/bo/category/ProductCategoryAllListBO.java | 1 + .../mall/product/biz/dto/category/ProductCategoryAddDTO.java | 1 + .../biz/service/product/impl/ProductCategoryServiceImpl.java | 5 +++-- .../request/category/AdminsProductCategoryAddRequest.java | 2 ++ 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/category/ProductCategoryAddBO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/category/ProductCategoryAddBO.java index 5aa2cf611..569d72d24 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/category/ProductCategoryAddBO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/category/ProductCategoryAddBO.java @@ -12,6 +12,7 @@ import java.util.Date; */ @Data @Accessors(chain = true) +// TODO FROM 芋艿 to 伟帆,BO 可以不加 Serializable 接口,因为没序列化的诉求哈。一般 BO 可以创建一个统一的 ProductCategory,可以把 ProductCategoryAllListBO 合并过来 public class ProductCategoryAddBO implements Serializable { /** diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/category/ProductCategoryAllListBO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/category/ProductCategoryAllListBO.java index 8b568fb51..9d6666e5e 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/category/ProductCategoryAllListBO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/category/ProductCategoryAllListBO.java @@ -12,6 +12,7 @@ import java.util.Date; */ @Data @Accessors(chain = true) +// TODO FROM 芋艿 to 伟帆, public class ProductCategoryAllListBO implements Serializable { /** diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryAddDTO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryAddDTO.java index 237aab09d..2a78ceac3 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryAddDTO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dto/category/ProductCategoryAddDTO.java @@ -15,6 +15,7 @@ public class ProductCategoryAddDTO { /** * 管理员id */ + // TODO FROM 芋艿 to 伟帆:传入 Service 的,要加下 Validation 的注解,虽然 Controller 那也添加了 Validation,但是相比来说,Service 更应该被保护,嘿嘿。因为一些时候,Service 也会被别人所调用,所以要保护好自己。 private Integer adminId; /** 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/product/impl/ProductCategoryServiceImpl.java index ca377b6cf..7f2148fa1 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/product/impl/ProductCategoryServiceImpl.java @@ -18,8 +18,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.sql.Wrapper; -import java.util.*; +import java.util.Date; +import java.util.List; /** * @Author: jiangweifan @@ -168,6 +168,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { } // 父分类必须是一级分类 if (!ProductCategoryConstants.PID_ROOT.equals(parentCategory.getPid())) { + // TODO FROM 芋艿 to 伟帆,ProductErrorCodeEnum 去实现下 ServiceExceptionUtil.Enumerable 接口,酱紫就不用 .getCode() 方法,代码会更简洁。同时,可以把 ProductErrorCodeEnum static import 下, throw ServiceExceptionUtil.exception((ProductErrorCodeEnum.PRODUCT_CATEGORY_PARENT_CAN_NOT_BE_LEVEL2.getCode())); } } 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 a9bd29c2a..3e6c8920d 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 @@ -16,6 +16,8 @@ import javax.validation.constraints.NotNull; @Data @Accessors(chain = true) public class AdminsProductCategoryAddRequest { + + // TODO FROM 芋艿 to 伟帆:写了 swagger 注解,我们可以少写一份 Java 注释。 /** * 父分类编号 */