From ca5445257b1fdeceddf3fcc2dea18c442023aeb7 Mon Sep 17 00:00:00 2001
From: kongzy <kongzy>
Date: 星期五, 08 十二月 2023 09:30:36 +0800
Subject: [PATCH] 新街口

---
 assess-system/src/main/resources/mapper/system/SysUserMapper.xml |   46 +++++++++++++++++++++++++++++++---------------
 1 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/assess-system/src/main/resources/mapper/system/SysUserMapper.xml b/assess-system/src/main/resources/mapper/system/SysUserMapper.xml
index 7b7b107..f42a7e2 100644
--- a/assess-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/assess-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -22,7 +22,7 @@
         <result property="expertType"        column="expert_type"         />
         <result property="jobTitle"        column="job_title"         />
         <result property="major"        column="major"         />
-        <result property="approve"        column="approve"         />
+        <result property="state"        column="state"         />
         <result property="loginIp"       column="login_ip"        />
         <result property="loginDate"     column="login_date"      />
         <result property="pwdUpdateDate" column="pwd_update_date" />
@@ -32,9 +32,9 @@
         <result property="updateTime"    column="update_time"     />
         <result property="remark"        column="remark"          />
         <association property="agency" javaType="com.gkhy.assess.system.domain.SysAgency" resultMap="agencyResult" />
-        <collection property="socialAttach" ofType="com.gkhy.assess.system.domain.SysAttach" select="getAttachByUserId" column="{userId=id}"/>
-        <collection property="medicalAttach" ofType="com.gkhy.assess.system.domain.SysAttach" select="getAttachByUserId" column="{userId=id}"/>
-        <collection property="salaryAttach" ofType="com.gkhy.assess.system.domain.SysAttach" select="getAttachByUserId" column="{userId=id}"/>
+        <collection property="socialAttach" ofType="com.gkhy.assess.system.domain.SysAttach" select="getSocialAttachByUserId" column="{userId=id}"/>
+        <collection property="medicalAttach" ofType="com.gkhy.assess.system.domain.SysAttach" select="getMedicalAttachByUserId" column="{userId=id}"/>
+        <collection property="salaryAttach" ofType="com.gkhy.assess.system.domain.SysAttach" select="getSalaryAttachByUserId" column="{userId=id}"/>
     </resultMap>
 
 
@@ -45,7 +45,7 @@
     </resultMap>
 
     <sql id="selectUserVo">
-        select u.id,u.username, u.name,u.identity,u.user_type,u.phone,u.sex,u.status,u.del_flag,u.manage_region,u.expert_type,u.agency_id,u.post,u.job_title,u.major,u.approve,u.create_time,u.remark,a.id as agency_id,a.name as agency_name,a.credit_code
+        select u.id,u.username, u.name,u.identity,u.user_type,u.phone,u.sex,u.status,u.del_flag,u.manage_region,u.expert_type,u.agency_id,u.post,u.job_title,u.major,u.state,u.create_time,u.remark,a.id as agency_id,a.name as agency_name,a.credit_code
         from sys_user u
         left join sys_agency a on u.agency_id=a.id
     </sql>
@@ -61,14 +61,14 @@
     </delete>
 
     <select id="getUserByUsername" resultMap="SysUserResult">
-        select id,username,name,password,salt,identity,status,del_flag from sys_user
+        select id,username,name,password,salt,identity,state,status,del_flag from sys_user
         where username=#{username} and del_flag=0
     </select>
 
     <select id="monitorList"  resultType="com.gkhy.assess.system.domain.SysUser">
         <include refid="selectUserVo"/>
         <where>
-            and u.del_flag = 0 and u.user_type=0
+            and u.del_flag = 0 and u.identity=0
             <if test="username != null and username != ''">
                 AND u.username like concat('%', #{username}, '%')
             </if>
@@ -85,7 +85,7 @@
     <select id="agencyList"  resultMap="SysUserResult">
         <include refid="selectUserVo"/>
         <where>
-            and u.del_flag = 0 and u.user_type=1
+            and u.del_flag = 0 and u.identity=1
             <if test="username != null and username != ''">
                 AND u.username like concat('%', #{username}, '%')
             </if>
@@ -102,7 +102,7 @@
     <select id="expertList"  resultMap="SysUserResult">
         <include refid="selectUserVo"/>
         <where>
-            and u.del_flag = 0 and u.user_type=2
+            and u.del_flag = 0 and u.identity=2
             <if test="username != null and username != ''">
                 AND u.username like concat('%', #{username}, '%')
             </if>
@@ -112,6 +112,9 @@
             <if test="phone != null and phone != ''">
                 AND u.phone like concat('%', #{phone}, '%')
             </if>
+            <if test="expertType != null and expertType != ''">
+                AND u.expert_type =#{expertType}
+            </if>
         </where>
         order by u.create_time desc
     </select>
@@ -119,17 +122,17 @@
 
 
     <select id="getUserByPhone" resultMap="SysUserResult">
-        select id,username,name,password,salt,identity,status,del_flag from sys_user
+        select id,username,name,password,salt,identity,state,status,del_flag from sys_user
         where phone=#{phone} and del_flag=0
     </select>
 
     <select id="getUserByEmail" resultMap="SysUserResult">
-        select id,username,name,password,salt,identity,status,del_flag from sys_user
+        select id,username,name,password,salt,identity,state,status,del_flag from sys_user
         where email=#{email} and del_flag=0
     </select>
 
     <select id="getUserById" resultMap="SysUserResult">
-        select id,username,name,password,salt,identity,status,del_flag from sys_user
+        select id,username,name,password,salt,identity,status,del_flag,agency_id from sys_user
         where id=#{userId}
     </select>
 
@@ -146,12 +149,25 @@
     </select>
 
     <select id="getUserByUsernamePhone" resultType="com.gkhy.assess.system.domain.SysUser">
-        select id,username,name,password,salt,identity,status,del_flag from sys_user
+        select id,username,name,password,salt,identity,state,status,del_flag from sys_user
         where (username=#{username} or phone=#{username}) and del_flag=0
     </select>
 
 
-    <select id="getAttachByUserId" resultType="com.gkhy.assess.system.domain.SysAttach">
-        select id,name,path,type,user_id,create_time from sys_attach where user_id=#{userId} order by create_time desc limit 1
+    <select id="getSocialAttachByUserId" resultType="com.gkhy.assess.system.domain.SysAttach">
+        select id,name,path,type,user_id,create_time from sys_attach where user_id=#{userId} and type=1 order by create_time desc
+    </select>
+
+    <select id="getMedicalAttachByUserId" resultType="com.gkhy.assess.system.domain.SysAttach">
+        select id,name,path,type,user_id,create_time from sys_attach where user_id=#{userId} and type=2 order by create_time desc
+    </select>
+
+    <select id="getSalaryAttachByUserId" resultType="com.gkhy.assess.system.domain.SysAttach">
+        select id,name,path,type,user_id,create_time from sys_attach where user_id=#{userId} and type=3 order by create_time desc
+    </select>
+
+    <select id="getUserInfoById" resultMap="SysUserResult">
+        <include refid="selectUserVo"/>
+        where u.id=#{userId}
     </select>
 </mapper>

--
Gitblit v1.9.2