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/ThBatchMapper.xml |  143 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 143 insertions(+), 0 deletions(-)

diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThBatchMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchMapper.xml
new file mode 100644
index 0000000..ea40be5
--- /dev/null
+++ b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchMapper.xml
@@ -0,0 +1,143 @@
+<?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.ThBatchMapper">
+    <select id="listByPage" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThBatchVO">
+        select
+            id,
+            uuid,
+            batch_name,
+            institution_id,
+            institution_name,
+            have_exam,
+            status,
+            del_flag,
+            create_time,
+            update_time
+        from th_batch where del_flag = 0
+        <if test="query.institutionId != null">
+            and institution_id = #{query.institutionId}
+        </if>
+        <if test="query.batchName != null and query.batchName != ''">
+            and batch_name like concat('%', #{query.batchaName}, '%')
+        </if>
+        <if test="query.startTime != null"><!-- 开始时间检索 -->
+            and date_format(d.create_time,'%y-%m-%d') &gt;= date_format(#{query.startTime},'%y-%m-%d')
+        </if>
+        <if test="query.endTime != null"><!-- 结束时间检索 -->
+            and date_format(d.create_time,'%y-%m-%d') &lt;= date_format(#{query.endTime},'%y-%m-%d')
+        </if>
+        order by id desc
+
+    </select>
+    <!--批量插入-->
+    <insert id="insertBatch">
+        INSERT INTO th_batch (id, uuid, institution_id, institution_name,batch_name,have_exam,status,
+        batch_lesson_num,train_org_name, del_flag,create_time,update_time,create_by,update_by) VALUES
+        <foreach collection="batchList" separator="," item="item">
+            (#{item.id},#{item.uuid},#{item.institutionId},#{item.institutionName},#{item.batchName},#{item.haveExam},#{item.status},
+            #{item.batchLessonNum},#{item.trainOrgName},#{item.delFlag},#{item.createTime},
+            #{item.updateTime},#{item.createBy},#{item.updateBy})
+        </foreach>
+    </insert>
+
+    <!--批量修改-->
+    <update id="updateBatch" parameterType="java.util.List" >
+        <foreach collection="batchList" item="item" index="index" separator=";">
+            UPDATE th_batch
+            <set>
+                <if test="item.batchName != null and item.batchName != ''" >
+                    `batch_name` = #{item.batchName},
+                </if>
+                <if test="item.uuid != null and item.uuid != ''" >
+                    uuid = #{item.uuid},
+                </if>
+                <if test="item.haveExam != null" >
+                    have_exam = #{item.haveExam},
+                </if>
+                <if test="item.status != null" >
+                    status = #{item.status},
+                </if>
+                <if test="item.batchLessonNum != null" >
+                    batch_lesson_num = #{item.batchLessonNum},
+                </if>
+                <if test="item.delFlag != null" >
+                    del_flag = #{item.delFlag},
+                </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.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>
+
+    <!-- <update id="updateBatch" parameterType="java.util.List" >
+         <foreach collection="batchList" item="item" index="index" separator=";">
+             UPDATE th_batch
+             <set>
+                 <if test="item.batchName != null and item.batchName != ''" >
+                     batch_name = #{item.batchName},
+                 </if>
+                 <if test="item.haveExam != null" >
+                     have_exam = #{item.haveExam},
+                 </if>
+                 <if test="item.status != null" >
+                     status = #{item.status},
+                 </if>
+                 <if test="item.delFlag != null" >
+                     del_flag = #{item.delFlag},
+                 </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.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="getByUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThBatch">
+        select id, uuid, institution_id, institution_name,batch_name,have_exam,status,
+        batch_lesson_num,train_org_name
+        from th_batch
+        where del_flag = 0 and uuid in
+        <foreach collection="batchUuids" item="uuid" index ="index" open="(" close=")" separator=",">
+            #{uuid}
+        </foreach>
+    </select>
+
+    <select id="getBatchNameByUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThBatch">
+        select id, uuid, batch_name
+        from th_batch
+        where del_flag = 0 and uuid in
+        <foreach collection="batchUuids" item="uuid" index ="index" open="(" close=")" separator=",">
+            #{uuid}
+        </foreach>
+    </select>
+
+</mapper>
+

--
Gitblit v1.9.2