1、controller層
@ApiOperation(value = "接口")
@PostMapping("/ygbx/regular")
public Long regular(@Validated @RequestBody OrderCheckRegularVO vo) {
return orderCheckService.saveRegular(vo);
}
2、主VO
解決方案:在主VO內部的VO聲明時候加上 @Valid
@Data
@ApiModel(description = "主VO")
public class OrderCheckRegularVO extends OrderCheckBaseVO {
@NotNull
@Valid
private ProductYgbxRegularVO price;
@NotNull
@Valid
private OrderCheckRegularPolicyInfoVO policyInfo;
@NotNull
@Valid
private OrderCheckChargeInfoVO chargeInfo;
@NotNull
@Valid
private OrderCheckBenefitTotalVO benefitInfo;
@NotEmpty
@Valid
private List<OrderCheckKindVO> kindList;
}