<?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.CourseSectionBusinessMapper">

    <resultMap type="com.zhongzheng.modules.course.domain.CourseSectionBusiness" id="CourseSectionBusinessResult">
        <result property="id" column="id"/>
        <result property="sectionId" column="section_id"/>
        <result property="educationTypeId" column="education_type_id"/>
        <result property="businessId" column="business_id"/>
        <result property="subjectId" column="subject_id"/>
        <result property="projectId" column="project_id"/>

        <result property="educationName" column="education_name"/>
        <result property="projectName" column="project_name"/>
        <result property="businessName" column="business_name"/>
        <result property="subjectName" column="subject_name"/>
    </resultMap>

    <select id="getListById" parameterType="Long"  resultMap="CourseSectionBusinessResult">
        SELECT
            csb.*,
            cet.education_name,
            cpt.project_name,
            cb.business_name,
            cs.subject_name
        FROM
            course_section_business csb
                LEFT JOIN course_education_type cet ON csb.education_type_id = cet.id
                AND cet.`status` = 1
                LEFT JOIN course_project_type cpt ON csb.project_id = cpt.id
                AND cpt.`status` = 1
                LEFT JOIN course_business cb ON csb.business_id = cb.id
                AND cb.`status` = 1
                LEFT JOIN course_subject cs ON csb.subject_id = cs.id
                AND cs.`status` = 1
        WHERE
            csb.section_id =#{id}
    </select>
</mapper>
