我在控制器中有 3 种不同的方法来获取请求。
- 第一个使用路径变量通过 id 获取用户:
@GetMapping(path="/{id}")
public ResponseEntity<UserInfoDTO> getUserById(@PathVariable Long id)
第二个根据username
参数获取用户:
public ResponseEntity<UserInfoDTO> getUserByUsername(@RequestParam String username)
最后是另一个让所有用户
public ResponseEntity<List<UserInfoDTO>> getAllUsers()
@GetMapping
第二种和第三种方法应该是什么?
例如@GetMapping
所有用户和@GetMapping(path="/")
用户名的用户?
管他呢...
谢谢。