@valid 分组实现不同的接口校验范围不同
- https://www.shuzhiduo.com/A/QW5Y7MbKzm/
@ApiOperation(value = "创建数据") @PostMapping("/create") public R<Boolean> create(@RequestBody @Validated({OrderInvoiceValidGroup.class}) OrderInvoiceParam param) { return R.status(psfOrderInvoiceService.create(param)); }
@Data @JsonInclude(JsonInclude.Include.NON_NULL) public class OrderInvoiceParam extends OrderInvoiceCommonParam implements OrderInvoiceValidGroup { }
public interface OrderInvoiceValidGroup extends Default { }
@ApiModelProperty("类型1:增值税专用发票,2增值税普通发票") @Enum(OrderInvoiceType.class) @NotNull(groups = OrderInvoiceValidGroup.class, message = "类型不允许为空") private Integer type;