<?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.ExCoursePhaseMapper">
|
<resultMap type="com.gkhy.exam.system.domain.ExCoursePhase" id="ExCoursePhaseResult">
|
<result property="id" column="id" />
|
<result property="name" column="name" />
|
<result property="code" column="code" />
|
<result property="companyId" column="company_id" />
|
<result property="courseId" column="course_id" />
|
<result property="level" column="level" />
|
<result property="delFlag" column="del_flag" />
|
<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" />
|
<result property="coursePeriod" column="course_period" />
|
</resultMap>
|
|
<sql id="selectCoursePhaseVo">
|
select a.id, a.name, a.code, a.company_id, a.course_id,a.level,a.del_flag,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,b.period as course_period
|
from ex_course_phase a
|
left join ex_course b on b.id=a.course_id
|
</sql>
|
|
<update id="deleteByPhaseId">
|
update ex_course_phase set del_flag=1 where id=#{phaseId}
|
</update>
|
|
<select id="selectCoursePhaseList" resultMap="ExCoursePhaseResult">
|
<include refid="selectCoursePhaseVo"/>
|
<where>
|
and a.del_flag=0
|
<if test="name != null and name != ''">
|
AND a.name like concat('%', #{name}, '%')
|
</if>
|
<if test="code != null and code != ''">
|
AND a.code like concat('%', #{code}, '%')
|
</if>
|
<if test="companyId != null and companyId != ''">
|
AND a.company_id =#{companyId}
|
</if>
|
<if test="courseId != null and courseId != ''">
|
AND a.course_id =#{courseId}
|
</if>
|
</where>
|
order by a.create_time desc
|
</select>
|
|
<select id="selectCoursePhaseById" resultMap="ExCoursePhaseResult">
|
<include refid="selectCoursePhaseVo"/>
|
where a.id=#{phaseId}
|
</select>
|
|
<select id="checkNameUnique" resultType="com.gkhy.exam.system.domain.ExCoursePhase">
|
select id,name from ex_course_phase where del_flag=0 and name=#{name} limit 1
|
</select>
|
|
<select id="selectCountByCourseId" resultType="java.lang.Integer">
|
select count(1) from ex_course_phase where del_flag=0 and courde_id=#{courseId}
|
</select>
|
|
</mapper>
|