123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608 |
- <?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.keao.edu.user.dao.ExamRegistrationDao">
- <resultMap type="com.keao.edu.user.entity.ExamRegistration" id="ExamRegistration">
- <id column="id_" property="id" />
- <result column="examination_basic_id_" property="examinationBasicId" />
- <result column="student_id_" property="studentId" />
- <result column="organ_id_" property="organId" />
- <result column="subject_id_" property="subjectId" />
- <result column="level_" property="level" />
- <result column="level_fee_" property="levelFee" />
- <result column="song_json_" property="songJson" />
- <result column="last_exam_level_" property="lastExamLevel" />
- <result column="last_exam_certificate_url_" property="lastExamCertificateUrl" />
- <result column="exam_music_theory_level_" property="examMusicTheoryLevel" />
- <result column="theory_level_fee_" property="theoryLevelFee" />
- <result column="last_music_theory_level_" property="lastMusicTheoryLevel" />
- <result column="last_music_theory_certificate_url_" property="lastMusicTheoryCertificateUrl" />
- <result column="adviser_name_" property="adviserName" />
- <result column="adviser_phone_" property="adviserPhone" />
- <result column="card_no_" property="cardNo" />
- <result column="status_" property="status" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler"/>
- <result column="create_time_" property="createTime" />
- <result column="update_time_" property="updateTime" />
- <result column="tenant_id_" property="tenantId" />
- <result column="memo_" property="memo" />
- <association property="sysUser" columnPrefix="sys_user_" resultMap="com.keao.edu.user.dao.StudentDao.Student"/>
- <association property="subject" columnPrefix="subject_" resultMap="com.keao.edu.user.dao.SubjectDao.Subject"/>
- <association property="examinationBasic" columnPrefix="examination_basic_" resultMap="com.keao.edu.user.dao.ExaminationBasicDao.ExaminationBasic"/>
- </resultMap>
- <resultMap id="ExamRegistrationRoomDto" type="com.keao.edu.user.dto.ExamRegistrationRoomDto" extends="ExamRegistration">
- <result column="exam_room_id_" property="examRoomId"/>
- <result column="exam_start_time_" property="examStartTime"/>
- <result column="exam_end_time_" property="examEndTime"/>
- </resultMap>
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="ExamRegistration" >
- SELECT * FROM exam_registration WHERE id_ = #{id}
- </select>
- <!-- 全查询 -->
- <select id="findAll" resultMap="ExamRegistration">
- SELECT * FROM exam_registration ORDER BY id_
- </select>
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.keao.edu.user.entity.ExamRegistration" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- 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})
- </insert>
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.keao.edu.user.entity.ExamRegistration">
- UPDATE exam_registration
- <set>
- <if test="examinationBasicId != null">
- examination_basic_id_ = #{examinationBasicId},
- </if>
- <if test="studentId != null">
- student_id_ = #{studentId},
- </if>
- <if test="organId != null">
- organ_id_ = #{organId},
- </if>
- <if test="subjectId != null">
- subject_id_ = #{subjectId},
- </if>
- <if test="level != null">
- level_ = #{level},
- </if>
- <if test="levelFee != null">
- level_fee_ = #{levelFee},
- </if>
- <if test="songJson != null">
- song_json_ = #{songJson},
- </if>
- <if test="lastExamLevel != null">
- last_exam_level_ = #{lastExamLevel},
- </if>
- <if test="lastExamCertificateUrl != null">
- last_exam_certificate_url_ = #{lastExamCertificateUrl},
- </if>
- <if test="examMusicTheoryLevel!= null">
- exam_music_theory_level_ = #{examMusicTheoryLevel},
- </if>
- <if test="theoryLevelFee!= null">
- theory_level_fee_ = #{theoryLevelFee},
- </if>
- <if test="lastMusicTheoryLevel != null">
- last_music_theory_level_ = #{lastMusicTheoryLevel},
- </if>
- <if test="lastMusicTheoryCertificateUrl != null">
- last_music_theory_certificate_url_ = #{lastMusicTheoryCertificateUrl},
- </if>
- <if test="adviserName != null">
- adviser_name_ = #{adviserName},
- </if>
- <if test="adviserPhone != null">
- adviser_phone_ = #{adviserPhone},
- </if>
- <if test="cardNo!=null">
- card_no_ =#{cardNo},
- </if>
- <if test="status!=null">
- status_ = #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="tenantId != null">
- tenant_id_ = #{tenantId},
- </if>
- <if test="createTime != null">
- create_time_ = #{createTime},
- </if>
- <if test="memo!=null">
- memo_ = #{memo},
- </if>
- update_time_ = NOW()
- </set>
- WHERE id_ = #{id}
- </update>
- <update id="batchUpdate" parameterType="com.keao.edu.user.entity.ExamRegistration">
- <foreach collection="regists" item="regist" separator=";">
- UPDATE exam_registration
- <set>
- <if test="regist.examinationBasicId != null">
- examination_basic_id_ = #{regist.examinationBasicId},
- </if>
- <if test="regist.studentId != null">
- student_id_ = #{regist.studentId},
- </if>
- <if test="regist.organId != null">
- organ_id_ = #{regist.organId},
- </if>
- <if test="regist.subjectId != null">
- subject_id_ = #{regist.subjectId},
- </if>
- <if test="regist.level != null">
- level_ = #{regist.level},
- </if>
- <if test="regist.levelFee != null">
- level_fee_ = #{regist.levelFee},
- </if>
- <if test="regist.songJson != null">
- song_json_ = #{regist.songJson},
- </if>
- <if test="regist.lastExamLevel != null">
- last_exam_level_ = #{regist.lastExamLevel},
- </if>
- <if test="regist.lastExamCertificateUrl != null">
- last_exam_certificate_url_ = #{regist.lastExamCertificateUrl},
- </if>
- <if test="regist.examMusicTheoryLevel!= null">
- exam_music_theory_level_ = #{regist.examMusicTheoryLevel},
- </if>
- <if test="regist.theoryLevelFee!= null">
- theory_level_fee_ = #{regist.theoryLevelFee},
- </if>
- <if test="regist.lastMusicTheoryLevel != null">
- last_music_theory_level_ = #{regist.lastMusicTheoryLevel},
- </if>
- <if test="regist.lastMusicTheoryCertificateUrl != null">
- last_music_theory_certificate_url_ = #{regist.lastMusicTheoryCertificateUrl},
- </if>
- <if test="regist.adviserName != null">
- adviser_name_ = #{regist.adviserName},
- </if>
- <if test="regist.adviserPhone != null">
- adviser_phone_ = #{regist.adviserPhone},
- </if>
- <if test="regist.cardNo!=null">
- card_no_ =#{regist.cardNo},
- </if>
- <if test="regist.status!=null">
- status_ = #{regist.status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="regist.tenantId != null">
- tenant_id_ = #{regist.tenantId},
- </if>
- <if test="regist.memo!=null">
- memo_ = #{regist.memo},
- </if>
- update_time_ = NOW()
- </set>
- WHERE id_ = #{regist.id}
- </foreach>
- </update>
- <!-- 根据主键删除一条记录 -->
- <delete id="delete" >
- DELETE FROM exam_registration WHERE id_ = #{id}
- </delete>
- <sql id="queryCondition">
- <where>
- er.status_ NOT IN ('CANCEL')
- <if test="organIds!=null">
- AND er.organ_id_ IN
- <foreach collection="organIds" item="organId" separator="," open="(" close=")">
- #{organId}
- </foreach>
- </if>
- <if test="studentId!=null">
- AND er.student_id_=#{studentId}
- </if>
- <if test="examId!=null">
- AND er.examination_basic_id_ = #{examId}
- </if>
- <if test="organId != null">
- AND er.organ_id_ = #{organId}
- </if>
- <if test="organizationId != null">
- AND er.organ_id_ = #{organizationId}
- </if>
- <if test="subjectId!=null">
- AND er.subject_id_ = #{subjectId}
- </if>
- <if test="level!=null">
- AND er.level_ = #{level}
- </if>
- <if test="status!=null">
- AND er.status_ = #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}
- </if>
- <if test="search!=null and search!=''">
- AND (er.student_id_=#{search} OR su.phone_ LIKE CONCAT('%', #{search}, '%') OR su.real_name_ LIKE CONCAT('%', #{search}, '%') OR eb.name_ LIKE CONCAT('%', #{search}, '%'))
- </if>
- </where>
- </sql>
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="ExamRegistration" parameterType="map">
- SELECT
- er.id_,
- er.examination_basic_id_,
- er.exam_music_theory_level_,
- er.card_no_,
- er.student_id_,
- er.memo_,
- su.real_name_ sys_user_real_name_,
- er.last_exam_certificate_url_,
- er.last_music_theory_certificate_url_,
- er.level_fee_,
- er.theory_level_fee_,
- er.organ_id_,
- er.subject_id_,
- er.level_,
- erp.trans_amount_,
- er.status_,
- er.create_time_
- FROM
- exam_registration er
- LEFT JOIN sys_user su ON er.student_id_ = su.id_
- LEFT JOIN exam_registration_payment erp ON er.id_ = erp.exam_registration_id_
- LEFT JOIN examination_basic eb ON er.examination_basic_id_ = eb.id_
- <include refid="queryCondition"/>
- ORDER BY er.id_
- <include refid="global.limit"/>
- </select>
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(*) FROM exam_registration er
- <include refid="queryCondition"/>
- </select>
- <sql id="queryExamRegistCondition">
- <where>
- <if test="organIds!=null">
- AND er.organ_id_ IN
- <foreach collection="organIds" item="organId" separator="," open="(" close=")">
- #{organId}
- </foreach>
- </if>
- <if test="examId!=null">
- AND er.examination_basic_id_ = #{examId}
- </if>
- <if test="organId!=null">
- AND er.organ_id_ = #{organId}
- </if>
- <if test="subjectId!=null">
- AND er.subject_id_ = #{subjectId}
- </if>
- <if test="level!=null">
- AND er.level_ = #{level}
- </if>
- <if test="status!=null">
- AND er.status_ = #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}
- </if>
- <if test="inRoom!=null and inRoom=0">
- AND ersr.exam_room_id_ IS NULL
- </if>
- <if test="inRoom!=null and inRoom=1">
- AND ersr.exam_room_id_ IS NOT NULL
- </if>
- </where>
- </sql>
- <select id="queryExamRegist" resultMap="ExamRegistrationRoomDto" parameterType="map">
- SELECT
- er.id_,
- er.examination_basic_id_,
- er.exam_music_theory_level_,
- er.card_no_,
- er.student_id_,
- er.memo_,
- su.real_name_ sys_user_real_name_,
- su.phone_ sys_user_phone_,
- er.last_exam_certificate_url_,
- er.last_music_theory_certificate_url_,
- er.level_fee_,
- er.theory_level_fee_,
- er.song_json_,
- er.organ_id_,
- er.subject_id_,
- er.level_,
- er.status_,
- er.create_time_,
- ersr.exam_room_id_,
- ero.exam_start_time_,
- ero.exam_end_time_
- FROM
- exam_registration er
- LEFT JOIN sys_user su ON er.student_id_ = su.id_
- LEFT JOIN exam_room_student_relation ersr ON ersr.exam_registration_id_ = er.id_
- LEFT JOIN exam_room ero ON ero.id_ = ersr.exam_room_id_
- LEFT JOIN examination_basic eb ON er.examination_basic_id_ = eb.id_
- <include refid="queryCondition"/>
- ORDER BY er.id_ DESC
- <include refid="global.limit"/>
- </select>
- <select id="countExamRegist" resultType="int">
- SELECT COUNT(*) FROM exam_registration er
- LEFT JOIN sys_user su ON er.student_id_ = su.id_
- LEFT JOIN exam_room_student_relation ersr ON ersr.exam_registration_id_ = er.id_
- LEFT JOIN examination_basic eb ON er.examination_basic_id_ = eb.id_
- <include refid="queryCondition"/>
- </select>
- <select id="countWithoutExamRoomStudentNum" resultType="int">
- SELECT
- COUNT(ersr.id_)
- FROM
- exam_registration er
- LEFT JOIN exam_room_student_relation ersr ON ersr.student_id_ = er.student_id_
- WHERE 1=1
- <if test="organIds!=null">
- AND er.organ_id_ IN
- <foreach collection="organIds" item="organI" separator="," open="(" close=")">
- #{organI}
- </foreach>
- </if>
- AND er.examination_basic_id_ = #{examId}
- AND ersr.id_ IS NULL
- </select>
- <select id="countInExamRoomStudentNum" resultType="int">
- SELECT
- COUNT(ersr.id_)
- FROM
- exam_room_student_relation ersr
- LEFT JOIN exam_registration er ON ersr.exam_registration_id_ = er.id_
- WHERE 1=1
- <if test="organIds!=null">
- AND er.organ_id_ IN
- <foreach collection="organIds" item="organI" separator="," open="(" close=")">
- #{organI}
- </foreach>
- </if>
- AND ersr.examination_basic_id_ = #{examId}
- </select>
- <resultMap id="ExamRegistrationStatisticsDto" type="com.keao.edu.user.dto.ExamRegistrationStatisticsDto">
- <result property="totalRegistrationStudentNum" column="totalRegistrationStudentNum"/>
- <result property="childOrganRegistrationStudentNum" column="childOrganRegistrationStudentNum"/>
- <result property="waitAuditStudentNum" column="waitAuditStudentNum"/>
- <result property="refundedStudentNum" column="refundedStudentNum"/>
- </resultMap>
- <select id="getExamRegistrationStaticsInfo" resultMap="ExamRegistrationStatisticsDto">
- SELECT
- COUNT( er.student_id_ ) totalRegistrationStudentNum,
- SUM( CASE WHEN er.organ_id_ != #{selfOrganId} THEN 1 ELSE 0 END ) childOrganRegistrationStudentNum,
- SUM( CASE WHEN er.status_ = 'AUDIT_WAIT' THEN 1 ELSE 0 END ) waitAuditStudentNum,
- SUM( CASE WHEN er.status_ = 'REFUNDED' THEN 1 ELSE 0 END ) refundedStudentNum
- FROM
- exam_registration er
- WHERE
- er.status_ NOT IN ('CANCEL', 'PAY_WAIT')
- AND er.examination_basic_id_ = #{examId}
- <if test="organIds!=null">
- AND er.organ_id_ IN
- <foreach collection="organIds" item="organId" separator="," open="(" close=")">
- #{organId}
- </foreach>
- </if>
- </select>
- <select id="countTotalRegistrationStudentNumWithExam" resultType="int">
- SELECT
- COUNT(er.id_)
- FROM
- exam_registration er
- WHERE 1=1
- AND er.status_ IN ('AUDIT_PASS', 'AUDIT_WAIT')
- <if test="organIds!=null">
- AND er.organ_id_ IN
- <foreach collection="organIds" item="organI" separator="," open="(" close=")">
- #{organI}
- </foreach>
- </if>
- AND er.examination_basic_id_ = #{examId}
- AND er.status_ != ''
- </select>
- <select id="getWithExamAndStudents" resultMap="ExamRegistration">
- SELECT * FROM exam_registration WHERE examination_basic_id_=#{examId} AND student_id_ IN
- <foreach collection="studentIds" item="studentId" separator="," open="(" close=")">
- #{studentId}
- </foreach>
- </select>
- <select id="getRegists" resultMap="ExamRegistration">
- SELECT * FROM exam_registration WHERE id_ IN
- <foreach collection="registIds" item="registId" separator="," open="(" close=")">
- #{registId}
- </foreach>
- </select>
- <resultMap id="ExamRegistrationDtoMap" type="com.keao.edu.user.dto.ExamRegistrationDto">
- <result column="examination_basic_id_" property="examinationBasicId" />
- <result column="id_" property="id" />
- <result column="subject_id_" property="subjectId" />
- <result column="level_" property="level" />
- <result column="level_fee_" property="levelFee" />
- <result column="song_json_" property="songJson" />
- <result column="last_exam_level_" property="lastExamLevel" />
- <result column="last_exam_certificate_url_" property="lastExamCertificateUrl" />
- <result column="exam_music_theory_level_" property="examMusicTheoryLevel" />
- <result column="theory_level_fee_" property="theoryLevelFee" />
- <result column="last_music_theory_level_" property="lastMusicTheoryLevel" />
- <result column="last_music_theory_certificate_url_" property="lastMusicTheoryCertificateUrl" />
- <result column="card_no_" property="cardNo" />
- <result column="status_" property="status" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler"/>
- <result column="memo_" property="memo" />
- <result property="studentName" column="studentName"/>
- <result property="subjectName" column="subjectName"/>
- <result property="examBaseName" column="examBaseName"/>
- <result property="examStartTime" column="expect_exam_start_time_"/>
- <result property="examEndTime" column="expect_exam_end_time_"/>
- <result property="enrollEndTime" column="enroll_end_time_"/>
- <result property="enrollStartTime" column="enroll_start_time_"/>
- <result property="performSongIdList" column="perform_song_id_list_"/>
- <result property="practiceSongIdList" column="practice_song_id_list_"/>
- </resultMap>
- <select id="countStudentList" resultType="java.lang.Integer">
- SELECT COUNT(er.id_) FROM exam_registration er
- <include refid="queryStudentListSql"/>
- </select>
- <sql id="queryStudentListSql">
- <where>
- <if test="studentId != null">
- AND er.student_id_ = #{studentId}
- </if>
- <if test="examRegistrationId != null">
- AND er.id_ = #{examRegistrationId}
- </if>
- <if test="paymentStatus != null and paymentStatus == 1">
- <if test="paymentStatus == 1">
- AND er.status_ IN ('AUDIT_PASS','AUDIT_WAIT','AUDIT_REJECT')
- </if>
- <if test="paymentStatus == 0">
- AND er.status_ IN ('CANCEL','PAY_WAIT')
- </if>
- </if>
- </where>
- </sql>
- <select id="queryStudentList" resultMap="ExamRegistrationDtoMap">
- SELECT er.*,eb.enroll_end_time_,eb.enroll_start_time_,eb.expect_exam_end_time_,
- eb.expect_exam_start_time_,eb.name_ examBaseName,ess.practice_song_id_list_,ess.perform_song_id_list_
- FROM exam_registration er
- LEFT JOIN examination_basic eb ON er.examination_basic_id_ = eb.id_
- LEFT JOIN exam_subject_song ess ON er.examination_basic_id_ = ess.examination_basic_id_
- <include refid="queryStudentListSql"/>
- ORDER BY er.update_time_ DESC
- <include refid="global.limit"/>
- </select>
- <resultMap id="ExamRecordDtoMap" type="com.keao.edu.user.dto.StudentExamListDto">
- <result property="level" column="level_"/>
- <result property="examRegistrationId" column="exam_registration_id_"/>
- <result property="examBaseName" column="exam_base_name_"/>
- <result property="actualExamEndTime" column="actual_exam_end_time_"/>
- <result property="actualExamStartTime" column="actual_exam_start_time_"/>
- <result property="avgScore" column="avg_score_"/>
- <result property="examAddress" column="exam_address_"/>
- <result property="examCertificationId" column="exam_certification_id_"/>
- <result property="examinationBasicId" column="examination_basic_id_"/>
- <result property="examMusicTheoryLevel" column="exam_music_theory_level_"/>
- <result property="isFinishedExam" column="is_finished_exam_"/>
- <result property="result" column="result_"/>
- <result property="theoryLevelFee" column="theory_level_fee_"/>
- <result property="videoUrl" column="video_url_"/>
- <result property="subjectId" column="subject_id_"/>
- <result property="cardNo" column="card_no_"/>
- </resultMap>
- <select id="queryExamList" resultMap="ExamRecordDtoMap">
- SELECT er.level_,ser.exam_registration_id_,eb.name_ exam_base_name_,eb.actual_exam_start_time_,
- eb.actual_exam_end_time_,ser.avg_score_,ec.exam_address_,ec.id_ exam_certification_id_,
- er.examination_basic_id_,er.exam_music_theory_level_,ser.is_finished_exam_,er.theory_level_fee_,
- ser.video_url_,ser.result_,er.subject_id_,ec.card_no_
- FROM exam_registration er
- LEFT JOIN student_exam_result ser ON ser.exam_registration_id_ = er.id_
- LEFT JOIN examination_basic eb ON eb.id_ = er.examination_basic_id_
- LEFT JOIN exam_certification ec ON ec.exam_registration_id_ = er.id_
- WHERE ser.id_ IS NOT NULL AND er.student_id_ = #{studentId}
- </select>
- <select id="countExamList" resultType="java.lang.Integer">
- SELECT COUNT(er.id_) FROM exam_registration er
- LEFT JOIN student_exam_result ser ON er.id_ = ser.exam_registration_id_
- WHERE ser.id_ IS NOT NULL AND er.student_id_ = #{studentId}
- </select>
- <!-- 获取报名信息 -->
- <select id="getExamRegistration" resultMap="ExamRegistrationDtoMap">
- SELECT er.*,s.name_ subjectName,su.real_name_ studentName,eb.expect_exam_start_time_,eb.expect_exam_end_time_ FROM exam_registration er
- LEFT JOIN sys_user su ON su.id_ = er.student_id_
- LEFT JOIN examination_basic eb ON er.examination_basic_id_ = eb.id_
- LEFT JOIN subject s on er.subject_id_ = s.id_
- WHERE er.id_ = #{examRegistrationId}
- </select>
- <select id="getExamRegistrationInfo" resultMap="ExamRegistration">
- SELECT er.*, su.id_ sys_user_id_, su.real_name_ sys_user_real_name_,su.phone_ sys_user_phone_ , s.id_ subject_id_,
- s.name_ subject_name_ ,eb.name_ examination_basic_name_
- FROM exam_registration er
- LEFT JOIN examination_basic eb ON eb.id_=er.examination_basic_id_
- LEFT JOIN sys_user su ON er.student_id_ = su.id_
- LEFT JOIN subject s on er.subject_id_ = s.id_
- WHERE er.id_ = #{id}
- </select>
- <select id="getRegistration" resultMap="ExamRegistration">
- SELECT * FROM exam_registration
- <where>
- <if test="examId != null">
- AND examination_basic_id_ = #{examId}
- </if>
- <if test="studentId != null">
- AND student_id_ =#{studentId}
- </if>
- <if test="subjectId != null">
- AND subject_id_=#{subjectId}
- </if>
- <if test="level != null">
- AND level_ = #{level}
- </if>
- <if test="statusEnumList != null">
- AND status_ IN
- <foreach collection="statusEnumList" item="status" open="(" close=")" separator=",">
- #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}
- </foreach>
- </if>
- </where>
- LIMIT 1
- </select>
- <select id="queryStudentTenantId" resultType="java.lang.Integer">
- SELECT DISTINCT tenant_id_ FROM exam_registration
- WHERE student_id_ = #{userId} AND tenant_id_ IS NOT NULL
- </select>
- <select id="countStudentBaseExams" resultType="java.lang.Integer">
- SELECT COUNT(er.id_) FROM exam_registration er
- <include refid="queryStudentListSql"/>
- </select>
- <resultMap id="StudentBaseExamsDtoMap" type="com.keao.edu.user.dto.StudentBaseExamsDto">
- <result property="baseExamName" column="examBaseName"/>
- <result property="tenantId" column="tenant_id_"/>
- </resultMap>
- <select id="queryStudentBaseExams" resultMap="StudentBaseExamsDtoMap">
- SELECT eb.name_ examBaseName,eb.tenant_id_ FROM examination_basic eb
- LEFT JOIN exam_registration er ON er.examination_basic_id_ = eb.id_
- <include refid="queryStudentListSql"/>
- ORDER BY er.update_time_ DESC
- <include refid="global.limit"/>
- </select>
- <resultMap id="StuRecordDetailDtoMap" type="com.keao.edu.user.dto.StuRecordDetailDto">
- <result property="songJson" column="song_json_"/>
- <result property="recordStartTime" column="record_start_time_"/>
- </resultMap>
- <select id="getStuRecordDetail" resultMap="StuRecordDetailDtoMap">
- SELECT er.song_json_,ser.record_start_time_
- FROM exam_registration er
- LEFT JOIN student_exam_result ser ON ser.exam_registration_id_ = er.id_
- WHERE er.id_ = #{examRegistrationId} LIMIT 1
- </select>
- </mapper>
|