|
@@ -142,15 +142,26 @@ public class SysMenuServiceImpl implements ISysMenuService |
|
@@ -142,15 +142,26 @@ public class SysMenuServiceImpl implements ISysMenuService |
|
142
|
router.setHidden("1".equals(menu.getVisible()));
|
142
|
router.setHidden("1".equals(menu.getVisible()));
|
|
143
|
router.setName(StringUtils.capitalize(menu.getPath()));
|
143
|
router.setName(StringUtils.capitalize(menu.getPath()));
|
|
144
|
router.setPath(getRouterPath(menu));
|
144
|
router.setPath(getRouterPath(menu));
|
|
145
|
- router.setComponent(StringUtils.isEmpty(menu.getComponent()) ? "Layout" : menu.getComponent());
|
145
|
+ router.setComponent(getComponent(menu));
|
|
146
|
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon()));
|
146
|
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon()));
|
|
147
|
List<SysMenu> cMenus = menu.getChildren();
|
147
|
List<SysMenu> cMenus = menu.getChildren();
|
|
148
|
- if (!cMenus.isEmpty() && cMenus.size() > 0 && "M".equals(menu.getMenuType()))
|
148
|
+ if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()))
|
|
149
|
{
|
149
|
{
|
|
150
|
router.setAlwaysShow(true);
|
150
|
router.setAlwaysShow(true);
|
|
151
|
router.setRedirect("noRedirect");
|
151
|
router.setRedirect("noRedirect");
|
|
152
|
router.setChildren(buildMenus(cMenus));
|
152
|
router.setChildren(buildMenus(cMenus));
|
|
153
|
}
|
153
|
}
|
|
|
|
154
|
+ else if (isMeunFrame(menu))
|
|
|
|
155
|
+ {
|
|
|
|
156
|
+ List<RouterVo> childrenList = new ArrayList<RouterVo>();
|
|
|
|
157
|
+ RouterVo children = new RouterVo();
|
|
|
|
158
|
+ children.setPath(menu.getPath());
|
|
|
|
159
|
+ children.setComponent(menu.getComponent());
|
|
|
|
160
|
+ children.setName(StringUtils.capitalize(menu.getPath()));
|
|
|
|
161
|
+ children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon()));
|
|
|
|
162
|
+ childrenList.add(children);
|
|
|
|
163
|
+ router.setChildren(childrenList);
|
|
|
|
164
|
+ }
|
|
154
|
routers.add(router);
|
165
|
routers.add(router);
|
|
155
|
}
|
166
|
}
|
|
156
|
return routers;
|
167
|
return routers;
|
|
@@ -297,15 +308,49 @@ public class SysMenuServiceImpl implements ISysMenuService |
|
@@ -297,15 +308,49 @@ public class SysMenuServiceImpl implements ISysMenuService |
|
297
|
public String getRouterPath(SysMenu menu)
|
308
|
public String getRouterPath(SysMenu menu)
|
|
298
|
{
|
309
|
{
|
|
299
|
String routerPath = menu.getPath();
|
310
|
String routerPath = menu.getPath();
|
|
300
|
- // 非外链并且是一级目录
|
|
|
|
301
|
- if (0 == menu.getParentId() && UserConstants.NO_FRAME.equals(menu.getIsFrame()))
|
311
|
+ // 非外链并且是一级目录(类型为目录)
|
|
|
|
312
|
+ if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType())
|
|
|
|
313
|
+ && UserConstants.NO_FRAME.equals(menu.getIsFrame()))
|
|
302
|
{
|
314
|
{
|
|
303
|
routerPath = "/" + menu.getPath();
|
315
|
routerPath = "/" + menu.getPath();
|
|
304
|
}
|
316
|
}
|
|
|
|
317
|
+ // 非外链并且是一级目录(类型为菜单)
|
|
|
|
318
|
+ else if (isMeunFrame(menu))
|
|
|
|
319
|
+ {
|
|
|
|
320
|
+ routerPath = StringUtils.EMPTY;
|
|
|
|
321
|
+ }
|
|
305
|
return routerPath;
|
322
|
return routerPath;
|
|
306
|
}
|
323
|
}
|
|
307
|
|
324
|
|
|
308
|
/**
|
325
|
/**
|
|
|
|
326
|
+ * 获取组件信息
|
|
|
|
327
|
+ *
|
|
|
|
328
|
+ * @param menu 菜单信息
|
|
|
|
329
|
+ * @return 组件信息
|
|
|
|
330
|
+ */
|
|
|
|
331
|
+ public String getComponent(SysMenu menu)
|
|
|
|
332
|
+ {
|
|
|
|
333
|
+ String component = UserConstants.LAYOUT;
|
|
|
|
334
|
+ if (StringUtils.isNotEmpty(menu.getComponent()) && !isMeunFrame(menu))
|
|
|
|
335
|
+ {
|
|
|
|
336
|
+ component = menu.getComponent();
|
|
|
|
337
|
+ }
|
|
|
|
338
|
+ return component;
|
|
|
|
339
|
+ }
|
|
|
|
340
|
+
|
|
|
|
341
|
+ /**
|
|
|
|
342
|
+ * 是否为菜单内部跳转
|
|
|
|
343
|
+ *
|
|
|
|
344
|
+ * @param menu 菜单信息
|
|
|
|
345
|
+ * @return 结果
|
|
|
|
346
|
+ */
|
|
|
|
347
|
+ public boolean isMeunFrame(SysMenu menu)
|
|
|
|
348
|
+ {
|
|
|
|
349
|
+ return menu.getParentId().intValue() == 0 && UserConstants.TYPE_MENU.equals(menu.getMenuType())
|
|
|
|
350
|
+ && menu.getIsFrame().equals(UserConstants.NO_FRAME);
|
|
|
|
351
|
+ }
|
|
|
|
352
|
+
|
|
|
|
353
|
+ /**
|
|
309
|
* 根据父节点的ID获取所有子节点
|
354
|
* 根据父节点的ID获取所有子节点
|
|
310
|
*
|
355
|
*
|
|
311
|
* @param list 分类表
|
356
|
* @param list 分类表
|