1、@PathVariable
获取路径参数,RUL格式:url/{id},示例:http://localhost:9100/admin/privilege/find/3
Java代码示例:
@GetMapping("/find/{id}")
@ApiOperation(value = "查询权限", notes = " ")
@ApiImplicitParams(
@ApiImplicitParam(paramType = "path", name = "id", value = "权限ID", required = true)
)
public Object findPrivilege(@PathVariable(name = "id") int id) {
Map<String,Object> map = new HashMap<>();
map.put("privilege", privilegeService.findPrivilege(id));
return ApiResponse.success(map);
}
2、@RequestParam
获取查询参数,RUL格式:url?name=张三丰,示例:http://localhost:9100/admin/role/search?name=张三丰
Java代码示例:
@