From eaeaa7e859878d1575cecffb80b6baab3e3cddfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Mon, 1 Jul 2024 12:49:18 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=B7=AF=E7=94=B1name=E5=91=BD=E5=90=8D=E8=A7=84?= =?UTF-8?q?=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/service/impl/SysMenuServiceImpl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysMenuServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysMenuServiceImpl.java index 2a8e4f18..1b6a9aa8 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysMenuServiceImpl.java @@ -178,6 +178,7 @@ public class SysMenuServiceImpl implements ISysMenuService { /** * 构建前端路由所需要的菜单 + * 路由name命名规则 path首字母转大写 + id * * @param menus 菜单列表 * @return 路由列表 @@ -186,9 +187,10 @@ public class SysMenuServiceImpl implements ISysMenuService { public List buildMenus(List menus) { List routers = new LinkedList<>(); for (SysMenu menu : menus) { + String name = menu.getRouteName() + menu.getMenuId(); RouterVo router = new RouterVo(); router.setHidden("1".equals(menu.getVisible())); - router.setName(menu.getRouteName()); + router.setName(name); router.setPath(menu.getRouterPath()); router.setComponent(menu.getComponentInfo()); router.setQuery(menu.getQueryParam()); @@ -199,12 +201,13 @@ public class SysMenuServiceImpl implements ISysMenuService { router.setRedirect("noRedirect"); router.setChildren(buildMenus(cMenus)); } else if (menu.isMenuFrame()) { + String frameName = StringUtils.capitalize(menu.getPath()) + menu.getMenuId(); router.setMeta(null); List childrenList = new ArrayList<>(); RouterVo children = new RouterVo(); children.setPath(menu.getPath()); children.setComponent(menu.getComponent()); - children.setName(StringUtils.capitalize(menu.getPath())); + children.setName(frameName); children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); children.setQuery(menu.getQueryParam()); childrenList.add(children); @@ -215,9 +218,10 @@ public class SysMenuServiceImpl implements ISysMenuService { List childrenList = new ArrayList<>(); RouterVo children = new RouterVo(); String routerPath = SysMenu.innerLinkReplaceEach(menu.getPath()); + String innerLinkName = StringUtils.capitalize(routerPath) + menu.getMenuId(); children.setPath(routerPath); children.setComponent(UserConstants.INNER_LINK); - children.setName(StringUtils.capitalize(routerPath)); + children.setName(innerLinkName); children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath())); childrenList.add(children); router.setChildren(childrenList);