@ValidatedMulti-layer verification, I don’t read the documentation, I just piece it together, I know that this thing is very useful.
But how to verify the properties of object parameters is difficult.
Baidu -
It’s it, it’s it, it’s it╮ ( ̄▽  ̄)╭ @Valid
request
public class xxxxxxxxxxxRequest implements Serializable {
private static final long serialVersionUID = 1L;
@NotBlank(message = "xxxx不能为空")
private String bidSeq;
@NotBlank(message = "xxxxxx不能为空")
private String quoteSeq;
@Valid
private QuotePrice quotePrice;
@Valid
private List<QuotePrice> quotePrices;
public static class QuotePrice implements Serializable {
private static final long serialVersionUID = 1L;
@NotBlank(message = "报价单项号不能为null")
private String quoteItemSeq;
@NotNull(message = "报价类型不能为null")
private Integer priceType;
@NotBlank(message = "报价金额不能为null")
private String price;
}
}
controller
@RequestMapping("/xxxxx")
public Result<Object> xxxxx(@Validated @RequestBody xxxxxxxxxxxRequest request){
return programBidProductService.xxxxx(request);
}