<?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.xunwang.education.mapper.MyFavoriteCoursesMapper">

    <resultMap id="favoriteCourseVoMap" type="FavoriteCourseVo">
        <id property="id" column="id"></id>
        <result property="uid" column="mid"></result>
        <result property="courseId" column="mcourse_id"></result>
        <result property="teacherCourses.courseId" column="course_id"></result>
        <result property="teacherCourses.uid" column="uid"></result>
        <result property="teacherCourses.teacherType" column="teacher_type"></result>
        <result property="teacherCourses.introduce" column="introduce"></result>
        <result property="teacherCourses.teachAge" column="teach_age"></result>
        <result property="teacherCourses.teachTime" column="teach_time"></result>
        <result property="teacherCourses.subject" column="subject"></result>
        <result property="teacherCourses.location" column="location"></result>
        <result property="teacherCourses.mode" column="mode"></result>
        <result property="teacherCourses.experience" column="experience"></result>
        <result property="teacherCourses.viewedCount" column="viewed_count"></result>
        <result property="teacherCourses.datetime" column="datetime"></result>
        <result property="teacherCourses.verifyStatus" column="verify_status"></result>
        <result property="teacherCourses.verifyRefuseReason" column="verify_refuse_reason"></result>
        <result property="teacherCourses.display" column="display"></result>
        <result property="teacherCourses.locked" column="locked"></result>
        <result property="teacherCourses.deal" column="deal"></result>
        <result property="teacherCourses.deleted" column="deleted"></result>
        <result property="teacherName" column="name"></result>
        <result property="education" column="education"></result>
        <result property="school" column="school"></result>
        <result property="sex" column="sex"></result>
        <result property="identify" column="identify"></result>
    </resultMap>

    <resultMap id="favoriteCourseVoMap1" type="FavoriteCourseVo">
        <id property="id" column="id"></id>
        <result property="uid" column="mid"></result>
        <result property="courseId" column="mcourse_id"></result>
        <association property="teacherCourses" javaType="TeacherCourses">

        </association>
    </resultMap>
    <select id="FavoriteCourseVo" resultMap="favoriteCourseVoMap">
        select mfc.id,mfc.uid as mid,mfc.course_id as mcourse_id,
               tc.course_id ,tc.uid,tc.introduce,tc.teach_age,tc.teach_time,tc.`subject`,tc.location,
               tc.experience,tc.viewed_count,tc.datetime,tc.verify_refuse_reason,tc.`mode`,
               tc.verify_status,tc.teacher_type,tc.display,tc.locked,tc.deal,tc.deleted,
               tcf.`name`,tcf.education,tcf.school,tcf.sex,tcf.identify
        from my_favorite_courses mfc
            left join teacher_courses tc on mfc.course_id = tc.course_id
            left join teacher_certifications tcf on tc.uid = tcf.uid
        where mfc.uid = #{id}
    </select>

</mapper>
