From 77a21d098f1f5995f02b267a190b4d422aba6d05 Mon Sep 17 00:00:00 2001
From: 严俊东 <1172482914@qq.com>
Date: 星期一, 12 七月 2021 11:01:50 +0800
Subject: [PATCH] 图片上传 - 多图时无法删除相应图片修复
---
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java | 40 ++++++++++++++++++++++++++++++++++++++--
1 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
index d761881..b633b84 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
@@ -10,6 +10,7 @@
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysMenu;
@@ -150,7 +151,7 @@
router.setName(getRouteName(menu));
router.setPath(getRouterPath(menu));
router.setComponent(getComponent(menu));
- router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache())));
+ router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
List<SysMenu> cMenus = menu.getChildren();
if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()))
{
@@ -160,12 +161,27 @@
}
else if (isMenuFrame(menu))
{
+ router.setMeta(null);
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(), StringUtils.equals("1", menu.getIsCache())));
+ children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
+ childrenList.add(children);
+ router.setChildren(childrenList);
+ }
+ else if (menu.getParentId().intValue() == 0 && isInnerLink(menu))
+ {
+ router.setMeta(null);
+ router.setPath("/inner");
+ List<RouterVo> childrenList = new ArrayList<RouterVo>();
+ RouterVo children = new RouterVo();
+ String routerPath = StringUtils.replaceEach(menu.getPath(), new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" });
+ children.setPath(routerPath);
+ children.setComponent(UserConstants.INNER_LINK);
+ children.setName(StringUtils.capitalize(routerPath));
+ children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath()));
childrenList.add(children);
router.setChildren(childrenList);
}
@@ -337,6 +353,11 @@
public String getRouterPath(SysMenu menu)
{
String routerPath = menu.getPath();
+ // 鍐呴摼鎵撳紑澶栫綉鏂瑰紡
+ if (menu.getParentId().intValue() != 0 && isInnerLink(menu))
+ {
+ routerPath = StringUtils.replaceEach(routerPath, new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" });
+ }
// 闈炲閾惧苟涓旀槸涓�绾х洰褰曪紙绫诲瀷涓虹洰褰曪級
if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType())
&& UserConstants.NO_FRAME.equals(menu.getIsFrame()))
@@ -364,6 +385,10 @@
{
component = menu.getComponent();
}
+ else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0 && isInnerLink(menu))
+ {
+ component = UserConstants.INNER_LINK;
+ }
else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu))
{
component = UserConstants.PARENT_VIEW;
@@ -384,6 +409,17 @@
}
/**
+ * 鏄惁涓哄唴閾剧粍浠�
+ *
+ * @param menu 鑿滃崟淇℃伅
+ * @return 缁撴灉
+ */
+ public boolean isInnerLink(SysMenu menu)
+ {
+ return menu.getIsFrame().equals(UserConstants.NO_FRAME) && StringUtils.ishttp(menu.getPath());
+ }
+
+ /**
* 鏄惁涓簆arent_view缁勪欢
*
* @param menu 鑿滃崟淇℃伅
--
Gitblit v1.9.3