From dfea866e55c725bd601ff84c92dff30f83057571 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期四, 30 三月 2023 19:56:59 +0800
Subject: [PATCH] Merge branch 'master' of http://42.193.1.25:9521/r/sccg_server

---
 ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml |   82 +++++++++++++++++++++++++++++++++++------
 1 files changed, 70 insertions(+), 12 deletions(-)

diff --git a/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml b/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml
index 77fdbc8..f422638 100644
--- a/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml
+++ b/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml
@@ -22,6 +22,7 @@
         <result column="user_type" property="userType"/>
         <result column="zj" property="zj"/>
         <result column="mobile" property="mobile"/>
+        <result column="expiration_date" property="expirationDate"/>
     </resultMap>
     <resultMap type="com.ycl.entity.user.UmsAdmin" id="CondMapResultMap" extends="BaseResultMap">
         <collection property="depart" javaType="ArrayList" ofType="com.ycl.entity.depart.UmsDepart">
@@ -35,15 +36,14 @@
             <result column="depart_update_time" property="updateTime"/>
             <result column="is_deleted" property="isDeleted"/>
         </collection>
-        <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"/>
+        <collection property="roles" javaType="ArrayList" ofType="com.ycl.entity.user.UmsRole">
+            <result column="role_id" property="id"/>
+            <result column="role_name" property="name"/>
+            <result column="role_description" property="description"/>
+            <result column="role_admin_count" property="adminCount"/>
             <result column="role_create_time" property="createTime"/>
             <result column="role_status" property="status"/>
-            <result column="sort" property="sort"/>
+            <result column="role_sort" property="sort"/>
         </collection>
     </resultMap>
 
@@ -65,11 +65,15 @@
         ud.create_time depat_create_time,
         ud.update_time depat_update_time,
         ud.STATUS depart_status,
-        ud.is_deleted
+        ud.is_deleted,
+        r.id role_id,
+        r.`name` role_name
         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 ar on ar.admin_id = ua.id
+        LEFT JOIN ums_role r on ar.role_id = r.id
         <where>
             <if test="umsAdmin.keyword !=null  and umsAdmin.keyword !=''">
                 AND (ua.username LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%')
@@ -100,6 +104,40 @@
         where ua.id = #{id}
     </select>
     <select id="selectToExp" resultType="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
+        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
+        ORDER BY ua.id DESC
+    </select>
+    <select id="selectCondTotal" parameterType="com.ycl.entity.user.UmsAdmin" resultType="java.lang.Long">
+        SELECT count(1) total
+        FROM
+        ums_admin ua
+        <where>
+            <if test="umsAdmin.keyword !=null  and umsAdmin.keyword !=''">
+                AND (ua.username LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%')
+                or ua.nick_name LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%')
+                or ua.mobile LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%'))
+            </if>
+            <if test="umsAdmin.userType !=null and umsAdmin.userType >=0 ">
+                AND ua.user_type = #{umsAdmin.userType}
+            </if>
+            <if test="umsAdmin.jobTitle !=null  and umsAdmin.keyword !=''">
+                AND ua.job_title = #{umsAdmin.jobTitle}
+            </if>
+        </where>
+    </select>
+    <select id="selectCondList" parameterType="com.ycl.entity.user.UmsAdmin" resultMap="CondMapResultMap">
         SELECT
         ua.*,
         ud.id depart_id,
@@ -110,12 +148,32 @@
         ud.create_time depat_create_time,
         ud.update_time depat_update_time,
         ud.STATUS depart_status,
-        ud.is_deleted
+        ud.is_deleted,
+        r.id role_id,
+        r.`name` role_name
         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
+        (select * from ums_admin ua
+        <where>
+            <if test="umsAdmin.keyword !=null  and umsAdmin.keyword !=''">
+                AND (ua.username LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%')
+                or ua.nick_name LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%')
+                or ua.mobile LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%'))
+            </if>
+            <if test="umsAdmin.userType !=null and umsAdmin.userType >=0 ">
+                AND ua.user_type = #{umsAdmin.userType}
+            </if>
+            <if test="umsAdmin.jobTitle !=null  and umsAdmin.keyword !=''">
+                AND ua.job_title = #{umsAdmin.jobTitle}
+            </if>
+        </where>
         ORDER BY
         ua.id DESC
+        LIMIT #{offset}, #{size} ) as
+        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 ar on ar.admin_id = ua.id
+        LEFT JOIN ums_role r on ar.role_id = r.id
+
     </select>
 </mapper>

--
Gitblit v1.8.0