优化sql树形结构的查询-改为查询出所有的数据后用steam进行children Set
正在显示
1 个修改的文件
包含
1 行增加
和
1 行删除
@@ -48,7 +48,7 @@ public class UserServiceImpl implements UserService{ | @@ -48,7 +48,7 @@ public class UserServiceImpl implements UserService{ | ||
48 | 48 | ||
49 | //新SQL MYBATIS SQL 绑定role跟perm的方法,以减少数据库查询次数 | 49 | //新SQL MYBATIS SQL 绑定role跟perm的方法,以减少数据库查询次数 |
50 | if (userInfo!=null){ | 50 | if (userInfo!=null){ |
51 | - if (userInfo.getRoles()!=null && userInfo.getRoles().isEmpty()){ | 51 | + if (userInfo.getRoles()!=null && !userInfo.getRoles().isEmpty()){ |
52 | List<ROLE> topRoles = roleMapper.selectTopByChildID(userInfo.getRoles().get(0).getRoleId()); | 52 | List<ROLE> topRoles = roleMapper.selectTopByChildID(userInfo.getRoles().get(0).getRoleId()); |
53 | topRoles.removeAll(Collections.singleton(null)); | 53 | topRoles.removeAll(Collections.singleton(null)); |
54 | 54 |
-
请 注册 或 登录 后发表评论