浏览代码

web端获取用户菜单角色时增加判断

jingyuanchao 1 年之前
父节点
当前提交
5b5df05dbf

+ 2 - 2
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysUserServiceImpl.java

@@ -81,6 +81,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     private ISysDictDataService iSysDictDataService;
     @Autowired
     SysRoleMenuMapper roleMenuMapper;
+
     /**
      * 根据条件分页查询用户列表
      *
@@ -756,13 +757,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     }
 
 
-
     @Override
     public List<Long> selectUserRoleMenu(Long userId) {
         final List<SysUserRole> roleList = userRoleMapper.selectList(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId));
         final List<Long> collect = roleList.stream().map(SysUserRole::getRoleId).collect(Collectors.toList());
         return roleMenuMapper.selectList(new LambdaQueryWrapper<SysRoleMenu>()
-                .in(SysRoleMenu::getRoleId, collect))
+                        .in(ObjectUtil.isNotEmpty(collect), SysRoleMenu::getRoleId, collect))
                 .stream()
                 .map(SysRoleMenu::getMenuId)
                 .distinct()