fix(user):修复用户角色过滤逻辑,确保当用户不包含当前选中角色时返回空结果而非全部用户

This commit is contained in:
manumiter 2025-10-20 09:12:14 +08:00
parent 2c41d5622c
commit 31f6d03d67

View File

@ -276,7 +276,9 @@ public class AdminUserServiceImpl implements AdminUserService {
// 如果有角色编号查询角色对应的用户编号
Set<Long> userIds = reqVO.getRoleId() != null ?
permissionService.getUserRoleIdListByRoleId(singleton(reqVO.getRoleId())) : null;
if (userIds != null && userIds.isEmpty()) {
return PageResult.empty();
}
// 分页查询
return userMapper.selectPage(reqVO, getDeptCondition(reqVO.getDeptId()), userIds);
}