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

    <resultMap type="com.zhongzheng.modules.collect.domain.CollectNote" id="CollectNoteResult">
        <result property="collectNoteId" column="collect_note_id"/>
        <result property="fileId" column="file_id"/>
        <result property="userId" column="user_id"/>
        <result property="createTime" column="create_time"/>
        <result property="name" column="name"/>
        <result property="coverUrl" column="cover_url"/>
    </resultMap>

    <select id="selectList" parameterType="com.zhongzheng.modules.collect.domain.CollectNote"  resultMap="CollectNoteResult">
        SELECT
        cn.*,
        en.`name`,
        en.cover_url
        FROM
        collect_note cn
        LEFT JOIN exam_note en ON cn.file_id = en.file_id
        WHERE
        1 = 1
        <if test="userId != null and userId != ''">
            AND user_id = #{userId}
        </if>

    </select>
</mapper>
