From 03a3edee9ff27fa9bb4b32dcda08e279c7c094c8 Mon Sep 17 00:00:00 2001
From: heheng <475597332@qq.com>
Date: 星期五, 28 十一月 2025 17:30:11 +0800
Subject: [PATCH] 功能修改

---
 multi-system/src/main/resources/mapper/system/SysUserMapper.xml |  138 ++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 127 insertions(+), 11 deletions(-)

diff --git a/multi-system/src/main/resources/mapper/system/SysUserMapper.xml b/multi-system/src/main/resources/mapper/system/SysUserMapper.xml
index aaa9a40..3f15857 100644
--- a/multi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/multi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -26,19 +26,38 @@
         <result property="companyName"        column="company_name"          />
         <result property="remainPeriod"        column="remain_period"          />
         <result property="parentName"        column="parent_name"          />
-        <result property="idCard"        column="id_card"          />
+<!--        <result property="idCard"        column="id_card"          />-->
         <result property="duty"        column="duty"          />
         <result property="post"        column="post"          />
         <result property="deptId"        column="dept_id"          />
         <result property="deptName"        column="dept_name"          />
-        <result  property="entryTime"        column="entry_time"          />
-        <result property="resignTime"        column="resign_time"          />
+<!--        <result  property="entryTime"        column="entry_time"          />-->
+<!--        <result property="resignTime"        column="resign_time"          />-->
         <result property="personType"        column="person_type"          />
         <result property="age"        column="age"          />
-        <result property="positional"        column="positional"          />
+<!--        <result property="positional"        column="positional"          />-->
+<!--        <result property="qualification"        column="qualification"          />-->
+        <result property="operationCertificate"        column="operation_certificate"          />
+        <result property="internal"        column="internal"          />
 
     </resultMap>
 
+    <resultMap id="SysUserVoResult" type="com.gkhy.exam.common.domain.entity.SysUser" extends="SysUserResult">
+        <collection property="roles" ofType="com.gkhy.exam.common.domain.entity.SysRole" column="userId = id" select="getReponseData">
+            <result     property="roleId"     column="role_id"     />
+            <result property="roleName"     column="role_name"     />
+        </collection>
+    </resultMap>
+
+
+    <resultMap id="SysUserSpVoResult" type="com.gkhy.exam.system.domain.vo.SpSysUser" extends="SysUserVoResult">
+        <result property="idCard"        column="id_card"          />
+        <result property="entryTime"        column="entry_time"          />
+        <result property="resignTime"        column="resign_time"          />
+        <result property="positional"        column="positional"          />
+        <result property="qualification"        column="qualification"          />
+
+    </resultMap>
 
 
     <delete id="deleteUserById" parameterType="java.lang.Long">
@@ -47,18 +66,26 @@
 
 
     <select id="getUserByUsername" resultMap="SysUserResult">
-        select id,username,name,password,user_type,company_id,status,del_flag,parent_id from sys_user
-        where username=#{username} and del_flag=0 limit 1
+        select u.id,u.username,u.name,u.password,u.user_type,u.company_id,u.status,u.del_flag,u.parent_id,u.dept_id,d.dept_name from sys_user u
+            left join sys_dept  d on d.dept_id=u.dept_id
+        where u.username=#{username} and u.del_flag=0 limit 1
     </select>
 
-    <select id="userList"  resultMap="SysUserResult">
+    <select id="getReponseData" resultType="com.gkhy.exam.common.domain.entity.SysRole">
+        select r.role_name,r.role_id from  sys_user_role ur
+        left join sys_role r on r.role_id=ur.role_id
+        where ur.user_id = #{userId}
+    </select>
+<!--    ,u.id_card,u.entry_time,u.resign_time,u.positional,u.qualification-->
+    <select id="userList"  resultMap="SysUserVoResult">
         select u.id,u.username,u.name,u.user_type,u.phone,u.parent_id,u.company_id,u.sex,u.status,u.del_flag,u.version,
                u.login_ip,u.login_date,u.create_by,u.create_time,u.remark,c.name as company_name,su.name as parent_name,
-                u.dept_id,d.dept_name,u.duty,u.post,u.id_card,u.entry_time,u.resign_time,u.person_type,u.age,u.positional
+                u.dept_id,d.dept_name,u.duty,u.post,u.person_type,u.age,u.operation_certificate,u.internal
         from sys_user u
         left join sys_company c on c.id=u.company_id
         left join sys_user su on su.id=u.parent_id and u.parent_id!=0
         left join sys_dept  d on d.dept_id=u.dept_id
+
         <where>
             and u.del_flag = 0
             <if test="username != null and username != ''">
@@ -70,14 +97,29 @@
             <if test="status != null and status != ''">
                 AND u.status = #{status}
             </if>
+            <if test="personType != null">
+                AND u.person_type = #{personType}
+            </if>
+            <if test="internal != null">
+                AND u.internal = #{internal}
+            </if>
+<!--            <if test="qualification != null">-->
+<!--                AND u.qualification = #{qualification}-->
+<!--            </if>-->
             <if test="userType != null">
                 AND u.user_type = #{userType}
+            </if>
+            <if test="deptId != null">
+                AND d.dept_id = #{deptId}
             </if>
             <if test="companyId != null ">
                 AND u.company_id = #{companyId}
             </if>
             <if test="phone != null and phone != ''">
                 AND u.phone like concat('%', #{phone}, '%')
+            </if>
+            <if test="post != null and post != ''">
+                AND u.post like concat('%', #{post}, '%')
             </if>
             <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
                 AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
@@ -94,9 +136,79 @@
             <if test="params.userType != null and params.userType==0">
                 AND u.user_type in (1,2,3,4)
             </if>
+
         </where>
         order by u.id desc
     </select>
+
+
+
+    <select id="userSpList"  resultMap="SysUserSpVoResult">
+        select u.id,u.username,u.name,u.user_type,u.phone,u.parent_id,u.company_id,u.sex,u.status,u.del_flag,u.version,
+        u.login_ip,u.login_date,u.create_by,u.create_time,u.remark,c.name as company_name,su.name as parent_name,
+        u.dept_id,d.dept_name,u.duty,u.post,u.person_type,u.age,u.operation_certificate,u.internal,
+        ur.id_card,ur.entry_time,ur.resign_time,ur.positional,ur.qualification
+        from sys_user u
+        left join sys_company c on c.id=u.company_id
+        left join sys_user su on su.id=u.parent_id and u.parent_id!=0
+        left join sys_dept  d on d.dept_id=u.dept_id
+        left join employee_record ur on ur.user_id=u.id
+
+        <where>
+            and u.del_flag = 0
+            <if test="username != null and username != ''">
+                AND u.username like concat('%', #{username}, '%')
+            </if>
+            <if test="name != null and name != ''">
+                AND u.name like concat('%', #{name}, '%')
+            </if>
+            <if test="status != null and status != ''">
+                AND u.status = #{status}
+            </if>
+            <if test="personType != null">
+                AND u.person_type = #{personType}
+            </if>
+            <if test="internal != null">
+                AND u.internal = #{internal}
+            </if>
+            <!--            <if test="qualification != null">-->
+            <!--                AND u.qualification = #{qualification}-->
+            <!--            </if>-->
+            <if test="userType != null">
+                AND u.user_type = #{userType}
+            </if>
+            <if test="deptId != null">
+                AND d.dept_id = #{deptId}
+            </if>
+            <if test="companyId != null ">
+                AND u.company_id = #{companyId}
+            </if>
+            <if test="phone != null and phone != ''">
+                AND u.phone like concat('%', #{phone}, '%')
+            </if>
+            <if test="post != null and post != ''">
+                AND u.post like concat('%', #{post}, '%')
+            </if>
+            <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
+                AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+            </if>
+            <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
+                AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+            </if>
+            <if test="params.userType != null and (params.userType==4 or params.userType==1)">
+                AND u.user_type in (2,3)
+            </if>
+            <if test="params.userType != null and params.userType==2">
+                AND u.user_type in (3)
+            </if>
+            <if test="params.userType != null and params.userType==0">
+                AND u.user_type in (1,2,3,4)
+            </if>
+
+        </where>
+        order by u.id desc
+    </select>
+
 
 
 
@@ -104,10 +216,11 @@
         select id,username,name,password,parent_id,company_id,phone,status,del_flag from sys_user
         where phone=#{phone} and del_flag=0
     </select>
-
-    <select id="getUserById" resultMap="SysUserResult">
+<!--,u.positional,u.qualification,u.id_card,u.entry_time,u.resign_time,-->
+    <select id="getUserById" resultMap="SysUserVoResult">
         select u.id,u.username,u.user_type,u.name,u.phone,u.parent_id,u.company_id,u.status,u.sex,u.del_flag,u.version,c.name as company_name,
-               c.remain_period,su.name as parent_name,u.dept_id,d.dept_name,u.duty,u.post,u.id_card,u.entry_time,u.resign_time,u.person_type,u.age,u.positional
+               c.remain_period,su.name as parent_name,u.dept_id,d.dept_name,u.duty,u.post,
+               u.person_type,u.age,u.operation_certificate,u.internal
         from sys_user u
        left join sys_company c on c.id=u.company_id
        left join sys_user su on su.id=u.parent_id and u.parent_id!=0
@@ -159,4 +272,7 @@
         </if>
     </select>
 
+
+
+
 </mapper>

--
Gitblit v1.9.2