教育训练处考试制证系统后端
“djh”
2025-02-25 70dcf4e610a0ec5fd6ca2c3daf9edf4957b30529
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?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>