| @@ -102,10 +102,29 @@ public class WxCouponOrderController extends BaseController { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("根据id查询接口") | |||||
| @ApiOperation(value = "根据couponOrderId查询接口", notes = "{\"couponOrderId\":\"string\"}") | |||||
| @GetMapping("/findById") | @GetMapping("/findById") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData findById(Long id) { | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponOrderService.getById(id)); | |||||
| public ResultData findById(@RequestBody Map<String, String> paramMap) { | |||||
| logger.info(paramMap.toString()); | |||||
| String couponOrderIdStr = paramMap.get("couponOrderId"); | |||||
| if (StringUtils.isBlank(couponOrderIdStr)) { | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponOrderId不能为空"); | |||||
| } | |||||
| Long couponOrderId = 0L; | |||||
| try { | |||||
| couponOrderId = Long.valueOf(couponOrderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error("couponOrderId " + couponOrderIdStr + ", e:" + e.getMessage()); | |||||
| } | |||||
| try { | |||||
| WxCouponOrder couponOrder = wxCouponOrderService.getById(couponOrderId); | |||||
| if (couponOrder != null) { | |||||
| return new ResultData(Result.SUCCESS, "查询成功", couponOrder); | |||||
| } else { | |||||
| return new ResultData(Result.SUCCESS, "未找到"); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| return new ResultData(ErrorCode.DB_FAIL); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||