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}, subject_id_ = #{subjectId}, adviser_phone_ = #{adviserPhone}, last_exam_level_ = #{lastExamLevel}, tenant_id_ = #{tenantId}, level_ = #{level}, organ_id_ = #{organId}, song_json_ = #{songJson}, adviser_name_ = #{adviserName}, student_id_ = #{studentId}, last_exam_certificate_url_ = #{lastExamCertificateUrl}, card_no_ =#{cardNo}, status_ = #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}, memo_ = #{memo}, update_time_ = NOW() WHERE id_ = #{id} DELETE FROM exam_registration WHERE id_ = #{id} 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 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 er.student_id_ = #{studentId} er.id_ = #{examRegistrationId} er.tenant_id_ = #{tenantId} er.status_ = #{status}