2026-03-10 14:30:24 +08:00

67 lines
2.4 KiB
XML

<?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="LessonPart">
<insert id="insertLessonPart" parameterType="LessonPart">
INSERT INTO LessonPart ( lessonPartId, lessonId, title, description, background, orderId, status ,isPage ) Values ( #{lessonPartId}, #{lessonId}, #{title}, #{description}, #{background}, #{orderId}, #{status} ,#{isPage} )
</insert>
<update id="updateLessonPart" parameterType="LessonPart">
UPDATE LessonPart SET
lessonPartId = #{lessonPartId}, lessonId = #{lessonId}, title = #{title}, description = #{description}, background = #{background}, orderId = #{orderId}, status = #{status},isPage = #{isPage}
where lessonPartId=#{lessonPartId}
</update>
<select id="getLessonPartByKey" parameterType="java.lang.Integer" resultType="LessonPart">
SELECT lessonPartId , lessonId , title , description , background , orderId , status ,isPage
FROM LessonPart WHERE lessonPartId=#{lessonPartId}
</select>
<select id="getSeqLessonPart" resultType="Integer" useCache="false" flushCache="true">
SELECT nextval('seq_lessonPartId') ;
</select>
<insert id="insertLessonPartBatch" parameterType="java.util.List">
INSERT INTO LessonPart ( lessonPartId, lessonId, title, description, background, orderId, status ,isPage ) Values
<foreach collection="list" index="index" item="item" separator=",">
( #{item.lessonPartId}, #{item.lessonId}, #{item.title}, #{item.description}, #{item.background}, #{item.orderId}, #{item.status} ,#{item.isPage} )
</foreach>
</insert>
<select id="getLessonPartsByLessonId" parameterType="java.lang.Integer" resultType="LessonPart">
SELECT lessonPartId , lessonId , title , description , background , orderId , status ,isPage
FROM LessonPart
WHERE lessonId=#{lessonId} and status = 1
ORDER BY orderId
</select>
<delete id="deleteLessonPartByIds" parameterType="java.util.List">
delete from LessonPart where lessonPartId in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</delete>
</mapper>