From cff3c43f216c6f01f675e4821832e15f2a77c57c Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: 星期三, 05 二月 2025 13:00:04 +0800
Subject: [PATCH] 煤矿缴费修改

---
 exam-system/src/main/resources/mapper/institutionaccess/ThStudentBatchMapper.xml |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThStudentBatchMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThStudentBatchMapper.xml
index 3884fef..bac9fba 100644
--- a/exam-system/src/main/resources/mapper/institutionaccess/ThStudentBatchMapper.xml
+++ b/exam-system/src/main/resources/mapper/institutionaccess/ThStudentBatchMapper.xml
@@ -123,11 +123,11 @@
     </update>
 
     <select id="getStudentBatchVOByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudentBatchVO">
-        select sb.*, b.batch_lesson_num from th_student_batch sb INNER JOIN th_batch b ON sb.batch_uuid = b.uuid where sb.del_flag = 0 and sb.batch_uuid = #{batchUuid}
+        select sb.*, b.batch_lesson_num from th_student_batch sb INNER JOIN th_batch b ON sb.batch_uuid = b.uuid where sb.del_flag = 0 and b.del_flag=0 and sb.batch_uuid = #{batchUuid}
     </select>
 
     <select id="getByIdCards" resultType="com.gkhy.exam.institutionalaccess.entity.ThStudentBatch" >
-        select idcard, name, sex, phone, auth_photo,train_org_name, institution_id, institution_name,
+        select id,uuid,idcard, name, sex, phone, auth_photo,train_org_name, institution_id, institution_name,
         industry,occupation,post,finish_status,batch_uuid from th_student_batch where del_flag = 0 and idcard in
         <foreach collection="idcards" item="idcard" index ="index" open="(" close=")" separator=",">
             #{idcard}
@@ -147,5 +147,58 @@
           AND bc.course_uuid = #{courseUuid}
     </select>
 
+    <select id="getStatistic" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThTrainVO">
+        SELECT
+        sb.institution_id,
+        count( sb.institution_id ) studentCount,
+        sum(case when sb.finish_status=1 then 1 else 0 end) finishCount
+
+        FROM
+        th_student_batch sb
+        LEFT JOIN th_batch b ON sb.batch_uuid = b.uuid
+        WHERE
+        sb.del_flag = 0
+        <if test="query.subjectCode != null and query.subjectCode != ''">
+            and b.subject_code like concat(#{query.subjectCode}, '%')
+        </if>
+        <if test="query.trainOrgName != null and query.trainOrgName != ''">
+            and b.train_org_name = #{query.trainOrgName}, '%')
+        </if>
+        <if test="query.startTime != null"><!-- 开始时间检索 -->
+            and date_format(b.actual_start_time,'%y-%m-%d') &gt;= date_format(#{query.startTime},'%y-%m-%d')
+        </if>
+        <if test="query.endTime != null"><!-- 结束时间检索 -->
+            and date_format(b.actual_start_time,'%y-%m-%d') &lt;= date_format(#{query.endTime},'%y-%m-%d')
+        </if>
+        GROUP BY
+        sb.institution_id
+    </select>
+    <select id="getStatisticHaveExam" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThTrainVO">
+        SELECT
+        sb.institution_id,
+        count( sb.institution_id ) studentCount,
+        sum(case when sb.finish_status=1 then 1 else 0 end) finishCount
+
+        FROM
+        th_student_batch sb
+        LEFT JOIN th_batch b ON sb.batch_uuid = b.uuid
+        WHERE
+        sb.del_flag = 0
+        AND b.have_exam = 1
+        <if test="query.subjectCode != null and query.subjectCode != ''">
+            and b.subject_code like concat(#{query.subjectCode}, '%')
+        </if>
+        <if test="query.trainOrgName != null and query.trainOrgName != ''">
+            and b.train_org_name = #{query.trainOrgName}, '%')
+        </if>
+        <if test="query.startTime != null"><!-- 开始时间检索 -->
+            and date_format(b.actual_start_time,'%y-%m-%d') &gt;= date_format(#{query.startTime},'%y-%m-%d')
+        </if>
+        <if test="query.endTime != null"><!-- 结束时间检索 -->
+            and date_format(b.actual_start_time,'%y-%m-%d') &lt;= date_format(#{query.endTime},'%y-%m-%d')
+        </if>
+        GROUP BY
+        sb.institution_id
+    </select>
 </mapper>
 

--
Gitblit v1.9.2