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

    <select id="findByExamCodeAndPlaceCodeAndRoomCodeCount" resultType="java.lang.Long">
        select * from jk_exam_solfege_record jesr join jk_exam_student jes on jes.id = jesr.student_id
        <where>
            <if test="examCode != null and examCode != ''">
                and jesr.exam_code = #{examCode}
            </if>
            <if test="placeCode != null and placeCode != ''">
                and jes.place_code = #{placeCode}
            </if>
            <if test="roomCode != null and roomCode != ''">
                and jes.room_code = #{roomCode}
            </if>
            and jesr.attachment_id is not null
        </where>
    </select>

    <select id="findByStudentId" resultType="com.qmth.jkserver.model.ExamSolfegeRecord">
        select * from jk_exam_solfege_record jesr join jk_exam_student jes on jes.id = jesr.student_id
        <where>
            <if test="studentId != null and studentId != ''">
                and jesr.student_id = #{studentId}
            </if>
        </where>
    </select>

</mapper>
