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

    <resultMap type="com.zhongzheng.modules.course.domain.CourseChapterBusiness" id="CourseChapterBusinessResult">
        <result property="id" column="id"/>
        <result property="chapterId" column="chapter_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="CourseChapterBusinessResult">
        SELECT
            ccb.*,
            cet.education_name,
            cpt.project_name,
            cb.business_name
        FROM
            course_chapter_business ccb
                LEFT JOIN course_education_type cet ON ccb.education_type_id = cet.id
                LEFT JOIN course_project_type cpt ON ccb.project_id = cpt.id
                LEFT JOIN course_business cb ON ccb.business_id = cb.id
                LEFT JOIN course_subject cs ON ccb.subject_id = cs.id
        WHERE
            ccb.chapter_id =#{id}
    </select>


</mapper>
