是的,我已经看过这个了。但我的情况与此不同。在那里,场景中是否有请求参数。但是在我的例子中,我想根据@requestparam的值对@requestbody进行不同的验证。这是可以实现的吗?
@PostMapping("/supplier")
@ApiOperation(value = "Get local attributes of a supplier(s)", notes = "Returns the sms attributes of supplier", response = LocalDTO.class)
public @ResponseBody
ResponseEntity<ResponseDTO> getSmsForShippingPoint(
@ApiParam(value = "Search By", required = true) @RequestParam(name = "searchBy") String searchBy,
@ApiParam(value = "Suvc, Suffix, Site and SmsVendor", required = true) @RequestBody @Valid RequestSmsDTO requestSmsDTO) throws ValidationException {
if(searchBy.equals("shipping-point")){
ResponseDTO smsResponseDTO = supplierService.findSmsByShippingPoint(requestSmsDTO);
return ResponseEntity.status(HttpStatus.OK)
.body(smsResponseDTO);
}
return null;
}
所以基于 searchBy
我需要对requestbody执行不同的验证。就我而言 RequestSmsDTO
对象
暂无答案!
目前还没有任何答案,快来回答吧!