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); }