修改 菜单管理接口修改

This commit is contained in:
萌狼蓝天 2024-11-03 22:39:18 +08:00
parent adc270d0ef
commit c503229c26
4 changed files with 15 additions and 0 deletions

View File

@ -31,5 +31,9 @@ public class SystemController {
public ResponseEntity getMenu() { public ResponseEntity getMenu() {
return ResponseEntity.ok(systemService.getMenu()); return ResponseEntity.ok(systemService.getMenu());
} }
@GetMapping("/menu-all")
public ResponseEntity getMenuAll() {
return ResponseEntity.ok(systemService.getMenuAll());
}
} }

View File

@ -12,4 +12,6 @@ public interface SystemMapper {
List<SystemMenu> getAllMenus(); List<SystemMenu> getAllMenus();
@Select("SELECT * from menu_data_item where id in (select system_role_menu.menu_id from system_role_menu where role_id=#{roleId})") @Select("SELECT * from menu_data_item where id in (select system_role_menu.menu_id from system_role_menu where role_id=#{roleId})")
List<MenuDataItem> getMenus(String roleId); List<MenuDataItem> getMenus(String roleId);
@Select("SELECT * from menu_data_item")
List<MenuDataItem> getMenusAll();
} }

View File

@ -4,4 +4,6 @@ import com.guaiguailang.harmony.domain.vo.ResponseResult;
public interface SystemService { public interface SystemService {
ResponseResult getMenu(); ResponseResult getMenu();
ResponseResult getMenuAll();
} }

View File

@ -31,10 +31,17 @@ public class SystemServiceImpl implements SystemService {
public ResponseResult getMenu() { public ResponseResult getMenu() {
// 获取用户角色 // 获取用户角色
Long uid = Long.parseLong(StpUtil.getLoginId().toString()); Long uid = Long.parseLong(StpUtil.getLoginId().toString());
log.info("获得用户id"+uid);
UserInfo userInfo = userMapper.getUserById(uid); UserInfo userInfo = userMapper.getUserById(uid);
log.info("获得用户权限:"+userInfo.getRoleId());
// 获取所有激活的状态菜单 // 获取所有激活的状态菜单
List<MenuDataItem> menus = systemMapper.getMenus(userInfo.getRoleId()); List<MenuDataItem> menus = systemMapper.getMenus(userInfo.getRoleId());
return ResponseResult.success(menus);
}
@Override
public ResponseResult getMenuAll() {
List<MenuDataItem> menus = systemMapper.getMenusAll();
return ResponseResult.success(menus); return ResponseResult.success(menus);
} }