From 5b9041d6ed80ab28ed56d62e5806bd36c7f80d9a Mon Sep 17 00:00:00 2001 From: smallchill Date: Tue, 16 Jul 2019 10:07:08 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E5=A2=9E=E5=8A=A0=E9=A1=B6=E9=83=A8?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controller/MenuController.java | 20 ++++++++++++++++--- .../springblade/system/mapper/MenuMapper.java | 3 ++- .../springblade/system/mapper/MenuMapper.xml | 15 ++++++++++---- .../system/service/IMenuService.java | 3 ++- .../system/service/impl/MenuServiceImpl.java | 4 ++-- 5 files changed, 34 insertions(+), 11 deletions(-) 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 @@ -