Request data
id:1
roleName:admin
roleDes: Have admin permissions
Several ways to deal with Controller
- The first type
@ApiOperation("Query User")
@PostMapping("/detailByParam")
public void detailByParam(@RequestParam (value = "id") Integer id,@RequestParam(value = "roleName") String roleName,@RequestParam(value = "roleDes") String roleDes) {
(">>>,roleName="+roleName+",roleDes="+roleDes);
}
- 1
- 2
- 3
- 4
- 5
Print information: >>>id=1,roleName=admin,roleDes=Have admin permission
- The second type
@ApiOperation("Query User")
@PostMapping("/detailByParam")
public void detailByParam(@RequestParam Map<String, String> params) {
(">>>id")+",roleName="+("roleName")+",roleDes="+("roleDes"));
}
- 1
- 2
- 3
- 4
- 5
Print information: >>>id=1,roleName=admin,roleDes=Have admin permission
- The third type
@ApiOperation("Query User")
@PostMapping("/detailByParam")
public void detailByParam(@RequestBody String params) {
(">>>"+params);
}
- 1
- 2
- 3
- 4
- 5
Print information: >>>id=1&roleName=admin&roleDes=%E6%8B%A5%E6%9C%89admin%E6%9D%83%E9%99%90
- The fourth type
@ApiOperation("Query User")
@PostMapping("/detailByParam")
public void detailByParam(@RequestBody GetRoleParam getRoleParam) {
(">>>"+getRoleParam);
}
- 1
- 2
- 3
- 4
- 5
Returns the error message: "Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported".