赞
踩
@Data public class Object1 { @Length(max = 50,message = "长度不能超过50位字符") @NotBlank(message = "名称不能为空") private String name; @NotNull(message = "不能为空") private Integer grade; @NotNull(message = "计分展示不能为空") private Integer scoreDimension; @NotNull(message = "obj2s不能为空") @Valid private List<Object2> obj2s; } @Data public class Object2{ @Length(max = 50, message = "长度不能超过50位字符") @NotBlank(message = "分类名称不能为空") private String categoryName; @Valid private List<Object3> obj3s; } @Data public class Object3{ @NotNull(message = "分值不能为空") @Max(value =1000 , message = "分值最大不能超过1000") private Integer score; @Size(max = 500, message = "最多可输入500个字符") private String standards; @Size(max = 10, message = "标最多10条") private String[] urls; @NotNull(message = "不能为空") private Integer[] rating; } //controller校验 @PostMapping("/check") public Result<Void> check( @Validated @RequestBody Object1 obj1) { return servei1.check(obj1); }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。