update 优化 支持子菜单配置默认激活的父菜单activeMenu

This commit is contained in:
疯狂的狮子Li
2025-09-02 10:52:59 +08:00
parent f6ddae57c4
commit 6551134460
8 changed files with 58 additions and 20 deletions

View File

@@ -38,6 +38,11 @@ public class MetaVo implements Serializable {
*/
private String link;
/**
* 激活菜单
*/
private String activeMenu;
public MetaVo(String title, String icon) {
this.title = title;
this.icon = icon;
@@ -64,4 +69,16 @@ public class MetaVo implements Serializable {
}
}
public MetaVo(String title, String icon, Boolean noCache, String link, String activeMenu) {
this.title = title;
this.icon = icon;
this.noCache = noCache;
if (StringUtils.ishttp(link)) {
this.link = link;
}
if (StringUtils.startWithAnyIgnoreCase(activeMenu, "/")) {
this.activeMenu = activeMenu;
}
}
}

View File

@@ -185,7 +185,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
router.setPath(menu.getRouterPath());
router.setComponent(menu.getComponentInfo());
router.setQuery(menu.getQueryParam());
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath(), menu.getRemark()));
List<SysMenu> cMenus = menu.getChildren();
if (CollUtil.isNotEmpty(cMenus) && SystemConstants.TYPE_DIR.equals(menu.getMenuType())) {
router.setAlwaysShow(true);
@@ -199,7 +199,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
children.setPath(menu.getPath());
children.setComponent(menu.getComponent());
children.setName(frameName);
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath(), menu.getRemark()));
children.setQuery(menu.getQueryParam());
childrenList.add(children);
router.setChildren(childrenList);