<?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.zhongzheng.modules.course.mapper.CourseProjectTypeMapper">

    <resultMap type="com.zhongzheng.modules.course.domain.CourseProjectType" id="CourseProjectTypeResult">
        <result property="id" column="id"/>
        <result property="projectName" column="project_name"/>
        <result property="encoder" column="encoder"/>
        <result property="remark" column="remark"/>
        <result property="educationId" column="education_id"/>
        <result property="status" column="status"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>

    <resultMap type="com.zhongzheng.modules.course.vo.CourseProjectTypeVo" id="CourseProjectTypeVoResult">
        <result property="id" column="id"/>
        <result property="projectName" column="project_name"/>
        <result property="encoder" column="encoder"/>
        <result property="remark" column="remark"/>
        <result property="educationId" column="education_id"/>
        <result property="educationName" column="education_name"/>
        <result property="status" column="status"/>
    </resultMap>

    <select id="queryList" parameterType="com.zhongzheng.modules.course.bo.CourseProjectTypeQueryBo"  resultMap="CourseProjectTypeVoResult">
        SELECT
            p.*,
            e.education_name
        FROM
            course_project_type p
                LEFT JOIN course_education_type e ON p.education_id = e.id
        where 1=1
        <if test="status != null and status.size()!=0 ">
            AND p.status in
            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="projectName != null and projectName != ''">
            AND p.project_name = #{projectName}
        </if>
        <if test="encoder != null and encoder != ''">
            AND p.encoder = #{encoder}
        </if>
        <if test="educationId != null and educationId != ''">
            AND p.education_id = #{educationId}
        </if>
        <if test="id != null and id != ''">
            AND p.id = #{id}
        </if>
    </select>
</mapper>
