商品分类,代码 REVIEW 完成
This commit is contained in:
@@ -2,7 +2,7 @@ package cn.iocoder.mall.product.biz.bo.category;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -12,7 +12,6 @@ import java.util.Date;
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
// TODO FROM 芋艿 to 伟帆,BO 可以不加 Serializable 接口,因为没序列化的诉求哈。一般 BO 可以创建一个统一的 ProductCategory,可以把 ProductCategoryAllListBO 合并过来 [DONE]
|
||||
public class ProductCategoryBO {
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,6 @@ public class ProductCategoryAddDTO {
|
||||
/**
|
||||
* 管理员id
|
||||
*/
|
||||
// TODO FROM 芋艿 to 伟帆:传入 Service 的,要加下 Validation 的注解,虽然 Controller 那也添加了 Validation,但是相比来说,Service 更应该被保护,嘿嘿。因为一些时候,Service 也会被别人所调用,所以要保护好自己。[DONE]
|
||||
@NotNull(message = "管理员id不能为空")
|
||||
private Integer adminId;
|
||||
|
||||
|
||||
@@ -16,11 +16,12 @@ 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 static cn.iocoder.mall.product.biz.enums.ProductErrorCodeEnum.*;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.mall.product.biz.enums.ProductErrorCodeEnum.*;
|
||||
|
||||
/**
|
||||
* @Author: jiangweifan
|
||||
* @Date: 2020/5/6
|
||||
@@ -166,7 +167,6 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
|
||||
}
|
||||
// 父分类必须是一级分类
|
||||
if (!ProductCategoryConstants.PID_ROOT.equals(parentCategory.getPid())) {
|
||||
// TODO FROM 芋艿 to 伟帆,ProductErrorCodeEnum 去实现下 ServiceExceptionUtil.Enumerable 接口,酱紫就不用 .getCode() 方法,代码会更简洁。同时,可以把 ProductErrorCodeEnum static import 下,[DONE]
|
||||
throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_PARENT_CAN_NOT_BE_LEVEL2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import javax.validation.constraints.NotNull;
|
||||
@Accessors(chain = true)
|
||||
public class AdminsProductCategoryAddRequest {
|
||||
|
||||
// TODO FROM 芋艿 to 伟帆:写了 swagger 注解,我们可以少写一份 Java 注释。[DONE]
|
||||
@ApiModelProperty(name = "pid", value = "父级分类编号", required = true, example = "1")
|
||||
@NotNull(message = "父分类编号不能为空")
|
||||
private Integer pid;
|
||||
|
||||
Reference in New Issue
Block a user