feat: 实现查看团队成员名单接口
This commit is contained in:
parent
13d18bd3ab
commit
a94ab466d2
@ -68,4 +68,10 @@ public class UserController {
|
||||
userService.deleteById(userId);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
@GetMapping("/user-team/{teamId}")
|
||||
public ResponseResult<List<String>> getTeamUsers(@PathVariable Long teamId) {
|
||||
return ResponseResult.success(userService.getTeamUsers(teamId));
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import github.benjamin.equipreservebackend.entity.User;
|
||||
import github.benjamin.equipreservebackend.security.SecurityUser;
|
||||
import github.benjamin.equipreservebackend.vo.UserVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserService {
|
||||
|
||||
User login(String username, String password);
|
||||
@ -21,4 +23,6 @@ public interface UserService {
|
||||
void deleteById(Long userId);
|
||||
|
||||
void addUser(UserDTO dto);
|
||||
|
||||
List<String> getTeamUsers(Long teamId);
|
||||
}
|
||||
|
@ -136,4 +136,14 @@ public class UserServiceImpl implements UserService {
|
||||
userMapper.insert(user);
|
||||
userRoleMapper.insert(new UserRole(user.getId(), dto.getRoleId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTeamUsers(Long teamId) {
|
||||
return userMapper.selectList(new LambdaQueryWrapper<User>()
|
||||
.eq(User::getTeamId, teamId)
|
||||
.orderByAsc(User::getName))
|
||||
.stream()
|
||||
.map(User::getName)
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user