From cf65d0a608b21f07dc50a98b864dfe47def4f86b Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 23 三月 2026 17:12:37 +0800
Subject: [PATCH] fix:1.产品删除 2.原材料展示 3.菜单优化 4.区分角色编辑删除

---
 src/main/resources/mapper/system/SysMenuMapper.xml |   73 +++++++++++++++++++++++++++++++++++-
 1 files changed, 71 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/system/SysMenuMapper.xml b/src/main/resources/mapper/system/SysMenuMapper.xml
index 20063e3..eae3933 100644
--- a/src/main/resources/mapper/system/SysMenuMapper.xml
+++ b/src/main/resources/mapper/system/SysMenuMapper.xml
@@ -30,8 +30,77 @@
 	</resultMap>
 
 	<sql id="selectMenuVo">
-        select menu_id, menu_name, parent_id, order_num, path,app_component, component, `query`, route_name, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time
-		from sys_menu
+		WITH RECURSIVE valid_menus AS (
+			SELECT
+				menu_id,
+				menu_name,
+				parent_id,
+				order_num,
+				path,
+				app_component,
+				component,
+				`query`,
+				route_name,
+				is_frame,
+				is_cache,
+				menu_type,
+				visible,
+				STATUS,
+				IFNULL(perms, '') AS perms,
+				icon,
+				create_time,
+				1 AS LEVEL
+			FROM
+				sys_menu
+			WHERE
+				STATUS = 0
+			  AND visible = 0
+			  AND (parent_id = 0 OR parent_id IS NULL) UNION ALL
+			SELECT
+				m.menu_id,
+				m.menu_name,
+				m.parent_id,
+				m.order_num,
+				m.path,
+				m.app_component,
+				m.component,
+				m.`query`,
+				m.route_name,
+				m.is_frame,
+				m.is_cache,
+				m.menu_type,
+				m.visible,
+				m.STATUS,
+				IFNULL(m.perms, '') AS perms,
+				m.icon,
+				m.create_time,
+				vm.LEVEL + 1
+			FROM
+				sys_menu m
+					INNER JOIN valid_menus vm ON m.parent_id = vm.menu_id
+			WHERE
+				m.STATUS = 0
+			  AND m.visible = 0
+		) SELECT
+			  menu_id,
+			  menu_name,
+			  parent_id,
+			  order_num,
+			  path,
+			  app_component,
+			  component,
+			  `query`,
+			  route_name,
+			  is_frame,
+			  is_cache,
+			  menu_type,
+			  visible,
+			  STATUS,
+			  perms,
+			  icon,
+			  create_time
+		FROM
+			valid_menus
     </sql>
     
     <select id="selectMenuList" parameterType="com.ruoyi.project.system.domain.SysMenu" resultMap="SysMenuResult">

--
Gitblit v1.9.3