教育训练处考试制证系统后端
“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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?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.ThCourseChapterMapper">
 
    <select id="listByCourseUuids" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThCourseChapterVO">
        select cc.id,
               cc.uuid,
               cc.chapter_code,
               cc.chapter_name,
               cc.lesson_num,
               cc.duration,
               cc.institution_id,
               cc.resource_type,
               cc.have_resource,
               cc.course_uuid,
               cc.parent_uuid,
               cc.serialno,
               cc.url,
               cc.teacher
               from th_course_chapter cc
               where cc.del_flag = 0 and cc.course_uuid in
        <foreach collection="courseUuids" item="courseUuid"  open="(" close=")" separator=",">
            #{courseUuid}
        </foreach>
        order by serialno
    </select>
 
    <select id="getChapterNameByUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThCourseChapter">
        select cc.id,
        cc.uuid,
        cc.chapter_name
        from th_course_chapter cc
        where cc.del_flag = 0 and cc.uuid in
        <foreach collection="chapterUuids" item="chapterUuid"  open="(" close=")" separator=",">
            #{chapterUuid}
        </foreach>
    </select>
 
    <select id="listByCourseUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThCourseChapterVO">
        select cc.id,
        cc.uuid,
        cc.chapter_code,
        cc.chapter_name,
        cc.lesson_num,
        cc.duration,
        cc.institution_id,
        cc.resource_type,
        cc.have_resource,
        cc.course_uuid,
        cc.parent_uuid,
        cc.serialno,
        cc.url,
        cc.teacher
        from th_course_chapter cc
        where  cc.del_flag = 0 and cc.course_uuid = #{courseUuid}
        order by serialno
    </select>
 
    <select id="getByUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThCourseChapter">
        select id, uuid, chapter_code,chapter_name,lesson_num,have_resource, duration,
               institution_id,resource_type,course_uuid ,parent_uuid,serialno,
               url from th_course_chapter where del_flag = 0 and uuid in
        <foreach collection="chapterUuids" item="uuid" index ="index" open="(" close=")" separator=",">
            #{uuid}
        </foreach>
    </select>
    <insert id="insertBatch">
        INSERT INTO th_course_chapter (id, 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,serialno) VALUES
        <foreach collection="courseChapterList" separator="," item="item">
            (#{item.id},#{item.uuid},#{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.serialno})
        </foreach>
    </insert>
 
    <!--批量修改-->
    <update id="updateBatch" parameterType="java.util.List" >
        <foreach collection="courseChapterList" item="item" index="index" separator=";">
            UPDATE th_course_chapter
            <set>
                <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>
            </set>
            where id = #{item.id}
        </foreach>
    </update>
</mapper>