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

    <select id="joinDataByServiceIdGet" resultType="com.sundot.airport.exam.common.model.result.ExamAndTpResult">
        SELECT
        ex.`id`,
        ex.`ex_id`,
        ex.`ex_name`,
        ex.`ex_bg_img`,
        ex.`ex_detail_img`,
        ex.`ex_exam_time`,
        ex.`ex_exam_count`,
        ex.`ex_people`,
        ex.`ex_enable_ans`,
        ex.`ex_enable_cert`,
        ex.`ex_cert_th`,
        ex.`ex_cert_name`,
        ex.`pi_id`,
        ex.`ex_cert_bg_img`,
        ex.`ex_cert_qr_code`,
        ex.`ex_cert_share_remark`,
        ex.`tp_id`,
        ex.`del_status`,
        ex.`create_time`,
        ex.`create_uid`,
        ex.`update_time`,
        ex.`update_uid`,
        tp.`tp_name`,
        tp.`tp_ques_num`,
        tp.`tp_total_score`,
        tpc.`tpc_id`,
        tpc.`tpc_name`
        FROM `edu_cs_exam` ex
        LEFT JOIN `edu_cs_test_paper` tp ON ex.`tp_id` = tp.`tp_id`
        LEFT JOIN `edu_cs_test_paper_cat` tpc ON tp.`tpc_id` = tpc.`tpc_id`
        WHERE ex.`ex_id` = #{serviceId}
        LIMIT 1
    </select>

</mapper>
