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

diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseChapterMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseChapterMapper.xml
new file mode 100644
index 0000000..24eec06
--- /dev/null
+++ b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseChapterMapper.xml
@@ -0,0 +1,115 @@
+<?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.ThBatchCourseChapterMapper">
+
+    <update id="deleteByBatchUuid">
+            UPDATE th_batch_course_chapter
+            set  del_flag = 2
+            where batch_uuid = #{batchUuid}
+    </update>
+
+
+    <select id="getListByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThBatchCourseVO">
+        SELECT
+            bc.*,
+            c.course_name ,
+            (SELECT sum(cc.duration) from th_course_chapter cc where cc.course_uuid = bc.course_uuid) duration
+        FROM
+            th_batch_course bc
+            LEFT JOIN th_course c ON c.uuid = bc.course_uuid
+        WHERE
+            bc.del_flag = 0
+          AND bc.batch_uuid = #{batchUuid}
+    </select>
+
+    <select id="getByBatchUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThBatchCourseChapter">
+        select id, chapter_uuid, chapter_code,chapter_name,lesson_num,have_resource, duration,
+        institution_id,resource_type,course_uuid ,parent_uuid,
+        url,batch_uuid,serialno from th_batch_course_chapter where del_flag = 0 and batch_uuid in
+        <foreach collection="batchUuids" item="batchUuid" index ="index" open="(" close=")" separator=",">
+            #{batchUuid}
+        </foreach>
+        order by serialno
+    </select>
+
+    <select id="getByChapterUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThBatchCourseChapter">
+        select id, chapter_uuid, chapter_code,chapter_name,lesson_num,have_resource, duration,
+        institution_id,resource_type,course_uuid ,parent_uuid,
+        url,batch_uuid,serialno from th_batch_course_chapter where del_flag = 0 and chapter_uuid in
+        <foreach collection="chapterUuids" item="chapterUuid" index ="index" open="(" close=")" separator=",">
+            #{chapterUuid}
+        </foreach>
+    </select>
+
+
+    <insert id="insertBatch">
+        INSERT INTO th_batch_course_chapter ( chapter_uuid, chapter_code,chapter_name,lesson_num,have_resource, duration,
+        institution_id,resource_type,course_uuid ,parent_uuid,
+        url, del_flag,create_time,update_time,create_by,update_by,batch_uuid,serialno) VALUES
+        <foreach collection="batchCourseChapterList" separator="," item="item">
+            (#{item.chapterUuid},#{item.chapterCode},#{item.chapterName},#{item.lessonNum},#{item.haveResource},#{item.duration},
+            #{item.institutionId},#{item.resourceType},#{item.courseUuid},
+            #{item.parentUuid},#{item.url},#{item.delFlag},#{item.createTime},
+            #{item.updateTime},#{item.createBy},#{item.updateBy},#{item.batchUuid},#{item.serialno})
+        </foreach>
+    </insert>
+
+    <!--批量修改-->
+    <update id="updateBatch" parameterType="java.util.List" >
+        <foreach collection="batchCourseChapterList" item="item" index="index" separator=";">
+            UPDATE th_batch_course_chapter
+            <set>
+                <if test="item.chapterUuid != null and item.chapterUuid != ''" >
+                    chapter_uuid = #{item.chapterUuid},
+                </if>
+                <if test="item.chapterCode != null and item.chapterCode != ''" >
+                    chapter_code = #{item.chapterCode},
+                </if>
+                <if test="item.chapterName != null and item.chapterName != ''" >
+                    chapter_name = #{item.chapterName},
+                </if>
+                <if test="item.lessonNum != null" >
+                    lesson_num = #{item.lessonNum},
+                </if>
+                <if test="item.haveResource != null" >
+                    have_resource = #{item.haveResource},
+                </if>
+                <if test="item.duration != null" >
+                    duration = #{item.duration},
+                </if>
+                <if test="item.institutionId != null" >
+                    institution_id = #{item.institutionId},
+                </if>
+                <if test="item.resourceType != null" >
+                    resource_type = #{item.resourceType},
+                </if>
+                <if test="item.serialno != null" >
+                    serialno = #{item.serialno},
+                </if>
+                <if test="item.courseUuid != null and item.courseUuid != ''" >
+                    course_uuid = #{item.courseUuid},
+                </if>
+                <if test="item.parentUuid != null and item.parentUuid != ''" >
+                    parent_uuid = #{item.parentUuid},
+                </if>
+                <if test="item.url != null and item.url != ''" >
+                    url = #{item.url},
+                </if>
+                <if test="item.delFlag != null" >
+                    del_flag = #{item.delFlag},
+                </if>
+                <if test="item.updateBy != null and item.updateBy != ''" >
+                    update_by = #{item.updateBy},
+                </if>
+                <if test="item.updateTime != null" >
+                    update_time = #{item.updateTime},
+                </if>
+                <if test="item.batchUuid != null and item.batchUuid != ''" >
+                    batch_uuid = #{item.batchUuid}
+                </if>
+            </set>
+            where id = #{item.id}
+        </foreach>
+    </update>
+</mapper>
+

--
Gitblit v1.9.2