INSERT INTO exam_registration (examination_basic_id_, student_id_, organ_id_,subject_id_, level_, level_fee_, song_json_, last_exam_level_, last_exam_certificate_url_,exam_music_theory_level_, theory_level_fee_, last_music_theory_level_,last_music_theory_certificate_url_, adviser_name_,adviser_phone_, card_no_, status_, create_time_, update_time_, tenant_id_,memo_) VALUES (#{examinationBasicId}, #{studentId}, #{organId}, #{subjectId}, #{level}, #{levelFee}, #{songJson}, #{lastExamLevel}, #{lastExamCertificateUrl}, #{examMusicTheoryLevel}, #{theoryLevelFee}, #{lastMusicTheoryLevel}, #{lastMusicTheoryCertificateUrl}, #{adviserName}, #{adviserPhone}, #{cardNo}, #{status},#{createTime}, #{updateTime}, #{tenantId}, #{memo}) UPDATE exam_registration examination_basic_id_ = #{examinationBasicId}, student_id_ = #{studentId}, organ_id_ = #{organId}, subject_id_ = #{subjectId}, level_ = #{level}, level_fee_ = #{levelFee}, song_json_ = #{songJson}, last_exam_level_ = #{lastExamLevel}, last_exam_certificate_url_ = #{lastExamCertificateUrl}, exam_music_theory_level_ = #{examMusicTheoryLevel}, theory_level_fee_ = #{theoryLevelFee}, last_music_theory_level_ = #{lastMusicTheoryLevel}, last_music_theory_certificate_url_ = #{lastMusicTheoryCertificateUrl}, adviser_name_ = #{adviserName}, adviser_phone_ = #{adviserPhone}, card_no_ =#{cardNo}, status_ = #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}, tenant_id_ = #{tenantId}, create_time_ = #{createTime}, memo_ = #{memo}, update_time_ = NOW() WHERE id_ = #{id} UPDATE exam_registration examination_basic_id_ = #{regist.examinationBasicId}, student_id_ = #{regist.studentId}, organ_id_ = #{regist.organId}, subject_id_ = #{regist.subjectId}, level_ = #{regist.level}, level_fee_ = #{regist.levelFee}, song_json_ = #{regist.songJson}, last_exam_level_ = #{regist.lastExamLevel}, last_exam_certificate_url_ = #{regist.lastExamCertificateUrl}, exam_music_theory_level_ = #{regist.examMusicTheoryLevel}, theory_level_fee_ = #{regist.theoryLevelFee}, last_music_theory_level_ = #{regist.lastMusicTheoryLevel}, last_music_theory_certificate_url_ = #{regist.lastMusicTheoryCertificateUrl}, adviser_name_ = #{regist.adviserName}, adviser_phone_ = #{regist.adviserPhone}, card_no_ =#{regist.cardNo}, status_ = #{regist.status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}, tenant_id_ = #{regist.tenantId}, memo_ = #{regist.memo}, update_time_ = NOW() WHERE id_ = #{regist.id} DELETE FROM exam_registration WHERE id_ = #{id} er.status_ NOT IN ('CANCEL') AND er.organ_id_ IN #{organId} AND er.student_id_=#{studentId} AND er.examination_basic_id_ = #{examId} AND er.organ_id_ = #{organId} AND er.organ_id_ = #{organizationId} AND er.subject_id_ = #{subjectId} AND er.level_ = #{level} AND er.status_ = #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler} AND (er.student_id_=#{search} OR su.phone_ LIKE CONCAT('%', #{search}, '%') OR su.real_name_ LIKE CONCAT('%', #{search}, '%') OR eb.name_ LIKE CONCAT('%', #{search}, '%')) AND er.organ_id_ IN #{organId} AND er.examination_basic_id_ = #{examId} AND er.organ_id_ = #{organId} AND er.subject_id_ = #{subjectId} AND er.level_ = #{level} AND er.status_ = #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler} AND ersr.exam_room_id_ IS NULL AND ersr.exam_room_id_ IS NOT NULL AND er.student_id_ = #{studentId} AND er.id_ = #{examRegistrationId} AND er.status_ IN ('AUDIT_PASS','AUDIT_WAIT','AUDIT_REJECT') AND er.status_ IN ('CANCEL','PAY_WAIT')