<?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.sundot.airport.exam.mapper.TestPaperQuesMapper">

    <select id="byTpIdFindAndQuesList" resultType="com.sundot.airport.exam.common.model.result.TestPaperQuesAndQues">
        SELECT
        tpq.`id`,
        tpq.`tpq_id`,
        tpq.`tpq_total_score`,
        tpq.`tpq_comp_type`,
        tpq.`tpq_left_score`,
        tpq.`tpq_right_score`,
        tpq.`tp_id`,
        tpq.`qu_id`,
        tpq.`sort`,
        tpq.`del_status`,
        tpq.`create_time`,
        tpq.`create_uid`,
        tpq.`update_time`,
        tpq.`update_uid`,
        qu.qu_type,
        qu.qu_content,
        qu.qc_id,
        qu.qu_opt_count,
        qc.qc_name
        FROM `edu_cs_test_paper_ques` tpq
        JOIN `edu_cs_ques` qu ON qu.qu_id = tpq.qu_id AND qu.`del_status` = 0
        LEFT JOIN `edu_cs_ques_cat` qc ON qc.qc_id = qu.qc_id
        <where>
            AND tpq.`del_status` = 0
            AND tpq.`tp_id` IN
            <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
                #{id}
            </foreach>
        </where>
        ORDER BY tpq.`sort` ASC, tpq.`id` ASC
    </select>
</mapper>
