feat(user): 增强用户列表分页查询功能

- 新增 keyword 参数支持用户名和昵称模糊搜索
- 新增 roleId 参数支持按角色过滤用户
- 优化 SQL 查询逻辑,使用 EXISTS 子查询关联用户与角色
- 更新 Mapper 接口以支持新的查询参数
- 调整 Service 和 Controller 层方法签名适配新参数
- 添加请求日志记录便于调试和监控
This commit is contained in:
Chaos
2025-12-01 17:27:20 +08:00
parent 9609f95e5e
commit 50296e8fce
4 changed files with 33 additions and 21 deletions

View File

@@ -153,9 +153,9 @@ public class UserProfileServiceImpl implements UserProfileService {
}
@Override
public IPage<UserProfileResponse> getAllUsers(Integer pageNum, Integer pageSize) {
public IPage<UserProfileResponse> getAllUsers(Integer pageNum, Integer pageSize, String keyword, Long roleId) {
Page<User> page = new Page<>(pageNum, pageSize);
IPage<User> userPage = userMapper.selectPageWithRoles(page, null);
IPage<User> userPage = userMapper.selectPageWithRoles(page, keyword,roleId);
return userPage.convert(UserProfileResponse::new);
}