From 815b09210efc350400801882441d2bb0d2950a1c Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期五, 04 十一月 2022 15:19:40 +0800
Subject: [PATCH] 修改bug

---
 ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml |   67 +++++++++++++++++----------------
 1 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml b/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml
index 4142d4e..737fc65 100644
--- a/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml
+++ b/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml
@@ -34,14 +34,14 @@
             <result column="depart_update_time" property="updateTime"/>
             <result column="is_deleted" property="isDeleted"/>
         </association>
-        <collection property="roles" javaType="ArrayList" ofType="com.ycl.entity.user.UmsRole">
-            <id column="role_id" property="id" />
-            <result column="name" property="name" />
-            <result column="description" property="description" />
-            <result column="admin_count" property="adminCount" />
-            <result column="role_create_time" property="createTime" />
-            <result column="role_status" property="status" />
-            <result column="sort" property="sort" />
+        <collection property="roles" javaType="ArrayList" ofType="com.ycl.entity.user.UmsRole" column="id" select="selectAdminRoles">
+            <id column="role_id" property="id"/>
+            <result column="name" property="name"/>
+            <result column="description" property="description"/>
+            <result column="admin_count" property="adminCount"/>
+            <result column="role_create_time" property="createTime"/>
+            <result column="role_status" property="status"/>
+            <result column="sort" property="sort"/>
         </collection>
     </resultMap>
 
@@ -54,29 +54,20 @@
 
     <select id="selectCondPage" parameterType="com.ycl.entity.user.UmsAdmin" resultMap="CondMapResultMap">
         SELECT
-            ua.*,
-            ud.id depart_id,
-            ud.depart_name,
-            ud.depart_des,
-            ud.depart_type,
-            ud.parent_id,
-            ud.create_time depat_create_time,
-            ud.update_time depat_update_time,
-            ud.STATUS depart_status,
-            ud.is_deleted,
-            ur.id role_id,
-            ur.name NAME,
-            ur.description,
-            ur.admin_count,
-            ur.create_time role_create_time,
-            ur.STATUS role_status,
-            ur.sort
+        ua.*,
+        ud.id depart_id,
+        ud.depart_name,
+        ud.depart_des,
+        ud.depart_type,
+        ud.parent_id,
+        ud.create_time depat_create_time,
+        ud.update_time depat_update_time,
+        ud.STATUS depart_status,
+        ud.is_deleted
         FROM
-            ums_admin ua
-                LEFT JOIN ums_depart_manager udm ON ua.id = udm.user_id
-                LEFT JOIN ums_depart ud ON udm.depart_id = ud.id
-                LEFT JOIN ums_admin_role_relation uarr ON ua.id = uarr.admin_id
-                LEFT JOIN ums_role ur ON uarr.role_id = ur.id
+        ums_admin ua
+        LEFT JOIN ums_depart_manager udm ON ua.id = udm.user_id
+        LEFT JOIN ums_depart ud ON udm.depart_id = ud.id
         <where>
             <if test="umsAdmin.keyword !=null  and umsAdmin.keyword !=''">
                 AND (ua.username LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%')
@@ -91,7 +82,19 @@
             </if>
         </where>
         ORDER BY
-            ua.id DESC
+        ua.id DESC
     </select>
-
+    <select id="selectAdminRoles" parameterType="java.lang.Long" resultType="com.ycl.entity.user.UmsRole">
+        select ur.id          role_id,
+               ur.name        NAME,
+               ur.description,
+               ur.admin_count,
+               ur.create_time role_create_time,
+               ur.STATUS      role_status,
+               ur.sort
+        from ums_admin ua
+                 LEFT JOIN ums_admin_role_relation uarr ON ua.id = uarr.admin_id
+                 left join ums_role ur on uarr.role_id = ur.id
+        where ua.id = #{id}
+    </select>
 </mapper>

--
Gitblit v1.8.0