update 优化 修改路由name命名规则

2.X
疯狂的狮子Li 7 months ago
parent 6924e54858
commit eaeaa7e859

@ -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<RouterVo> buildMenus(List<SysMenu> menus) {
List<RouterVo> 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<RouterVo> 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<RouterVo> 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);

Loading…
Cancel
Save