<?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.inform.mapper.InformRemindBusinessMapper">

    <resultMap type="com.zhongzheng.modules.inform.domain.InformRemindBusiness" id="InformRemindBusinessResult">
        <result property="id" column="id"/>
        <result property="businessId" column="business_id"/>
        <result property="remindId" column="remind_id"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>

    <resultMap type="com.zhongzheng.modules.inform.vo.InformRemindBusinessVo" id="InformRemindBusinessVo">
        <result property="id" column="id"/>
        <result property="businessId" column="business_id"/>
        <result property="remindId" column="remind_id"/>
        <result property="businessName" column="business_name"/>
        <result property="educationId" column="education_id"/>
        <result property="educationName" column="education_name"/>
        <result property="projectName" column="project_name"/>
        <result property="projectId" column="project_id"/>
    </resultMap>

    <select id="selectBusiness" parameterType="long"  resultMap="InformRemindBusinessVo">
        SELECT
            p.*,
            b.business_name,
            t.project_name,
            t.id as project_id,
            e.id as education_id,
            e.education_name
        FROM
            inform_remind_business p
                LEFT JOIN course_business b on b.id =p.business_id
                LEFT JOIN course_project_type t on b.project_id=t.id
                LEFT JOIN course_education_type e on t.education_id = e.id
        WHERE
            1 =1
        and b.status = 1
        <if test="id != null and id!=0 ">
            AND p.remind_id = #{id}
        </if>
    </select>
</mapper>
