前不久接到一个需求,其中部分业务需要调用存储过程来完成,在查看了一些别人的写法之后,自己也来分享一下自己的写法:
Begin:
1.controller:
@RequestMapping(value = "/save",method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public MgtReportResp<Object> addAppear(@RequestBody WyAppearRequest pmRequest,
HttpServletRequest request) {
RespBuilder<Object> builder = new RespBuilder<Object>();
try{
wyAppearService.storeCall(StatusCode.DEAL_ROLLBACK, pmRequest);
}catch (Exception e){
logger.debug("数据退回失败!");
return builder.buildResp(ResultCode.FAIL, "上报数据调整中出现问题,请联系管理员处理!!!");
}
return builder.buildResp(ResultCode.SUCCESS, "操作成功");
}
2.service: