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}
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}