<?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>
|