提交 80c8dd35 authored 作者: YunaiV's avatar YunaiV

商品分类,代码 REVIEW

上级 016600ab
...@@ -12,6 +12,7 @@ import java.util.Date; ...@@ -12,6 +12,7 @@ import java.util.Date;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
// TODO FROM 芋艿 to 伟帆,BO 可以不加 Serializable 接口,因为没序列化的诉求哈。一般 BO 可以创建一个统一的 ProductCategory,可以把 ProductCategoryAllListBO 合并过来
public class ProductCategoryAddBO implements Serializable { public class ProductCategoryAddBO implements Serializable {
/** /**
......
...@@ -12,6 +12,7 @@ import java.util.Date; ...@@ -12,6 +12,7 @@ import java.util.Date;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
// TODO FROM 芋艿 to 伟帆,
public class ProductCategoryAllListBO implements Serializable { public class ProductCategoryAllListBO implements Serializable {
/** /**
......
...@@ -15,6 +15,7 @@ public class ProductCategoryAddDTO { ...@@ -15,6 +15,7 @@ public class ProductCategoryAddDTO {
/** /**
* 管理员id * 管理员id
*/ */
// TODO FROM 芋艿 to 伟帆:传入 Service 的,要加下 Validation 的注解,虽然 Controller 那也添加了 Validation,但是相比来说,Service 更应该被保护,嘿嘿。因为一些时候,Service 也会被别人所调用,所以要保护好自己。
private Integer adminId; private Integer adminId;
/** /**
......
...@@ -18,8 +18,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -18,8 +18,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.sql.Wrapper; import java.util.Date;
import java.util.*; import java.util.List;
/** /**
* @Author: jiangweifan * @Author: jiangweifan
...@@ -168,6 +168,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { ...@@ -168,6 +168,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
} }
// 父分类必须是一级分类 // 父分类必须是一级分类
if (!ProductCategoryConstants.PID_ROOT.equals(parentCategory.getPid())) { 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())); throw ServiceExceptionUtil.exception((ProductErrorCodeEnum.PRODUCT_CATEGORY_PARENT_CAN_NOT_BE_LEVEL2.getCode()));
} }
} }
......
...@@ -16,6 +16,8 @@ import javax.validation.constraints.NotNull; ...@@ -16,6 +16,8 @@ import javax.validation.constraints.NotNull;
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
public class AdminsProductCategoryAddRequest { public class AdminsProductCategoryAddRequest {
// TODO FROM 芋艿 to 伟帆:写了 swagger 注解,我们可以少写一份 Java 注释。
/** /**
* 父分类编号 * 父分类编号
*/ */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论