From 33ba15724446b79dd4d07dbe784de03487ee3ed5 Mon Sep 17 00:00:00 2001 From: TinyAnts Date: Fri, 16 Sep 2022 10:23:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E8=A7=92=E8=89=B2=E7=A6=81?= =?UTF-8?q?=E7=94=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/impl/SystemAuthPermServiceImpl.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/system/impl/SystemAuthPermServiceImpl.java b/server/like-admin/src/main/java/com/mdd/admin/service/system/impl/SystemAuthPermServiceImpl.java index 097ba784..c2e78d31 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/service/system/impl/SystemAuthPermServiceImpl.java +++ b/server/like-admin/src/main/java/com/mdd/admin/service/system/impl/SystemAuthPermServiceImpl.java @@ -5,8 +5,10 @@ import com.mdd.admin.config.AdminConfig; import com.mdd.admin.service.system.ISystemAuthPermService; import com.mdd.common.entity.system.SystemAuthMenu; import com.mdd.common.entity.system.SystemAuthPerm; +import com.mdd.common.entity.system.SystemAuthRole; import com.mdd.common.mapper.system.SystemAuthMenuMapper; import com.mdd.common.mapper.system.SystemAuthPermMapper; +import com.mdd.common.mapper.system.SystemAuthRoleMapper; import com.mdd.common.utils.ArrayUtil; import com.mdd.common.utils.RedisUtil; import com.mdd.common.utils.StringUtil; @@ -30,6 +32,9 @@ public class SystemAuthPermServiceImpl implements ISystemAuthPermService { @Resource SystemAuthMenuMapper systemAuthMenuMapper; + @Resource + SystemAuthRoleMapper systemAuthRoleMapper; + /** * 根据角色ID获取菜单ID * @@ -39,11 +44,22 @@ public class SystemAuthPermServiceImpl implements ISystemAuthPermService { @Override public List selectMenuIdsByRoleId(Integer roleId) { List menus = new LinkedList<>(); + + SystemAuthRole systemAuthRole = systemAuthRoleMapper.selectOne(new QueryWrapper() + .eq("id", roleId) + .eq("is_disable", 0) + .last("limit 1")); + + if (StringUtil.isNull(systemAuthRole)) { + return menus; + } + List systemAuthPerms = systemAuthPermMapper.selectList( new QueryWrapper().eq("role_id", roleId)); for (SystemAuthPerm systemAuthPerm : systemAuthPerms) { menus.add(systemAuthPerm.getMenuId()); } + return menus; }