bug fix: Ambiguous mapping. Cannot map ‘***’ method

This commit is contained in:
myh 2023-11-11 20:17:34 +08:00
parent 0a31998bd3
commit f8123c6e52

View File

@ -19,22 +19,22 @@ public class UsersController {
//添加新用户
@RoleVerificationAnnotation(RoleIDList = {1}, UserIDList = {1})
@PostMapping("/add")
public Users addUsers(@RequestBody UsersPassword usersPassword, @RequestBody Users users) {
usersService.addPassword(usersPassword);
return usersService.addUsers(users);
public Users addUsers(@RequestBody UsersPassword usersPassword,
@RequestBody Users users) {
return usersService.addUsers(users, usersPassword);
}
//通过ID删除用户
@RoleVerificationAnnotation(RoleIDList = {1}, UserIDList = {1})
@DeleteMapping("/delete")
public void deleteUsers(@RequestParam(name = "userID") Long userID) {
@DeleteMapping("/delete/{userID}")
public void deleteUsers(@PathVariable(name = "userID") Long userID) {
usersService.deleteUsersById(userID);
}
//通过姓名删除用户
@RoleVerificationAnnotation(RoleIDList = {1}, UserIDList = {1})
@DeleteMapping("/delete")
public void deleteUsers(@RequestParam(name = "name") String name) {
@DeleteMapping("/delete/{name}")
public void deleteUsers(@PathVariable(name = "name") String name) {
usersService.deleteUsersByName(name);
}
@ -54,15 +54,15 @@ public class UsersController {
//根据姓名查找用户
@RoleVerificationAnnotation(RoleIDList = {1}, UserIDList = {1})
@GetMapping("/find")
public Users getUsersByName(@RequestParam(name = "name") String name) {
@GetMapping("/find/{name}")
public Users getUsersByName(@PathVariable(name = "name") String name) {
return usersService.findByName(name);
}
//根据ID查找用户
@RoleVerificationAnnotation(RoleIDList = {1}, UserIDList = {1})
@GetMapping("/find")
public Users getUsersById(@RequestParam(name = "id") Long userID) {
@GetMapping("/find/{id}")
public Users getUsersById(@PathVariable(name = "id") Long userID) {
return usersService.findById(userID);
}