From c503229c266bbefa75d436323d726072a1768180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E7=8B=BC=E8=93=9D=E5=A4=A9?= Date: Sun, 3 Nov 2024 22:39:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../guaiguailang/harmony/controller/SystemController.java | 4 ++++ .../java/com/guaiguailang/harmony/mapper/SystemMapper.java | 2 ++ .../com/guaiguailang/harmony/service/SystemService.java | 2 ++ .../harmony/service/impl/SystemServiceImpl.java | 7 +++++++ 4 files changed, 15 insertions(+) diff --git a/src/main/java/com/guaiguailang/harmony/controller/SystemController.java b/src/main/java/com/guaiguailang/harmony/controller/SystemController.java index bc42d28..f2e5a5d 100644 --- a/src/main/java/com/guaiguailang/harmony/controller/SystemController.java +++ b/src/main/java/com/guaiguailang/harmony/controller/SystemController.java @@ -31,5 +31,9 @@ public class SystemController { public ResponseEntity getMenu() { return ResponseEntity.ok(systemService.getMenu()); } + @GetMapping("/menu-all") + public ResponseEntity getMenuAll() { + return ResponseEntity.ok(systemService.getMenuAll()); + } } diff --git a/src/main/java/com/guaiguailang/harmony/mapper/SystemMapper.java b/src/main/java/com/guaiguailang/harmony/mapper/SystemMapper.java index 7ef67d4..f1c41b7 100644 --- a/src/main/java/com/guaiguailang/harmony/mapper/SystemMapper.java +++ b/src/main/java/com/guaiguailang/harmony/mapper/SystemMapper.java @@ -12,4 +12,6 @@ public interface SystemMapper { List getAllMenus(); @Select("SELECT * from menu_data_item where id in (select system_role_menu.menu_id from system_role_menu where role_id=#{roleId})") List getMenus(String roleId); + @Select("SELECT * from menu_data_item") + List getMenusAll(); } diff --git a/src/main/java/com/guaiguailang/harmony/service/SystemService.java b/src/main/java/com/guaiguailang/harmony/service/SystemService.java index 059191e..d9eff11 100644 --- a/src/main/java/com/guaiguailang/harmony/service/SystemService.java +++ b/src/main/java/com/guaiguailang/harmony/service/SystemService.java @@ -4,4 +4,6 @@ import com.guaiguailang.harmony.domain.vo.ResponseResult; public interface SystemService { ResponseResult getMenu(); + + ResponseResult getMenuAll(); } diff --git a/src/main/java/com/guaiguailang/harmony/service/impl/SystemServiceImpl.java b/src/main/java/com/guaiguailang/harmony/service/impl/SystemServiceImpl.java index 18b085d..68ff2f1 100644 --- a/src/main/java/com/guaiguailang/harmony/service/impl/SystemServiceImpl.java +++ b/src/main/java/com/guaiguailang/harmony/service/impl/SystemServiceImpl.java @@ -31,10 +31,17 @@ public class SystemServiceImpl implements SystemService { public ResponseResult getMenu() { // 获取用户角色 Long uid = Long.parseLong(StpUtil.getLoginId().toString()); + log.info("获得用户id:"+uid); UserInfo userInfo = userMapper.getUserById(uid); + log.info("获得用户权限:"+userInfo.getRoleId()); // 获取所有激活的状态菜单 List menus = systemMapper.getMenus(userInfo.getRoleId()); + return ResponseResult.success(menus); + } + @Override + public ResponseResult getMenuAll() { + List menus = systemMapper.getMenusAll(); return ResponseResult.success(menus); }