From 8d2895b7831497255f18a4fea10762791b5b6c13 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Tue, 19 Dec 2023 10:02:31 +0800
Subject: [PATCH] 实操成绩导入逻辑修改

---
 src/main/java/org/springblade/modules/signinrecords/mapper/SignInRecordsMapper.xml |   37 ++++++++++++++++++++++++-------------
 1 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/src/main/java/org/springblade/modules/signinrecords/mapper/SignInRecordsMapper.xml b/src/main/java/org/springblade/modules/signinrecords/mapper/SignInRecordsMapper.xml
index cdd0f05..e67b2e0 100644
--- a/src/main/java/org/springblade/modules/signinrecords/mapper/SignInRecordsMapper.xml
+++ b/src/main/java/org/springblade/modules/signinrecords/mapper/SignInRecordsMapper.xml
@@ -70,7 +70,8 @@
             shouldTemp.shouldNum,
             realTemp.realNum,
             shouldTemp.shouldNum - realTemp.realNum AS unArriveNum,
-            shouldTemp.dept_name
+            shouldTemp.dept_name,
+            shouldTemp.id as deptId
         FROM
             (
                 SELECT
@@ -113,28 +114,38 @@
             ) realTemp ON shouldTemp.id = realTemp.id
     </select>
     <select id="getSignSituationList" resultType="org.springblade.modules.signinrecords.vo.SignInfo">
-        SELECT
+        SELECT * FROM (
+            SELECT
             str.candidate_no,
             bu.avatar,
             bu.real_name,
             bu.cardId,
             str.train_exam_id as examId,
             bu.sex,
+            bd.id AS deptId,
+            bd.dept_name AS deptName,
             CASE WHEN ssir.id IS NULL THEN
-                     '未签到' ELSE '已签到'
-                END AS state
-        FROM
+            '未签到' ELSE '已签到'
+            END AS state
+            FROM
             sys_training_registration str
-                LEFT JOIN blade_user bu ON bu.id = str.user_id
-                LEFT JOIN sys_sign_in_records ssir ON ssir.candidate_no = str.candidate_no
-                <if test="signInfo.examId != null and signInfo.examId !='' ">
-                    AND ssir.exam_id = #{signInfo.examId}
-                </if>
-        WHERE str.audit_status = '1' and str.cancel = '1'
-        <if test="signInfo.examId != null and signInfo.examId !='' ">
+            LEFT JOIN blade_user bu ON bu.id = str.user_id
+            LEFT JOIN blade_dept bd ON bd.id = bu.dept_id
+            LEFT JOIN sys_sign_in_records ssir ON ssir.candidate_no = str.candidate_no
+            AND ssir.exam_id = #{signInfo.examId}
+            WHERE str.audit_status = '1' and str.cancel = '1'
             and str.train_exam_id = #{signInfo.examId}
+            <if test="signInfo.deptId != null and signInfo.deptId !='' ">
+                AND bd.id = #{signInfo.deptId}
+            </if>
+
+            ORDER BY str.candidate_no ASC
+        ) result WHERE 1=1
+        <if test="signInfo.state != null and signInfo.state !='' ">
+            AND result.state = #{signInfo.state}
         </if>
-        ORDER BY str.candidate_no ASC
+
+
     </select>
 
 </mapper>

--
Gitblit v1.9.3