From 1789718f58e3374ce85357524ef80a84f3d70d6f Mon Sep 17 00:00:00 2001
From: jiangqs <jiangqs>
Date: 星期日, 25 六月 2023 18:36:01 +0800
Subject: [PATCH] 商户端统计

---
 ruoyi-modules/ruoyi-system/src/main/resources/mapper/sys/SysMenuMapper.xml |   83 ++++++++++++++++++++++++++++++++++++-----
 1 files changed, 72 insertions(+), 11 deletions(-)

diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/sys/SysMenuMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/sys/SysMenuMapper.xml
index ef3fe7b..9d5ab94 100644
--- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/sys/SysMenuMapper.xml
+++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/sys/SysMenuMapper.xml
@@ -35,6 +35,24 @@
     <select id="selectMenuList" parameterType="SysMenu" resultMap="SysMenuResult">
 		<include refid="selectMenuVo"/>
 		<where>
+			AND menu_from = 1
+			<if test="menuName != null and menuName != ''">
+				AND menu_name like concat('%', #{menuName}, '%')
+			</if>
+			<if test="visible != null and visible != ''">
+				AND visible = #{visible}
+			</if>
+			<if test="status != null and status != ''">
+				AND status = #{status}
+			</if>
+		</where>
+		order by parent_id, order_num
+	</select>
+
+	<select id="selectStaffMenuList" parameterType="SysMenu" resultMap="SysMenuResult">
+		<include refid="selectMenuVo"/>
+		<where>
+			AND menu_from = 2
 			<if test="menuName != null and menuName != ''">
 				AND menu_name like concat('%', #{menuName}, '%')
 			</if>
@@ -50,7 +68,7 @@
 	
 	<select id="selectMenuTreeAll" resultMap="SysMenuResult">
 		select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
-		from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0
+		from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0 AND menu_from = 1
 		order by m.parent_id, m.order_num
 	</select>
 	
@@ -60,7 +78,7 @@
 		left join sys_role_menu rm on m.menu_id = rm.menu_id
 		left join sys_user_role ur on rm.role_id = ur.role_id
 		left join sys_role ro on ur.role_id = ro.role_id
-		where ur.user_id = #{params.userId}
+		where ur.user_id = #{params.userId} AND m.menu_from = 1
 		<if test="menuName != null and menuName != ''">
             AND m.menu_name like concat('%', #{menuName}, '%')
 		</if>
@@ -72,6 +90,23 @@
 		</if>
 		order by m.parent_id, m.order_num
 	</select>
+
+	<select id="selectStaffMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult">
+		select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
+		from sys_menu m
+		left join sys_user_menu rm on m.menu_id = rm.menu_id
+		where rm.user_id = #{params.userId} AND rm.menu_from = 2
+		<if test="menuName != null and menuName != ''">
+			AND m.menu_name like concat('%', #{menuName}, '%')
+		</if>
+		<if test="visible != null and visible != ''">
+			AND m.visible = #{visible}
+		</if>
+		<if test="status != null and status != ''">
+			AND m.status = #{status}
+		</if>
+		order by m.parent_id, m.order_num
+	</select>
     
     <select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
 		select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
@@ -80,7 +115,7 @@
 			 left join sys_user_role ur on rm.role_id = ur.role_id
 			 left join sys_role ro on ur.role_id = ro.role_id
 			 left join sys_user u on ur.user_id = u.user_id
-		where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0  AND ro.status = 0
+		where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0  AND ro.status = 0 AND menu_from = 1
 		order by m.parent_id, m.order_num
 	</select>
 	
@@ -88,7 +123,7 @@
 		select m.menu_id
 		from sys_menu m
             left join sys_role_menu rm on m.menu_id = rm.menu_id
-        where rm.role_id = #{roleId}
+        where rm.role_id = #{roleId} AND m.menu_from = 1
             <if test="menuCheckStrictly">
               and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_role_menu rm on m.menu_id = rm.menu_id and rm.role_id = #{roleId})
             </if>
@@ -99,7 +134,18 @@
 		select m.menu_id
 		from sys_menu m
 		left join sys_dept_menu rm on m.menu_id = rm.menu_id
-		where rm.dept_id = #{deptId}
+		where rm.dept_id = #{deptId} AND m.menu_from = 1 AND rm.menu_from = 1
+		<if test="menuCheckStrictly">
+			and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_dept_menu rm on m.menu_id = rm.menu_id and rm.dept_id = #{deptId})
+		</if>
+		order by m.parent_id, m.order_num
+	</select>
+
+	<select id="selectStaffMenuListByDeptId" resultType="Long">
+		select m.menu_id
+		from sys_menu m
+		left join sys_dept_menu rm on m.menu_id = rm.menu_id
+		where rm.dept_id = #{deptId} AND m.menu_from = 2 AND rm.menu_from = 2
 		<if test="menuCheckStrictly">
 			and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_dept_menu rm on m.menu_id = rm.menu_id and rm.dept_id = #{deptId})
 		</if>
@@ -110,7 +156,18 @@
 		select m.menu_id
 		from sys_menu m
 		left join sys_user_menu rm on m.menu_id = rm.menu_id
-		where rm.user_id = #{deprUserId}
+		where rm.user_id = #{deptUserId} AND m.menu_from = 1 AND rm.menu_from = 1
+		<if test="menuCheckStrictly">
+			and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_user_menu rm on m.menu_id = rm.menu_id and rm.user_id = #{deptUserId})
+		</if>
+		order by m.parent_id, m.order_num
+	</select>
+
+	<select id="selectStaffMenuListByDeptUserId" resultType="Long">
+		select m.menu_id
+		from sys_menu m
+		left join sys_user_menu rm on m.menu_id = rm.menu_id
+		where rm.user_id = #{deptUserId} AND m.menu_from = 2 AND rm.menu_from = 2
 		<if test="menuCheckStrictly">
 			and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_user_menu rm on m.menu_id = rm.menu_id and rm.user_id = #{deptUserId})
 		</if>
@@ -122,6 +179,7 @@
 		from sys_menu m
 			 left join sys_role_menu rm on m.menu_id = rm.menu_id
 			 left join sys_user_role ur on rm.role_id = ur.role_id
+		where m.menu_from = 1
 	</select>
 
 	<select id="selectMenuPermsByUserId" parameterType="Long" resultType="String">
@@ -130,28 +188,28 @@
 			 left join sys_role_menu rm on m.menu_id = rm.menu_id
 			 left join sys_user_role ur on rm.role_id = ur.role_id
 			 left join sys_role r on r.role_id = ur.role_id
-		where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
+		where m.status = '0' and r.status = '0' and ur.user_id = #{userId} AND m.menu_from = 1
 	</select>
 	
 	<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
 		select distinct m.perms
 		from sys_menu m
 			 left join sys_role_menu rm on m.menu_id = rm.menu_id
-		where m.status = '0' and rm.role_id = #{roleId}
+		where m.status = '0' and rm.role_id = #{roleId} AND m.menu_from = 1
 	</select>
 	
 	<select id="selectMenuById" parameterType="Long" resultMap="SysMenuResult">
 		<include refid="selectMenuVo"/>
-		where menu_id = #{menuId}
+		where menu_id = #{menuId} AND m.menu_from = 1
 	</select>
 	
 	<select id="hasChildByMenuId" resultType="Integer">
-	    select count(1) from sys_menu where parent_id = #{menuId}  
+	    select count(1) from sys_menu where parent_id = #{menuId} AND m.menu_from = 1
 	</select>
 	
 	<select id="checkMenuNameUnique" parameterType="SysMenu" resultMap="SysMenuResult">
 		<include refid="selectMenuVo"/>
-		where menu_name=#{menuName} and parent_id = #{parentId} limit 1
+		where menu_name=#{menuName} and parent_id = #{parentId} limit 1 AND m.menu_from = 1
 	</select>
 	
 	<update id="updateMenu" parameterType="SysMenu">
@@ -172,6 +230,7 @@
 			<if test="icon !=null and icon != ''">icon = #{icon},</if>
 			<if test="remark != null and remark != ''">remark = #{remark},</if>
 			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+			<if test="menuFrom != null and menuFrom != ''">menu_from = #{menuFrom},</if>
 			update_time = sysdate()
 		</set>
 		where menu_id = #{menuId}
@@ -195,6 +254,7 @@
 		<if test="icon != null and icon != ''">icon,</if>
 		<if test="remark != null and remark != ''">remark,</if>
 		<if test="createBy != null and createBy != ''">create_by,</if>
+		<if test="menuFrom != null and menuFrom != ''">menu_from,</if>
 		create_time
 		)values(
 		<if test="menuId != null and menuId != 0">#{menuId},</if>
@@ -213,6 +273,7 @@
 		<if test="icon != null and icon != ''">#{icon},</if>
 		<if test="remark != null and remark != ''">#{remark},</if>
 		<if test="createBy != null and createBy != ''">#{createBy},</if>
+		<if test="menuFrom != null and menuFrom != ''">#{menuFrom},</if>
 		sysdate()
 		)
 	</insert>

--
Gitblit v1.7.1