From 790c2ba4a0b46edf191e3bac84931f796bd42b8f Mon Sep 17 00:00:00 2001
From: zhangf <1603559716@qq.com>
Date: 星期三, 24 七月 2024 09:02:49 +0800
Subject: [PATCH] 三方对接接口优化

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

diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThStudentBatchMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThStudentBatchMapper.xml
new file mode 100644
index 0000000..3884fef
--- /dev/null
+++ b/exam-system/src/main/resources/mapper/institutionaccess/ThStudentBatchMapper.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gkhy.exam.institutionalaccess.mapper.ThStudentBatchMapper">
+    <insert id="insertBatch">
+        INSERT INTO th_student_batch (uuid,idcard, name, sex, phone, auth_photo,train_org_name, institution_id, institution_name,
+        industry,occupation,post,del_flag,create_time,update_time,create_by,update_by,finish_status,batch_uuid) VALUES
+        <foreach collection="list" separator="," item="item">
+            (#{item.uuid},#{item.idcard},#{item.name},#{item.sex},#{item.phone},#{item.authPhoto},#{item.trainOrgName},#{item.institutionId},#{item.institutionName},
+            #{item.industry},#{item.occupation},#{item.post},#{item.delFlag},#{item.createTime},
+            #{item.updateTime},#{item.createBy},#{item.updateBy},#{item.finishStatus},#{item.batchUuid})
+        </foreach>
+    </insert>
+
+
+
+    <update id="updateBatch" parameterType="java.util.List" >
+        <foreach collection="list" item="item" index="index" separator=";">
+            UPDATE th_student_batch
+            <set>
+                <if test="item.uuid != null and item.uuid != ''" >
+                    uuid = #{item.uuid},
+                </if>
+                <if test="item.name != null and item.name != ''" >
+                    name = #{item.name},
+                </if>
+                <if test="item.idcard != null and item.idcard != ''" >
+                    idcard = #{item.idcard},
+                </if>
+                <if test="item.sex != null" >
+                    sex = #{item.sex},
+                </if>
+                <if test="item.phone != null and item.phone != ''" >
+                    phone = #{item.phone},
+                </if>
+                <if test="item.authPhoto != null and item.authPhoto != ''" >
+                    auth_photo = #{item.authPhoto},
+                </if>
+                <if test="item.trainOrgName != null and item.trainOrgName != ''" >
+                    train_org_name = #{item.trainOrgName},
+                </if>
+                <if test="item.institutionId != null" >
+                    institution_id = #{item.institutionId},
+                </if>
+                <if test="item.institutionName != null and item.institutionName != ''" >
+                    institution_name = #{item.institutionName},
+                </if>
+                <if test="item.industry != null and item.industry != ''" >
+                    industry = #{item.industry},
+                </if>
+                <if test="item.occupation != null and item.occupation != ''" >
+                    occupation = #{item.occupation},
+                </if>
+                <if test="item.post != null and item.post != ''" >
+                    post = #{item.post},
+                </if>
+                <if test="item.batchUuid != null and item.batchUuid != ''" >
+                    batch_uuid = #{item.batchUuid},
+                </if>
+                <if test="item.delFlag != null" >
+                    del_flag = #{item.delFlag},
+                </if>
+                <if test="item.finishStatus != null" >
+                    finish_status = #{item.finishStatus},
+                </if>
+                <if test="item.updateBy != null and item.updateBy != ''" >
+                    update_by = #{item.updateBy},
+                </if>
+                <if test="item.updateTime != null" >
+                    update_time = #{item.updateTime}
+                </if>
+            </set>
+            where id = #{item.id}
+        </foreach>
+    </update>
+
+
+   <select id="statisticByCourseUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO">
+       SELECT
+           c.course_uuid,
+           count(s.idcard) as count
+       FROM
+           th_student_batch s
+           INNER JOIN th_batch_course c ON s.batch_uuid = c.batch_uuid
+       WHERE
+           s.del_flag = 0
+         AND c.del_flag = 0
+       GROUP BY
+           c.course_uuid
+   </select>
+
+    <select id="statisticByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO">
+        SELECT
+            s.batch_uuid,
+            count( s.idcard ) AS count
+        FROM
+            th_student_batch s
+        WHERE
+            s.del_flag = 0
+        GROUP BY
+            s.batch_uuid
+    </select>
+
+    <select id="getStudentBatchCourseVOByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudentBatchCourseVO">
+        SELECT
+            sb.idcard,
+            sb.batch_uuid,
+            sb.`name`,
+            bc.course_uuid
+        FROM
+            th_student_batch sb
+                INNER JOIN th_batch_course bc ON bc.batch_uuid = sb.batch_uuid
+        WHERE
+            sb.del_flag = 0
+          AND bc.del_flag = 0
+          AND sb.batch_uuid = #{batchUuid}
+    </select>
+
+    <update id="updateByBatchUuid">
+        update th_student_batch set finish_status = 1 where batch_uuid = #{batchUuid}
+    </update>
+    <update id="updateFinishStatusByBatchUuid">
+        update th_student_batch set finish_status = 1 where batch_uuid = #{batchUuid}
+    </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>
+
+    <select id="getByIdCards" resultType="com.gkhy.exam.institutionalaccess.entity.ThStudentBatch" >
+        select 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}
+        </foreach>
+    </select>
+    <select id="getStudentBatchVOByCourseUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudentBatchVO">
+        SELECT
+            sb.*,
+            b.batch_lesson_num,
+            bc.course_lesson_num
+        FROM
+            th_student_batch sb
+                INNER JOIN th_batch b ON sb.batch_uuid = b.uuid
+                INNER JOIN th_batch_course bc ON bc.batch_uuid = b.uuid
+        WHERE
+            sb.del_flag = 0
+          AND bc.course_uuid = #{courseUuid}
+    </select>
+
+</mapper>
+

--
Gitblit v1.9.2