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

    <resultMap type="com.zhongzheng.modules.collect.domain.CollectQuestion" id="CollectQuestionResult">
        <result property="collectQuestionId" column="collect_question_id"/>
        <result property="questionId" column="question_id"/>
        <result property="userId" column="user_id"/>
        <result property="createTime" column="create_time"/>
        <result property="bankId" column="bank_id"/>
    </resultMap>

    <select id="selectList" parameterType="com.zhongzheng.modules.collect.domain.CollectQuestion"  resultType="com.zhongzheng.modules.bank.domain.Question">
        SELECT
        q.*
        FROM
        collect_question cq
        LEFT JOIN question q ON cq.question_id = q.question_id
        WHERE
        1 = 1
        <if test="userId != null and userId != ''">
            AND user_id = #{userId}
        </if>
        <if test="bankId != null and bankId != ''">
            AND bank_id = #{bankId}
        </if>

    </select>

</mapper>
