<?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.system.mapper.ExCourseChapterMapper">
|
<resultMap type="com.gkhy.exam.system.domain.ExCourseChapter" id="ExChapterResult">
|
<result property="id" column="id" />
|
<result property="name" column="name" />
|
<result property="courseId" column="course_id" />
|
<result property="companyId" column="company_id" />
|
<result property="status" column="status" />
|
<result property="sort" column="sort" />
|
<result property="version" column="version" />
|
<result property="createBy" column="create_by" />
|
<result property="createTime" column="create_time" />
|
<result property="updateBy" column="update_by" />
|
<result property="updateTime" column="update_time" />
|
<result property="remark" column="remark" />
|
<collection property="chapterPeriods" ofType="com.gkhy.exam.system.domain.ExCourseChapterPeriod" select="getChapterPeriodById" column="{chapterId=id}"/>
|
</resultMap>
|
|
<sql id="selectChapterVo">
|
select a.id, a.name, a.course_id, a.status,a.company_id, a.sort,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
|
b.id as period_id,a.id as chapter_id,b.name as period_name,b.resource_id
|
from ex_course_chapter a
|
left join ex_course_chapter_period b on b.chapter_id=a.id
|
</sql>
|
|
<select id="selectChapterList" resultMap="ExChapterResult">
|
<include refid="selectChapterVo"/>
|
<where>
|
and a.course_id=#{courseId}
|
<if test="name != null and name != ''">
|
AND a.name like concat('%', #{name}, '%')
|
</if>
|
<if test="status != null ">
|
AND a.status =#{status}
|
</if>
|
</where>
|
order by a.sort asc,a.id desc
|
</select>
|
|
<select id="selectChapterById" resultMap="ExChapterResult">
|
<include refid="selectChapterVo"/>
|
where a.id=#{chapterId}
|
</select>
|
|
<select id="checkNameUnique" resultType="com.gkhy.exam.system.domain.ExCourseChapter">
|
select id,name,course_id from ex_course_chapter where name=#{name} and course_id=#{courseId} limit 1
|
</select>
|
|
|
<select id="selectChapterByCourseId" resultMap="ExChapterResult">
|
select * from ex_course_chapter where course_id=#{courseId}
|
order by sort asc,id desc
|
</select>
|
|
<select id="selectCountByCourseId" resultType="java.lang.Integer">
|
select count(1) from ex_course_chapter where course_id=#{courseId}
|
</select>
|
|
<select id="getChapterPeriodById" resultType="com.gkhy.exam.system.domain.ExCourseChapterPeriod">
|
select * from ex_course_chapter_period where chapter_id=#{chapterId}
|
</select>
|
|
<select id="selectPeriodCountById" resultType="java.lang.Integer">
|
select count(1) from ex_course_chapter_period where chapter_id=#{chapterId}
|
</select>
|
|
</mapper>
|