|
|
@@ -10,6 +10,7 @@ import java.util.Set;
|
|
10
|
10
|
import java.util.stream.Collectors;
|
|
11
|
11
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
12
|
12
|
import org.springframework.stereotype.Service;
|
|
|
13
|
+import com.ruoyi.common.core.constant.Constants;
|
|
13
|
14
|
import com.ruoyi.common.core.constant.UserConstants;
|
|
14
|
15
|
import com.ruoyi.common.core.utils.SecurityUtils;
|
|
15
|
16
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
|
@@ -150,7 +151,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|
150
|
151
|
router.setName(getRouteName(menu));
|
|
151
|
152
|
router.setPath(getRouterPath(menu));
|
|
152
|
153
|
router.setComponent(getComponent(menu));
|
|
153
|
|
- router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache())));
|
|
|
154
|
+ router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
|
154
|
155
|
List<SysMenu> cMenus = menu.getChildren();
|
|
155
|
156
|
if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()))
|
|
156
|
157
|
{
|
|
|
@@ -166,7 +167,21 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|
166
|
167
|
children.setPath(menu.getPath());
|
|
167
|
168
|
children.setComponent(menu.getComponent());
|
|
168
|
169
|
children.setName(StringUtils.capitalize(menu.getPath()));
|
|
169
|
|
- children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache())));
|
|
|
170
|
+ children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
|
|
171
|
+ childrenList.add(children);
|
|
|
172
|
+ router.setChildren(childrenList);
|
|
|
173
|
+ }
|
|
|
174
|
+ else if (menu.getParentId().intValue() == 0 && isInnerLink(menu))
|
|
|
175
|
+ {
|
|
|
176
|
+ router.setMeta(null);
|
|
|
177
|
+ router.setPath("/inner");
|
|
|
178
|
+ List<RouterVo> childrenList = new ArrayList<RouterVo>();
|
|
|
179
|
+ RouterVo children = new RouterVo();
|
|
|
180
|
+ String routerPath = StringUtils.replaceEach(menu.getPath(), new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" });
|
|
|
181
|
+ children.setPath(routerPath);
|
|
|
182
|
+ children.setComponent(UserConstants.INNER_LINK);
|
|
|
183
|
+ children.setName(StringUtils.capitalize(routerPath));
|
|
|
184
|
+ children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath()));
|
|
170
|
185
|
childrenList.add(children);
|
|
171
|
186
|
router.setChildren(childrenList);
|
|
172
|
187
|
}
|
|
|
@@ -338,6 +353,11 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|
338
|
353
|
public String getRouterPath(SysMenu menu)
|
|
339
|
354
|
{
|
|
340
|
355
|
String routerPath = menu.getPath();
|
|
|
356
|
+ // 内链打开外网方式
|
|
|
357
|
+ if (menu.getParentId().intValue() != 0 && isInnerLink(menu))
|
|
|
358
|
+ {
|
|
|
359
|
+ routerPath = StringUtils.replaceEach(routerPath, new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" });
|
|
|
360
|
+ }
|
|
341
|
361
|
// 非外链并且是一级目录(类型为目录)
|
|
342
|
362
|
if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType())
|
|
343
|
363
|
&& UserConstants.NO_FRAME.equals(menu.getIsFrame()))
|
|
|
@@ -365,6 +385,10 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|
365
|
385
|
{
|
|
366
|
386
|
component = menu.getComponent();
|
|
367
|
387
|
}
|
|
|
388
|
+ else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0 && isInnerLink(menu))
|
|
|
389
|
+ {
|
|
|
390
|
+ component = UserConstants.INNER_LINK;
|
|
|
391
|
+ }
|
|
368
|
392
|
else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu))
|
|
369
|
393
|
{
|
|
370
|
394
|
component = UserConstants.PARENT_VIEW;
|
|
|
@@ -385,6 +409,17 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|
385
|
409
|
}
|
|
386
|
410
|
|
|
387
|
411
|
/**
|
|
|
412
|
+ * 是否为内链组件
|
|
|
413
|
+ *
|
|
|
414
|
+ * @param menu 菜单信息
|
|
|
415
|
+ * @return 结果
|
|
|
416
|
+ */
|
|
|
417
|
+ public boolean isInnerLink(SysMenu menu)
|
|
|
418
|
+ {
|
|
|
419
|
+ return menu.getIsFrame().equals(UserConstants.NO_FRAME) && StringUtils.ishttp(menu.getPath());
|
|
|
420
|
+ }
|
|
|
421
|
+
|
|
|
422
|
+ /**
|
|
388
|
423
|
* 是否为parent_view组件
|
|
389
|
424
|
*
|
|
390
|
425
|
* @param menu 菜单信息
|