参考:
https://www.cnblogs.com/yangtianruo/p/5667146.html
https://blog.csdn.net/architect_csdn/article/details/79414958
1. 普通的传参方式,Params填入各个参数
Controller
@Log(title = "对外接口:新增审批业务", businessType = BusinessType.INSERT)
@PostMapping("/addApprApi")
@ResponseBody
public AjaxResult addApprApi(BizApprFinancialForm bizApprFinancial) {
AjaxResult ajax = AjaxResult.success();
ajax.put("code",500);
ajax.put("msg","新增审批失败");
ajax.put("approvalNo",null);
return ajax;
}
2. Body中将参数封装为json数据传入
需要两个步骤,1 Headers中指定Content-Type:application/json,Body中使用json封装数据 ;2 Controller中接收参数时使用@RequestBody注解
注意 这里方法的参数加了@RequestBody注解,此注解支持将json数据转换为接收对象
@Log(title = "对外接口:新增审批业务", businessType = BusinessType.INSERT)
@PostMapping("/addApprApi")
@ResponseBody
public AjaxResult addApprApi(@RequestBody BizApprFinancialForm bizApprFinancial) {
AjaxResult ajax = AjaxResult.success();
ajax.put("code",500);
ajax.put("msg","新增审批失败");
ajax.put("approvalNo",null);
return ajax;
}