lanan-system/dl-module-knowledge/src/main/resources/mapper/TCourseMapper.xml
愉快的大福 58f3d3d4a3 知识模块
2024-08-12 21:27:02 +08:00

62 lines
2.5 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="cn.iocoder.yudao.module.knowledge.mapper.TCourseMapper">
<resultMap type="cn.iocoder.yudao.module.knowledge.entity.TCourse" id="tCourseMap">
<result property="id" column="id"/>
<result property="courseDirectoryId" column="course_directory_id"/>
<result property="name" column="name"/>
<result property="desrc" column="desrc"/>
</resultMap>
<update id="updateDirectoryNameByDirectoryId">
update t_course
set course_directory_name = #{directoryName}
where course_directory_id = #{directoryId}
and deleted = 0
</update>
<select id="queryIdsByDirectoryId" resultType="java.lang.Long">
select id
from t_course
where course_directory_id = #{directoryId}
and deleted = 0
</select>
<select id="queryPage" resultType="cn.iocoder.yudao.module.knowledge.entity.TCourse">
select *
from t_course
<where>
deleted = 0
<if test="tcourseRequest.name != null and tcourseRequest.name != ''">
and name like concat('%', #{tcourseRequest.name}, '%')
</if>
<if test="tcourseRequest.courseDirectoryName != null and tcourseRequest.courseDirectoryName != ''">
and course_directory_name = #{tcourseRequest.courseDirectoryName}
</if>
<if test="tcourseRequest.courseDirectoryIdList != null and tcourseRequest.courseDirectoryIdList.size > 0">
and course_directory_id in
<foreach collection="tcourseRequest.courseDirectoryIdList" item="item" index="index"
open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
order by create_time desc
</select>
<select id="queryByName" resultType="cn.iocoder.yudao.module.knowledge.entity.TCourse">
select *
from t_course
where name = #{name}
and deleted = 0
</select>
<select id="queryIdsByDirectoryIds" resultType="java.lang.Long">
select id from t_course
where course_directory_id in
<foreach collection="directoryIds" item="item" index="index"
open="(" close=")" separator=",">
#{item}
</foreach>
and deleted = 0
</select>
</mapper>