<?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.qmth.jkserver.dao.ExamStageDao">

    <delete id="deleteByExamCode">
        delete t from jk_exam_stage t
        <where>
            <if test="examCode != null and examCode != ''">
                and t.exam_code = #{examCode}
            </if>
        </where>
    </delete>

    <select id="findByExamCode" resultType="com.qmth.jkserver.model.ExamStage">
        select * from jk_exam_stage t
        <where>
            <if test="examCode != null and examCode != ''">
                and t.exam_code = #{examCode}
            </if>
        </where>
    </select>

    <select id="findBatchIdAndBatchName" resultType="java.util.HashMap">
        SELECT t.batch_id as batchId,t.batch_name as batchName from jk_exam_stage t
        <where>
            <if test="examCode != null and examCode != ''">
                and t.exam_code = #{examCode}
            </if>
        </where>
        group by t.batch_id,t.batch_name,t.batch_start_time
        order by t.batch_start_time
    </select>

    <select id="findByExamCodeByMap" resultType="java.util.HashMap">
        SELECT t.batch_id as batchId,t.batch_name as batchName from jk_exam_stage t
        <where>
            <if test="examCode != null and examCode != ''">
                and t.exam_code = #{examCode}
            </if>
        </where>
        group by t.exam_code,t.batch_id,t.batch_name
        order by t.batch_id
    </select>
</mapper>
