<?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.collect.mapper.CollectCourseMapper">

    <resultMap type="com.zhongzheng.modules.collect.domain.CollectCourse" id="CollectCourseResult">
        <result property="collectCourseId" column="collect_course_id"/>
        <result property="courseId" column="course_id"/>
        <result property="userId" column="user_id"/>
        <result property="createTime" column="create_time"/>
        <result property="courseName" column="course_name"/>
        <result property="coverUrl" column="cover_url"/>
    </resultMap>

    <select id="selectList" parameterType="com.zhongzheng.modules.collect.domain.CollectCourse"  resultMap="CollectCourseResult">
        SELECT
        cc.*,
        c.course_name,
        c.cover_url
        FROM
        collect_course cc
        LEFT JOIN course c ON cc.course_id = c.course_id
        WHERE
        1 = 1
        <if test="userId != null and userId != ''">
            AND user_id = #{userId}
        </if>

    </select>
</mapper>
