diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java b/blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java index 840fcfab..acee4c24 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java @@ -27,7 +27,9 @@ import org.springblade.core.tool.constant.RoleConstant; import org.springblade.core.tool.support.Kv; import org.springblade.core.tool.utils.Func; import org.springblade.system.entity.Menu; +import org.springblade.system.entity.TopMenu; import org.springblade.system.service.IMenuService; +import org.springblade.system.service.ITopMenuService; import org.springblade.system.vo.CheckedTreeVO; import org.springblade.system.vo.GrantTreeVO; import org.springblade.system.vo.MenuVO; @@ -55,6 +57,7 @@ import static org.springblade.core.cache.constant.CacheConstant.MENU_CACHE; public class MenuController extends BladeController { private IMenuService menuService; + private ITopMenuService topMenuService; /** * 详情 @@ -131,8 +134,8 @@ public class MenuController extends BladeController { @GetMapping("/routes") @ApiOperationSupport(order = 5) @ApiOperation(value = "前端菜单数据", notes = "前端菜单数据") - public R> routes(BladeUser user) { - List list = menuService.routes((user == null) ? null : user.getRoleId()); + public R> routes(BladeUser user, Long topMenuId) { + List list = menuService.routes((user == null) ? null : user.getRoleId(), topMenuId); return R.data(list); } @@ -210,11 +213,22 @@ public class MenuController extends BladeController { return R.data(vo); } + /** + * 顶部菜单数据 + */ + @GetMapping("/top-menu") + @ApiOperationSupport(order = 12) + @ApiOperation(value = "顶部菜单数据", notes = "顶部菜单数据") + public R> topMenu() { + List list = topMenuService.list(); + return R.data(list); + } + /** * 获取配置的角色权限 */ @GetMapping("auth-routes") - @ApiOperationSupport(order = 12) + @ApiOperationSupport(order = 13) @ApiOperation(value = "菜单的角色权限") public R> authRoutes(BladeUser user) { if (Func.isEmpty(user)) { diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/mapper/MenuMapper.java b/blade-service/blade-system/src/main/java/org/springblade/system/mapper/MenuMapper.java index d3b6eee5..7fc89e2e 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/mapper/MenuMapper.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/mapper/MenuMapper.java @@ -119,9 +119,10 @@ public interface MenuMapper extends BaseMapper { * 权限配置菜单 * * @param roleId + * @param topMenuId * @return */ - List roleMenu(List roleId); + List roleMenu(List roleId, Long topMenuId); /** * 菜单树形结构 diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/mapper/MenuMapper.xml b/blade-service/blade-system/src/main/java/org/springblade/system/mapper/MenuMapper.xml index 295baefd..4cfecfcf 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/mapper/MenuMapper.xml +++ b/blade-service/blade-system/src/main/java/org/springblade/system/mapper/MenuMapper.xml @@ -40,12 +40,19 @@ -