@GetMapping
普通的get请求
后端:
restfule的get请求
通过/asd/123这种方式get请求传入后端
前端
java
url: '/system/role/deptTree/' + roleId + '/' + tenantId,
method: 'get'
后端@PathVariable
从path上取对应的值
通过
java
@GetMapping(value = "/deptTree/{roleId}/{tenantId}")
public AjaxResult deptTree(@PathVariable("roleId") Long roleId,@PathVariable("tenantId")Integer tenantId){
}
- get请求,对象接收,不用
@RequestBody
@PostMapping
前端
参数名对应,post请求传数组到后端
java
this.download('monitor/operlog/export', {
ids: this.ids.join(','), tenantId: 123
}, `操作日志信息列表.xlsx`)
后端,参数名对应,直接接收到,不用注解
java
@PostMapping("/export")
public void export(HttpServletResponse response,String ids,Integer tenantId) {
@PutMapping
- 前端
data是form表单数据 - 后端
- 实例1
前端参数
bash
{
"orderId": "123",
"addedFees": [{
"feeType": "34",
"feeName": "过路费",
"feeAmount": "1121"
}, {
"feeType": "33",
"feeName": "等候费用",
"feeAmount": "1024"
}]
}
后端接收