89 lines
2.4 KiB
XML
Raw Permalink Normal View History

2026-03-10 14:30:24 +08:00
<?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="CsLesson">
<sql id="baseSql">
cs_lessonid as csLessonId,unitid,title,description,status,orderId,subTitle
</sql>
<select id="getCslessonId" resultType="Integer" useCache="false" flushCache="true">
SELECT nextval('seq_cs_lessonid')
</select>
<!--批量删除课程-->
<update id="BatchUpdateByCslessonIds" parameterType="java.util.List">
<foreach collection="list" index="index" item="item" separator=";" >
update cs_lesson set status= 0 where cs_lessonid = #{item.csLessonId}
</foreach>
</update>
<!--批量删除课程-->
<update id="BatchUpdateCsLesssonByUnitId" parameterType="java.util.List">
UPDATE cs_lesson SET status = 0
WHERE unitid in
<foreach collection="list" index="index" item="item" separator="," close=")" open="(">
#{item.unitId}
</foreach>
</update>
<select id="getCsLessonForSearch" parameterType="CsLessonVO" resultType="CsLessonDTO">
SELECT <include refid="baseSql"/>
FROM cs_lesson
<where>
<if test="title != null and title != ''">
and title like '%${title}%'
</if>
<if test="status != null ">
and status = #{status}
</if>
<if test="unitId != null ">
and unitId = #{unitId}
</if>
</where>
ORDER BY orderId, cs_lessonid
<if test="pageSize != null and offset != null ">
LIMIT #{pageSize} OFFSET #{offset}
</if>
</select>
<select id="getCsLessonCountForSearch" parameterType="CsLessonVO" resultType="Integer">
SELECT count(*)
FROM cs_lesson
<where>
<if test="title != null and title != ''">
and title like '%${title}%'
</if>
<if test="status != null ">
and status = #{status}
</if>
<if test="unitId != null ">
and unitId = #{unitId}
</if>
</where>
</select>
<select id="getCslessonIdByUnitId" parameterType="java.lang.Integer" resultType="java.util.List">
select cs_lessonId as csLessonId from cs_lesson where unitid = #{unitId} and status= 1
</select>
</mapper>