serv-学习管理

This commit is contained in:
2025-10-21 16:21:19 +08:00
parent f72a5cec61
commit 9824a7d686
27 changed files with 1192 additions and 336 deletions

View File

@@ -5,9 +5,13 @@
<!-- 基础结果映射 -->
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.study.TbCourseChapter">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="chapter_id" property="chapterID" jdbcType="VARCHAR"/>
<result column="course_id" property="courseID" jdbcType="VARCHAR"/>
<result column="parent_id" property="parentID" jdbcType="VARCHAR"/>
<result column="name" property="name" jdbcType="VARCHAR"/>
<result column="content" property="content" jdbcType="LONGVARCHAR"/>
<result column="chapter_type" property="chapterType" jdbcType="INTEGER"/>
<result column="resource_id" property="resourceID" jdbcType="VARCHAR"/>
<result column="video_url" property="videoUrl" jdbcType="VARCHAR"/>
<result column="duration" property="duration" jdbcType="INTEGER"/>
<result column="order_num" property="orderNum" jdbcType="INTEGER"/>
@@ -21,7 +25,7 @@
<!-- 基础字段 -->
<sql id="Base_Column_List">
id, course_id, name, content, video_url, duration, order_num,
id, chapter_id, course_id, parent_id, name, content, chapter_type, resource_id, video_url, duration, order_num,
creator, updater, create_time, update_time, delete_time, deleted
</sql>
@@ -29,12 +33,21 @@
<sql id="Where_Clause">
<where>
deleted = 0
<if test="chapterID != null and chapterID != ''">
AND chapter_id = #{chapterID}
</if>
<if test="courseID != null and courseID != ''">
AND course_id = #{courseID}
</if>
<if test="parentID != null and parentID != ''">
AND parent_id = #{parentID}
</if>
<if test="name != null and name != ''">
AND name LIKE CONCAT('%', #{name}, '%')
</if>
<if test="chapterType != null">
AND chapter_type = #{chapterType}
</if>
</where>
</sql>
@@ -103,10 +116,10 @@
<!-- 插入课程章节 -->
<insert id="insertCourseChapter" parameterType="org.xyzh.common.dto.study.TbCourseChapter">
INSERT INTO tb_course_chapter (
id, course_id, name, content, video_url, duration, order_num,
id, chapter_id, course_id, parent_id, name, content, chapter_type, resource_id, video_url, duration, order_num,
creator, updater, create_time, update_time, delete_time, deleted
) VALUES (
#{id}, #{courseID}, #{name}, #{content}, #{videoUrl}, #{duration}, #{orderNum},
#{id}, #{chapterID}, #{courseID}, #{parentID}, #{name}, #{content}, #{chapterType}, #{resourceID}, #{videoUrl}, #{duration}, #{orderNum},
#{creator}, #{updater}, #{createTime}, #{updateTime}, #{deleteTime}, #{deleted}
)
</insert>
@@ -115,15 +128,27 @@
<update id="updateCourseChapter" parameterType="org.xyzh.common.dto.study.TbCourseChapter">
UPDATE tb_course_chapter
<set>
<if test="chapterID != null and chapterID != ''">
chapter_id = #{chapterID},
</if>
<if test="courseID != null and courseID != ''">
course_id = #{courseID},
</if>
<if test="parentID != null">
parent_id = #{parentID},
</if>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="content != null and content != ''">
content = #{content},
</if>
<if test="chapterType != null">
chapter_type = #{chapterType},
</if>
<if test="resourceID != null">
resource_id = #{resourceID},
</if>
<if test="videoUrl != null and videoUrl != ''">
video_url = #{videoUrl},
</if>
@@ -146,26 +171,25 @@
deleted = #{deleted},
</if>
</set>
WHERE id = #{id}
WHERE chapter_id = #{chapterID}
</update>
<!-- 删除课程章节 -->
<delete id="deleteCourseChapter" parameterType="org.xyzh.common.dto.study.TbCourseChapter">
DELETE FROM tb_course_chapter
WHERE id = #{id}
WHERE chapter_id = #{chapterID}
</delete>
<!-- 批量插入课程章节 -->
<insert id="batchInsertCourseChapters" parameterType="java.util.List">
INSERT INTO tb_course_chapter (
id, course_id, name, content, video_url, duration, order_num,
creator, updater, create_time, update_time, delete_time, deleted
id, chapter_id, course_id, parent_id, name, content, chapter_type, resource_id, video_url, duration, order_num,
creator, create_time
) VALUES
<foreach collection="courseChapterList" item="item" separator=",">
(
#{item.id}, #{item.courseID}, #{item.name}, #{item.content}, #{item.videoUrl},
#{item.duration}, #{item.orderNum}, #{item.creator}, #{item.updater},
#{item.createTime}, #{item.updateTime}, #{item.deleteTime}, #{item.deleted}
#{item.id}, #{item.chapterID}, #{item.courseID}, #{item.parentID}, #{item.name}, #{item.content}, #{item.chapterType},
#{item.resourceID}, #{item.videoUrl}, #{item.duration}, #{item.orderNum}, #{item.creator}, #{item.createTime}
)
</foreach>
</insert>