From 6311a8b8af3bb964f3154305f0cb0d6840ebbe88 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Thu, 14 Sep 2023 11:22:12 +0800
Subject: [PATCH] 新增角色树查询接口(查询所有下级)

---
 src/main/java/org/springblade/modules/system/mapper/RoleMapper.xml |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/springblade/modules/system/mapper/RoleMapper.xml b/src/main/java/org/springblade/modules/system/mapper/RoleMapper.xml
index 7319078..931d402 100644
--- a/src/main/java/org/springblade/modules/system/mapper/RoleMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/RoleMapper.xml
@@ -21,11 +21,14 @@
     </resultMap>
 
     <select id="selectRolePage" resultMap="roleResultMap">
-        select * from blade_role where is_deleted = 0
+        select *
+        from blade_role
+        where is_deleted = 0
     </select>
 
     <select id="tree" resultMap="treeNodeResultMap">
-        select id, parent_id, role_name as title, id as "value", id as "key" from blade_role where is_deleted = 0
+        select id, parent_id, role_name as title, id as "value", id as "key" from blade_role where is_deleted = 0 AND
+        id!=1123598816738675201
         <if test="param1!=null">
             and tenant_id = #{param1}
         </if>
@@ -63,4 +66,49 @@
         and is_deleted = 0
     </select>
 
+
+    <select id="Info" resultType="java.lang.String">
+        SELECT role_alias as rolename
+        FROM blade_role
+        WHERE id = #{id}
+          and is_deleted = 0
+    </select>
+
+    <!--角色查询-->
+    <select id="selectRole" resultType="java.util.HashMap">
+        SELECT id,
+               role_name AS title
+        FROM blade_role
+        WHERE is_deleted = 0
+          AND id != 1123598816738675201
+	AND id != 1414575877054365698
+	AND id != 1414840172333842433
+	AND id != 1415870935329771522
+	AND id != 1416733602219110402
+	AND id != 1428177141018771458
+	AND id != 1428972101748465665
+	AND id != 1431234799414071297
+    </select>
+
+    <!--角色查询-->
+    <select id="getRoleList" resultType="org.springblade.modules.system.entity.Role">
+        SELECT br.* FROM blade_role br
+        inner join (
+            SELECT * FROM
+            (
+                SELECT t1.*,IF( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild FROM
+                ( SELECT id, parent_id,role_name FROM blade_role t where is_deleted =0 ORDER BY parent_id, id ) t1,
+                ( SELECT @pids := #{roleParam.roleId} ) t2
+            ) t3
+            WHERE
+            ischild != 0
+        ) on br.id = t3.id
+        <if test="roleParam.isNowLevel==0">
+            union all
+            (
+            SELECT * FROM blade_role where id = #{roleParam.roleId}
+            )
+        </if>
+    </select>
+
 </mapper>

--
Gitblit v1.9.3