From e9cb6857fb6360172ce63b1aca141d2f7ed80ec9 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期一, 27 五月 2024 14:38:07 +0800
Subject: [PATCH] feat:审核后才能重新发起用户调动

---
 src/main/resources/mapper/UserMapper.xml |   52 +++++++++++++++++++++++++++++++---------------------
 1 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/src/main/resources/mapper/UserMapper.xml b/src/main/resources/mapper/UserMapper.xml
index d7252e5..eebfde7 100644
--- a/src/main/resources/mapper/UserMapper.xml
+++ b/src/main/resources/mapper/UserMapper.xml
@@ -23,7 +23,7 @@
   </resultMap>
   <sql id="Base_Column_List">
     id, user_uuid, user_name, password, real_name, age, sex, birth_day, user_level, phone,
-    role, status, image_path, create_time, modify_time, last_active_time, deleted, wx_open_id, `condition`, condition_detail
+    role, status, image_path, create_time, modify_time, last_active_time, deleted, wx_open_id, `condition`
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
@@ -329,29 +329,25 @@
     </select>
 
 
-    <select id="userPage" resultMap="BaseResultMap"
-            parameterType="com.mindskip.xzs.viewmodel.admin.user.UserPageRequestVM">
+    <select id="userPage" resultType="com.mindskip.xzs.viewmodel.admin.user.UserResponseVM" parameterType="com.mindskip.xzs.viewmodel.admin.user.UserPageRequestVM">
         SELECT
-        a.*
+        a.*,
+        c.result as departmentExamineResult,
+        d.result as conditionExamineResult
         FROM t_user a
-        lEFT join
-            (select * from t_user_department
-            <if test="departmentId != null and departmentId.size() > 0">
-                where department_id in <foreach collection="departmentId" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach>
-            </if>
-                group by user_id
-            )
-            b on a.id = b.user_id
-        where
+        LEFT JOIN t_user_department b ON a.id = b.user_id
+        LEFT JOIN t_department_examine c ON a.id = c.user_id AND c.deleted = 0 AND c.result = 0
+        LEFT JOIN t_user_condition_examine d ON a.id = d.user_id AND d.deleted = 0 AND d.result = 0
+        WHERE
             a.deleted=0
             <if test="departmentId != null and departmentId.size() > 0">
-                and b.department_id in <foreach collection="departmentId" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach>
+                AND b.department_id IN <foreach collection="departmentId" item="item" open="(" separator="," close=")"> #{item} </foreach>
             </if>
             <if test="userName != null and userName != ''">
-                and real_name like concat('%',#{userName},'%')
+                AND real_name LIKE concat('%',#{userName},'%')
             </if>
             <if test="role != null and role.size() > 0">
-                and role in <foreach collection="role" item="item" open="(" separator="," close=")"> #{item} </foreach>
+                AND role IN <foreach collection="role" item="item" open="(" separator="," close=")"> #{item} </foreach>
             </if>
     </select>
 
@@ -469,11 +465,10 @@
   </update>
 
   <update id="setStatus">
-    UPDATE t_user
-    SET `condition`        = #{condition},
-        `condition_detail` = #{conditionDetail}
-    WHERE id = #{id}
-    AND deleted = 0
+      UPDATE t_user
+      SET `condition` = #{condition}
+      WHERE id = #{id}
+        AND deleted = 0
   </update>
 
     <update id="clearDeptAdmin">
@@ -554,4 +549,19 @@
         </if>
     </select>
 
+    <select id="getUserByExamByTemplateId" resultType="com.mindskip.xzs.domain.User" parameterType="com.mindskip.xzs.domain.ExamPaper">
+        <![CDATA[
+        SELECT DISTINCT
+        d.*
+        FROM
+        t_exam_templates a
+        INNER JOIN t_exam_templates_user_count b ON a.id = b.exam_templates_id and a.id = ${id}
+        LEFT JOIN t_exam_paper_answer c ON b.exam_paper_id = c.exam_paper_id AND c.create_user = b.user_id and invalid = 0
+        LEFT JOIN t_user d ON b.user_id = d.id
+        WHERE
+        ( c.id IS NULL OR ( user_score / paper_score ) < 0.6 )
+        AND b.user_id = #{createUser}
+        ]]>
+    </select>
+
 </mapper>

--
Gitblit v1.8.0