mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 12:18:42 +08:00 
			
		
		
		
	支持一级菜单(和主页同级)在main区域显示
This commit is contained in:
		@@ -42,6 +42,18 @@ public class UserConstants
 | 
			
		||||
    /** 是否菜单外链(否) */
 | 
			
		||||
    public static final String NO_FRAME = "1";
 | 
			
		||||
 | 
			
		||||
    /** 菜单类型(目录) */
 | 
			
		||||
    public static final String TYPE_DIR = "M";
 | 
			
		||||
 | 
			
		||||
    /** 菜单类型(菜单) */
 | 
			
		||||
    public static final String TYPE_MENU = "C";
 | 
			
		||||
 | 
			
		||||
    /** 菜单类型(按钮) */
 | 
			
		||||
    public static final String TYPE_BUTTON = "F";
 | 
			
		||||
 | 
			
		||||
    /** Layout组件标识 */
 | 
			
		||||
    public final static String LAYOUT = "Layout";
 | 
			
		||||
 | 
			
		||||
    /** 校验返回结果码 */
 | 
			
		||||
    public final static String UNIQUE = "0";
 | 
			
		||||
    public final static String NOT_UNIQUE = "1";
 | 
			
		||||
 
 | 
			
		||||
@@ -142,15 +142,26 @@ public class SysMenuServiceImpl implements ISysMenuService
 | 
			
		||||
            router.setHidden("1".equals(menu.getVisible()));
 | 
			
		||||
            router.setName(StringUtils.capitalize(menu.getPath()));
 | 
			
		||||
            router.setPath(getRouterPath(menu));
 | 
			
		||||
            router.setComponent(StringUtils.isEmpty(menu.getComponent()) ? "Layout" : menu.getComponent());
 | 
			
		||||
            router.setComponent(getComponent(menu));
 | 
			
		||||
            router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon()));
 | 
			
		||||
            List<SysMenu> cMenus = menu.getChildren();
 | 
			
		||||
            if (!cMenus.isEmpty() && cMenus.size() > 0 && "M".equals(menu.getMenuType()))
 | 
			
		||||
            if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()))
 | 
			
		||||
            {
 | 
			
		||||
                router.setAlwaysShow(true);
 | 
			
		||||
                router.setRedirect("noRedirect");
 | 
			
		||||
                router.setChildren(buildMenus(cMenus));
 | 
			
		||||
            }
 | 
			
		||||
            else if (isMeunFrame(menu))
 | 
			
		||||
            {
 | 
			
		||||
                List<RouterVo> childrenList = new ArrayList<RouterVo>();
 | 
			
		||||
                RouterVo children = new RouterVo();
 | 
			
		||||
                children.setPath(menu.getPath());
 | 
			
		||||
                children.setComponent(menu.getComponent());
 | 
			
		||||
                children.setName(StringUtils.capitalize(menu.getPath()));
 | 
			
		||||
                children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon()));
 | 
			
		||||
                childrenList.add(children);
 | 
			
		||||
                router.setChildren(childrenList);
 | 
			
		||||
            }
 | 
			
		||||
            routers.add(router);
 | 
			
		||||
        }
 | 
			
		||||
        return routers;
 | 
			
		||||
@@ -297,14 +308,48 @@ public class SysMenuServiceImpl implements ISysMenuService
 | 
			
		||||
    public String getRouterPath(SysMenu menu)
 | 
			
		||||
    {
 | 
			
		||||
        String routerPath = menu.getPath();
 | 
			
		||||
        // 非外链并且是一级目录
 | 
			
		||||
        if (0 == menu.getParentId() && UserConstants.NO_FRAME.equals(menu.getIsFrame()))
 | 
			
		||||
        // 非外链并且是一级目录(类型为目录)
 | 
			
		||||
        if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType())
 | 
			
		||||
                && UserConstants.NO_FRAME.equals(menu.getIsFrame()))
 | 
			
		||||
        {
 | 
			
		||||
            routerPath = "/" + menu.getPath();
 | 
			
		||||
        }
 | 
			
		||||
        // 非外链并且是一级目录(类型为菜单)
 | 
			
		||||
        else if (isMeunFrame(menu))
 | 
			
		||||
        {
 | 
			
		||||
            routerPath = StringUtils.EMPTY;
 | 
			
		||||
        }
 | 
			
		||||
        return routerPath;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取组件信息
 | 
			
		||||
     * 
 | 
			
		||||
     * @param menu 菜单信息
 | 
			
		||||
     * @return 组件信息
 | 
			
		||||
     */
 | 
			
		||||
    public String getComponent(SysMenu menu)
 | 
			
		||||
    {
 | 
			
		||||
        String component = UserConstants.LAYOUT;
 | 
			
		||||
        if (StringUtils.isNotEmpty(menu.getComponent()) && !isMeunFrame(menu))
 | 
			
		||||
        {
 | 
			
		||||
            component = menu.getComponent();
 | 
			
		||||
        }
 | 
			
		||||
        return component;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 是否为菜单内部跳转
 | 
			
		||||
     * 
 | 
			
		||||
     * @param menu 菜单信息
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isMeunFrame(SysMenu menu)
 | 
			
		||||
    {
 | 
			
		||||
        return menu.getParentId().intValue() == 0 && UserConstants.TYPE_MENU.equals(menu.getMenuType())
 | 
			
		||||
                && menu.getIsFrame().equals(UserConstants.NO_FRAME);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据父节点的ID获取所有子节点
 | 
			
		||||
     * 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user