@Data
public class OrderSpecificationParam {
@Min(value = 1,message = "长度不能为0")
@NotNull(message = "长")
@ApiModelProperty(value = "长", required = true)
private Integer length;
@Min(value = 1,message = "宽度不能为0")
@NotNull(message = "宽")
@ApiModelProperty(value = "宽", required = true)
private Integer width;
@Min(value = 1,message = "所需数量不能为0")
@NotNull(message = "所需数量")
@ApiModelProperty(value = "所需数量", required = true)
private Integer quantity;
}
@Data
public class CreateOrderParam {
@NotNull(message = "间隔条类型")
@ApiModelProperty(value = "间隔条类型", required = true)
private Integer firstStepRadioActive;
@NotNull(message = "玻璃类型")
@ApiModelProperty(value = "玻璃类型", required = true)
private Integer secondStepRadioActive;
@NotNull(message = "二道胶厚度")
@ApiModelProperty(value = "二道胶厚度", required = true)
private Integer thirdStepRadioActive;
@NotNull(message = "上传数据方式")
@ApiModelProperty(value = "上传数据方式", required = true)
private Integer fourthStepRadioActive;
@NotNull(message = "规格数据不能为空")
@Size(min = 1,message = "规格至数据少有一条")
private List<@Valid OrderSpecificationParam> specification;
}
List参数要对泛型加上@Valid注解,才能让OrderSpecificationParam进行验证
如果List的泛型不是自定义对象。可以直接在泛型上加对应的注解:
List<@NotNull String> list;
网友评论