perf: 查询用户列表过滤废弃角色

This commit is contained in:
fit2cloud-chenyw 2022-11-15 11:33:32 +08:00
parent 7cf2f9da02
commit 700b13c3aa

View File

@ -74,7 +74,7 @@ public class SysUserService {
List<SysUserGridResponse> lists = extSysUserMapper.query(gridExample); List<SysUserGridResponse> lists = extSysUserMapper.query(gridExample);
lists.forEach(item -> { lists.forEach(item -> {
List<SysUserRole> roles = item.getRoles(); List<SysUserRole> roles = item.getRoles();
List<Long> roleIds = roles.stream().map(SysUserRole::getRoleId).collect(Collectors.toList()); List<Long> roleIds = roles.stream().filter(ObjectUtils::isNotEmpty).map(SysUserRole::getRoleId).collect(Collectors.toList());
item.setRoleIds(roleIds); item.setRoleIds(roleIds);
}); });
return lists; return lists;