参数校验注解
This commit is contained in:
parent
26ee625d2a
commit
b61a80d5f5
@ -13,6 +13,7 @@ import com.cdzy.user.service.EbikeFaultReportService;
|
|||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ public class EbikeFaultReportController {
|
|||||||
* @param ebikeFaultReportDto 用户故障上报请求参数
|
* @param ebikeFaultReportDto 用户故障上报请求参数
|
||||||
*/
|
*/
|
||||||
@PostMapping("save")
|
@PostMapping("save")
|
||||||
public JsonResult<?> saveFaultReport(@RequestBody EbikeFaultReportDto ebikeFaultReportDto) {
|
public JsonResult<?> saveFaultReport(@RequestBody @Validated EbikeFaultReportDto ebikeFaultReportDto) {
|
||||||
Long reportId = ebikeFaultReportService.saveFaultReport(ebikeFaultReportDto);
|
Long reportId = ebikeFaultReportService.saveFaultReport(ebikeFaultReportDto);
|
||||||
return JsonResult.success(reportId);
|
return JsonResult.success(reportId);
|
||||||
}
|
}
|
||||||
@ -107,7 +108,7 @@ public class EbikeFaultReportController {
|
|||||||
* @param ebikeFaultReportQueryDto 查询参数
|
* @param ebikeFaultReportQueryDto 查询参数
|
||||||
*/
|
*/
|
||||||
@PostMapping("queryBikeFaultReport")
|
@PostMapping("queryBikeFaultReport")
|
||||||
public JsonResult<?> queryBikeFaultReport(@RequestBody EbikeFaultReportQueryDto ebikeFaultReportQueryDto) {
|
public JsonResult<?> queryBikeFaultReport(@RequestBody @Validated EbikeFaultReportQueryDto ebikeFaultReportQueryDto) {
|
||||||
List<EbikeFaultReportVo> list = ebikeFaultReportService.queryBikeFaultReport(ebikeFaultReportQueryDto);
|
List<EbikeFaultReportVo> list = ebikeFaultReportService.queryBikeFaultReport(ebikeFaultReportQueryDto);
|
||||||
return JsonResult.success(list);
|
return JsonResult.success(list);
|
||||||
}
|
}
|
||||||
@ -131,7 +132,7 @@ public class EbikeFaultReportController {
|
|||||||
* @param ebikeOrderFaultReportDto 订单请求参数
|
* @param ebikeOrderFaultReportDto 订单请求参数
|
||||||
*/
|
*/
|
||||||
@PostMapping("queryOrderFaultReport")
|
@PostMapping("queryOrderFaultReport")
|
||||||
public JsonResult<?> queryFaultReportByUserId(@RequestBody EbikeOrderFaultReportDto ebikeOrderFaultReportDto) {
|
public JsonResult<?> queryFaultReportByUserId(@RequestBody @Validated EbikeOrderFaultReportDto ebikeOrderFaultReportDto) {
|
||||||
Page<EbikeOrderFaultReportVo> faultReportVoPage = ebikeFaultReportService.queryOrderFaultReport(ebikeOrderFaultReportDto);
|
Page<EbikeOrderFaultReportVo> faultReportVoPage = ebikeFaultReportService.queryOrderFaultReport(ebikeOrderFaultReportDto);
|
||||||
return JsonResult.success(faultReportVoPage);
|
return JsonResult.success(faultReportVoPage);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import com.cdzy.user.service.EbikeRefundService;
|
|||||||
import com.ebike.feign.model.vo.FeignEbikeRefundOrderDetailVo;
|
import com.ebike.feign.model.vo.FeignEbikeRefundOrderDetailVo;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@ -41,7 +42,7 @@ public class EbikeRefundController {
|
|||||||
* @return 退款成功返回主键id,否则返回失败
|
* @return 退款成功返回主键id,否则返回失败
|
||||||
*/
|
*/
|
||||||
@PostMapping("/refundApply")
|
@PostMapping("/refundApply")
|
||||||
public JsonResult<?> refundApply(@RequestBody EbikeOrderRefundDto ebikeRefundDto) {
|
public JsonResult<?> refundApply(@RequestBody @Validated EbikeOrderRefundDto ebikeRefundDto) {
|
||||||
Long refundId = ebikeRefundService.refundApply(ebikeRefundDto);
|
Long refundId = ebikeRefundService.refundApply(ebikeRefundDto);
|
||||||
return JsonResult.success(refundId);
|
return JsonResult.success(refundId);
|
||||||
}
|
}
|
||||||
@ -76,7 +77,7 @@ public class EbikeRefundController {
|
|||||||
* @param userQueryDto 查询条件
|
* @param userQueryDto 查询条件
|
||||||
*/
|
*/
|
||||||
@PostMapping("/refundApplyTradeRecord")
|
@PostMapping("/refundApplyTradeRecord")
|
||||||
public JsonResult<?> refundApplyTradeRecord(@RequestBody EbikeTreadRecordDto userQueryDto) {
|
public JsonResult<?> refundApplyTradeRecord(@RequestBody @Validated EbikeTreadRecordDto userQueryDto) {
|
||||||
Page<EbikeTransactionRecordVo> list = ebikeRefundService.queryRefundTradeRecordById(userQueryDto);
|
Page<EbikeTransactionRecordVo> list = ebikeRefundService.queryRefundTradeRecordById(userQueryDto);
|
||||||
return JsonResult.success(list);
|
return JsonResult.success(list);
|
||||||
}
|
}
|
||||||
@ -87,7 +88,7 @@ public class EbikeRefundController {
|
|||||||
* @param userQueryDto 查询条件
|
* @param userQueryDto 查询条件
|
||||||
*/
|
*/
|
||||||
@PostMapping("/refundApplyRefundRecord")
|
@PostMapping("/refundApplyRefundRecord")
|
||||||
public JsonResult<?> refundApplyRefundRecord(@RequestBody EbikeTreadRecordDto userQueryDto) {
|
public JsonResult<?> refundApplyRefundRecord(@RequestBody @Validated EbikeTreadRecordDto userQueryDto) {
|
||||||
Page<EbikeRefundApplyRefundRecordVo> list = ebikeRefundService.queryRefundRefundRecordById(userQueryDto);
|
Page<EbikeRefundApplyRefundRecordVo> list = ebikeRefundService.queryRefundRefundRecordById(userQueryDto);
|
||||||
return JsonResult.success(list);
|
return JsonResult.success(list);
|
||||||
}
|
}
|
||||||
@ -99,7 +100,7 @@ public class EbikeRefundController {
|
|||||||
* @return 退款记录列表 List<OrderRecord>
|
* @return 退款记录列表 List<OrderRecord>
|
||||||
*/
|
*/
|
||||||
@PostMapping("/refundOrderRecords")
|
@PostMapping("/refundOrderRecords")
|
||||||
public JsonResult<?> refundOrderRecords(@RequestBody EbikeTreadRecordDto userQueryDto) {
|
public JsonResult<?> refundOrderRecords(@RequestBody @Validated EbikeTreadRecordDto userQueryDto) {
|
||||||
Page<EbikeOrderRecordVo> list = ebikeRefundService.getRefundOrderRecords(userQueryDto);
|
Page<EbikeOrderRecordVo> list = ebikeRefundService.getRefundOrderRecords(userQueryDto);
|
||||||
return JsonResult.success(list);
|
return JsonResult.success(list);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,13 @@ import com.ebike.feign.clients.OperationsFeignClient;
|
|||||||
import com.ebike.feign.model.dto.FeignEbikeReportRecordDto;
|
import com.ebike.feign.model.dto.FeignEbikeReportRecordDto;
|
||||||
import com.ebike.feign.model.vo.FeignEbikeReportRecordVo;
|
import com.ebike.feign.model.vo.FeignEbikeReportRecordVo;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -59,7 +65,7 @@ public class EbikeReportController {
|
|||||||
* @param feignEbikeReportRecordDto 用户上报信息
|
* @param feignEbikeReportRecordDto 用户上报信息
|
||||||
*/
|
*/
|
||||||
@PostMapping("/saveReport")
|
@PostMapping("/saveReport")
|
||||||
public JsonResult<?> saveReport(@RequestBody FeignEbikeReportRecordDto feignEbikeReportRecordDto) {
|
public JsonResult<?> saveReport(@RequestBody @Validated FeignEbikeReportRecordDto feignEbikeReportRecordDto) {
|
||||||
JsonResult<?> jsonResult = operationsFeignClient.saveReportRecord(feignEbikeReportRecordDto);
|
JsonResult<?> jsonResult = operationsFeignClient.saveReportRecord(feignEbikeReportRecordDto);
|
||||||
if (jsonResult.getCode() != Code.SUCCESS) {
|
if (jsonResult.getCode() != Code.SUCCESS) {
|
||||||
throw new EbikeException(jsonResult.getMessage());
|
throw new EbikeException(jsonResult.getMessage());
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@ -112,7 +113,7 @@ public class EbikeUserController {
|
|||||||
* @return 验证结果
|
* @return 验证结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("/verifyRealName")
|
@PostMapping("/verifyRealName")
|
||||||
public JsonResult<?> verifyRealName(@RequestBody UserValidateDto userValidateDto) {
|
public JsonResult<?> verifyRealName(@RequestBody @Validated UserValidateDto userValidateDto) {
|
||||||
verifyUtil.verifyRealName(userValidateDto);
|
verifyUtil.verifyRealName(userValidateDto);
|
||||||
return JsonResult.success();
|
return JsonResult.success();
|
||||||
}
|
}
|
||||||
@ -193,7 +194,7 @@ public class EbikeUserController {
|
|||||||
* @return 分页对象
|
* @return 分页对象
|
||||||
*/
|
*/
|
||||||
@PostMapping("page")
|
@PostMapping("page")
|
||||||
public JsonResult<?> page(@RequestBody EbikeUserPageDto userPageDto) {
|
public JsonResult<?> page(@RequestBody EbikeUserPageDto userPageDto) {
|
||||||
Page<EbikeUserVo> list = ebikeUserService.queryPage(userPageDto);
|
Page<EbikeUserVo> list = ebikeUserService.queryPage(userPageDto);
|
||||||
return JsonResult.success(list);
|
return JsonResult.success(list);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user