分类信息保存增加校验
This commit is contained in:
parent
e5b9280b7e
commit
738a95edb6
@ -11,6 +11,7 @@ import lombok.NoArgsConstructor;
|
|||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@ -35,18 +36,23 @@ public class Category extends BaseEntity {
|
|||||||
@ApiModelProperty(value = "分类名称")
|
@ApiModelProperty(value = "分类名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@NotEmpty(message = "请选择父分类")
|
||||||
@ApiModelProperty(value = "父id, 根节点为0")
|
@ApiModelProperty(value = "父id, 根节点为0")
|
||||||
private String parentId;
|
private String parentId;
|
||||||
|
|
||||||
|
@NotNull(message = "层级不能为空")
|
||||||
@ApiModelProperty(value = "层级, 从0开始")
|
@ApiModelProperty(value = "层级, 从0开始")
|
||||||
private Integer level;
|
private Integer level;
|
||||||
|
|
||||||
|
@NotNull(message = "排序值不能为空")
|
||||||
@ApiModelProperty(value = "排序值")
|
@ApiModelProperty(value = "排序值")
|
||||||
private BigDecimal sortOrder;
|
private BigDecimal sortOrder;
|
||||||
|
|
||||||
|
@NotNull(message = "请填写佣金比例")
|
||||||
@ApiModelProperty(value = "佣金比例")
|
@ApiModelProperty(value = "佣金比例")
|
||||||
private Double commissionRate;
|
private Double commissionRate;
|
||||||
|
|
||||||
|
@NotEmpty(message = "分类图标不能为空")
|
||||||
@ApiModelProperty(value = "分类图标")
|
@ApiModelProperty(value = "分类图标")
|
||||||
private String image;
|
private String image;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public class CategoryManagerController {
|
|||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@ApiOperation(value = "修改商品分类")
|
@ApiOperation(value = "修改商品分类")
|
||||||
public ResultMessage<Category> updateCategory(CategoryVO category) {
|
public ResultMessage<Category> updateCategory(@Valid CategoryVO category) {
|
||||||
Category catTemp = categoryService.getById(category.getId());
|
Category catTemp = categoryService.getById(category.getId());
|
||||||
if (catTemp == null) {
|
if (catTemp == null) {
|
||||||
throw new ServiceException(ResultCode.CATEGORY_PARENT_NOT_EXIST);
|
throw new ServiceException(ResultCode.CATEGORY_PARENT_NOT_EXIST);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user