不同的参数获取注解
重点关注:
@SessionAttribute---getAtribute(“”);
1,从body中获取 @RequestBody
@ApiOperation(value = "保存/修改")
@RequestMapping(value = "/saveOrUpdate", method = RequestMethod.POST)
public ResultModel> saveOrUpdate(//
@Valid @RequestBody ApplyInfoModel applyInfoModel, //
@SessionAttribute("orderNo") String orderNo, //
@SessionAttribute("phone") String phone) {
applyInfoService.saveOrUpdate(applyInfoModel, orderNo, phone);
return new ResultModel<>();
}
2,从session中获取 @SessionAttribute
@ApiOperation(value = "查询申请期限")
@RequestMapping(value = "/queryLoanTerm", method = RequestMethod.GET)
public ResultModel> queryLoanTerm(@SessionAttribute("orderNo") String orderNo) {
List
return new ResultModel<>(response);
}
3,中param中获取 @RequestParam("orderNo")
@ApiOperation(value = "查询申请期限-传参数")
@RequestMapping(value = "/queryLoanTermWithPara", method = RequestMethod.GET)
public ResultModel> queryLoanTermWithPara(@RequestParam("orderNo") String orderNo) {
List
return new ResultModel<>(response);
}
4,从路径中获取 @PathVariable
@ApiOperation(value = "查询证码")
@RequestMapping(value = "/getCode/{phone}", method = RequestMethod.GET)
public ResultModel
WeixinSmsCodeModel model = accountService.getCode(phone);
return new ResultModel<>(model);
}