智慧保安后台管理-外网项目备份
钟日健
2026-06-01 62eb499b0c969f246d3245d1429a97da4de1ce28
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.xml
@@ -79,10 +79,9 @@
    </select>
    <select id="queryRandomSubject" resultMap="RandomResult" >
        SELECT * FROM ( SELECT * FROM exam_subject_choices WHERE choices_type = 0 ORDER BY RAND( ) LIMIT 25 ) a UNION ALL
        SELECT * FROM ( SELECT * FROM exam_subject_choices WHERE choices_type = 0 ORDER BY RAND( ) LIMIT 70) a UNION ALL
        SELECT * FROM ( SELECT * FROM exam_subject_choices WHERE choices_type = 1 ORDER BY RAND( ) LIMIT 10 ) b UNION ALL
        SELECT * FROM ( SELECT * FROM exam_subject_choices WHERE choices_type = 2 ORDER BY RAND( ) LIMIT 20 ) c UNION ALL
        SELECT * FROM ( SELECT * FROM exam_subject_choices WHERE choices_type = 3 ORDER BY RAND( ) LIMIT 5 ) d
        SELECT * FROM ( SELECT * FROM exam_subject_choices WHERE choices_type = 2 ORDER BY RAND( ) LIMIT 20 ) c
    </select>
    <select id="selectExamPaperPages" resultType="org.springblade.modules.exam.vo.ExamPaperVO">
@@ -101,9 +100,29 @@
    <select id="selectExamPaperPage" resultType="org.springblade.modules.exam.vo.ExamPaperVO">
        SELECT
            *
            ke.*,
            bu.real_name realName,
            bd.dept_name deptName,
            bu1.real_name confirmUserName,
            bu2.real_name auditUserName
        FROM
            ksxt_exam
            ksxt_exam ke
        left join
            blade_user bu
        on
            ke.creator = bu.id
        left join
            blade_dept bd
        on
            bd.id = bu.dept_id
        left join
            blade_user bu1
        on
            ke.confirm_user = bu1.id
        left join
            blade_user bu2
        on
            ke.audit_user = bu2.id
        where
        1=1
        <if test="paper.examType!=null and paper.examType!=''">
@@ -112,10 +131,19 @@
        <if test="paper.examName!=null and paper.examName!=''">
            and exam_name like concat('%',#{paper.examName},'%')
        </if>
        <if test="paper.deptId!=null and paper.deptId!=''">
            and bd.id = #{paper.deptId}
        </if>
        <if test="paper.deptName!=null and paper.deptName!=''">
            and bd.dept_name like concat('%',#{paper.deptName},'%')
        </if>
        <if test="paper.examTime!=null and paper.examTime!=''">
            and date_format(ke.start_time,'%Y-%m-%d') = #{paper.examTime}
        </if>
        <if test="paper.auditStatus!=null and paper.auditStatus!=''">
            and audit_status = #{paper.auditStatus}
        </if>
        order by start_time desc
        order by ke.start_time desc,ke.id desc
    </select>
    <select id="PagerSubject" resultMap="PagerSubjectAnswer">
@@ -152,65 +180,83 @@
    </delete>
    <!--查询考试人员考试信息-->
<!--    <select id="getExamDetail" resultType="org.springblade.modules.exam.vo.ExamPaperVO">-->
<!--        (select-->
<!--            ke.id,ke.exam_name examName,ke.start_time startTime,ke.end_time endTime,ke.exam_type examType,-->
<!--            sa.candidate_no candidateNo,sa.id applyId,-->
<!--            bu.real_name realName,bu.sex,bu.cardid idCardNo-->
<!--        from-->
<!--            ksxt_exam ke-->
<!--        left join-->
<!--            sys_apply sa-->
<!--        on-->
<!--            sa.exam_id = ke.id-->
<!--        left join-->
<!--            blade_user bu-->
<!--        on-->
<!--            bu.id = sa.user_id-->
<!--        where sa.user_id = #{userId}-->
<!--        and is_apply = 1-->
<!--        and is_exam = 1-->
<!--        and sa.apply_status = 2-->
<!--        )-->
<!--        union all-->
<!--        (select-->
<!--            ke.id,ke.exam_name examName,ke.start_time startTime,ke.end_time endTime,ke.exam_type examType,-->
<!--            str.candidate_no candidateNo,str.id applyId,-->
<!--            bu.real_name realName,bu.sex,bu.cardid idCardNo-->
<!--        from-->
<!--            ksxt_exam ke-->
<!--        left join-->
<!--            sys_training_registration str-->
<!--        on-->
<!--            str.train_exam_id = ke.id-->
<!--        left join-->
<!--            blade_user bu-->
<!--        on-->
<!--            bu.id = str.user_id-->
<!--        where str.user_id = #{userId}-->
<!--        and bu.is_train = 1-->
<!--        and (str.is_exam = 1 or str.is_exam = 3)-->
<!--        and ke.audit_status = 1-->
<!--        and str.cancel = 1-->
<!--        and str.audit_status = 1-->
<!--        )-->
<!--    </select>    、-->
    <!--查询考试人员考试信息-->
    <select id="getExamDetail" resultType="org.springblade.modules.exam.vo.ExamPaperVO">
        (select
        select
            ke.id,ke.exam_name examName,ke.start_time startTime,ke.end_time endTime,ke.exam_type examType,
            sa.candidate_no candidateNo,sa.id applyId,
            bu.real_name realName,bu.sex,bu.cardid idCardNo
        from
            ksxt_exam ke
        left join
            sys_apply sa
        on
            sa.exam_id = ke.id
        left join
            blade_user bu
        on
            bu.id = sa.user_id
        where sa.user_id = #{userId}
        and is_apply = 1
        and is_exam = 1
        and sa.apply_status = 2
        )
        union all
        (select
            ke.id,ke.exam_name examName,ke.start_time startTime,ke.end_time endTime,ke.exam_type examType,
            str.candidate_no candidateNo,str.id applyId,
            bu.real_name realName,bu.sex,bu.cardid idCardNo
        from
            ksxt_exam ke
        left join
            sys_training_registration str
        on
            str.train_exam_id = ke.id
        left join
            blade_user bu
        on
            bu.id = str.user_id
        where str.user_id = #{userId}
            str.candidate_no candidateNo,str.id applyId,str.is_exam isExam,
            bu.real_name realName,IF(mod(SUBSTR(bu.cardid,17,1),2),1,2) sex,bu.cardid idCardNo,
            es.exam_time examStartTime,es.id scoreId
        from ksxt_exam ke
        left join sys_training_registration str on str.train_exam_id = ke.id
        left join blade_user bu on bu.id = str.user_id
        left join exam_score es on es.apply_id = str.id and es.is_deleted = 0
        where str.user_id = #{examPaper.userId}
        and bu.is_train = 1
        and is_exam = 1
        and (str.is_exam = 1 or str.is_exam = 3)
        and ke.audit_status = 1
        and str.cancel = 1
        and str.audit_status = 1
        )
        and ke.start_time &lt;= now() and ke.end_time &gt; now()
        order by str.id desc
    </select>
    <!--查询前缀相同的准考证数量-->
    <!--查询是当前前缀已生成准考证号码最大的一位-->
    <select id="getCandidateNoCount" resultType="java.lang.Integer">
        select count(*) from sys_training_registration
        where 1=1
        <if test="result!=null and result!=''">
            and candidate_no like concat('%', #{result},'%')
        </if>
        select ifnull(max(0+RIGHT(candidate_no,4)),0) from sys_training_registration
        where candidate_no like concat('%', #{result},'%')
    </select>
    <!--查询当前考试已报名的人员培训报名数据集合-->
    <select id="getTrainList" resultType="org.springblade.modules.training.entity.TrainingRegistration">
        SELECT
        str.id
        str.id,str.user_id userId,str.candidate_no candidateNo
        FROM
        sys_training_registration str
        left join
@@ -247,10 +293,14 @@
    <!--查询当前考试的报名人员数量,模拟考试-->
    <select id="getTrainNumber" resultType="java.lang.Integer">
        select count(*) from sys_training_registration
        select count(*) from sys_training_registration str
        left join
            blade_user bu
        on
            bu.id = str.user_id
        where
        train_exam_id = #{examPaper.id}
        and cancel = 1
            1=1
        and train_exam_id = #{examPaper.id}
    </select>
    <!--根据用户id查询报名信息-->
@@ -286,4 +336,288 @@
        )
    </select>
    <!--查询当前人员当前考试的考试题目信息-->
    <select id="getExaminationSubjectList" resultType="org.springblade.modules.exam.vo.ExamSubjectChoicesVO">
        SELECT
            esc.id,esc.category_id,esc.subject_name,esc.choices_type,esc.score,esc.level
        FROM
            exam_subject_choices esc
        left join
        exam_examination_subject ees
        on
        esc.id = ees.subject_id
        where 1=1
        and ees.examination_id = #{examPaper.scoreId}
    </select>
    <!--批量新增考生考题信息-->
    <insert id="insertBatch" parameterType="java.util.List">
        insert into exam_examination_subject
        (examination_id,category_id,subject_id)
        values
        <foreach collection="list" index="index" item="item" separator=",">
            (
                #{item.examinationId},
                #{item.categoryId},
                #{item.subjectId}
            )
        </foreach>
    </insert>
    <!--查询当前考试的报名人员数量,模拟考试-->
    <select id="getExamNumber" resultType="java.lang.Integer">
        select count(*) from sys_training_registration str
        left join
            blade_user bu
        on
            bu.id = str.user_id
        where
            1=1
        and train_exam_id = #{examPaper.id}
        and (is_exam = 2 or is_exam = 3)
        and cancel = 1
    </select>
    <!--考试查询统计-->
<!--    <select id="getExamStatistics" resultType="org.springblade.modules.exam.vo.ExamStatisticsVO">-->
<!--        SELECt-->
<!--        ke.id,ke.start_time startTime,ke.end_time endTime,bd.dept_name schoolName,-->
<!--        ifnull(a.c,0) znum,-->
<!--        ifnull(b.c,0) yknum,-->
<!--        ifnull(c.c,0) qknum,-->
<!--        ifnull(d.c,0) ycnum,-->
<!--        ifnull(e.c,0) qxnum-->
<!--        from ksxt_exam ke-->
<!--        left join (select count(*) c,train_exam_id from sys_training_registration GROUP BY train_exam_id) a on a.train_exam_id = ke.id-->
<!--        left join (select count(*) c,train_exam_id from sys_training_registration where 1=1 and (is_exam = 2 or is_exam = 3)  GROUP BY train_exam_id) b on b.train_exam_id = ke.id-->
<!--        left join (select count(*) c,train_exam_id from sys_training_registration str left join blade_user bu on bu.id = str.user_id where 1=1 and is_exam = 4 and cancel =2 or (is_exam=1 and cancel =1) and bu.examination_type!=1 GROUP BY train_exam_id) c on c.train_exam_id = ke.id-->
<!--        left join (select count(*) c,train_exam_id from sys_training_registration str left join blade_user bu on bu.id = str.user_id where 1=1 and cancel =1 and is_exam = 1 and bu.examination_type = 1 GROUP BY train_exam_id) d on d.train_exam_id = ke.id-->
<!--        left join (select count(*) c,train_exam_id from sys_training_registration where 1=1 and is_exam = 1 and cancel =2 GROUP BY train_exam_id) e on e.train_exam_id = ke.id-->
<!--        left join blade_user bu2 on bu2.id = ke.creator-->
<!--        left join blade_dept bd on bd.id = bu2.dept_id-->
<!--        where 1=1-->
<!--        and ke.audit_status = 1-->
<!--        <if test="examPaper.schoolName!=null and examPaper.schoolName!=''">-->
<!--            and bd.dept_name like concat('%',#{examPaper.schoolName},'%')-->
<!--        </if>-->
<!--        <if test="examPaper.examTime!=null and examPaper.examTime!=''">-->
<!--            and date_format(ke.start_time,'%Y-%m-%d') = #{examPaper.examTime}-->
<!--        </if>-->
<!--        order by ke.id desc-->
<!--    </select>    -->
    <!--考试查询统计,按天,培训学校分组-->
    <select id="getExamStatistics" resultType="org.springblade.modules.exam.vo.ExamStatisticsVO">
        SELECt
        si.enterpriseName schoolName,
        a.time startTime,
        a.training_unit_id trainUnitId,
        ifnull(a.c,0) znum,
        ifnull(b.c,0) yknum,
        ifnull(f.c,0) zznum,
        ifnull(c.c,0) qknum,
        ifnull(d.c,0) ycnum,
        ifnull(e.c,0) qxnum
        from
        (select date_format(ke.start_time,'%Y-%m-%d') time,str.training_unit_id,count(*) c from sys_training_registration str left join ksxt_exam ke on ke.id = str.train_exam_id where 1=1 and ke.audit_status =1 GROUP BY date_format(ke.start_time,'%Y-%m-%d'),str.training_unit_id ) a
        left join
        (select count(*) c,date_format(ke.start_time,'%Y-%m-%d') time,str.training_unit_id from sys_training_registration str left join ksxt_exam ke on ke.id = str.train_exam_id where 1=1 and ke.audit_status =1 and (is_exam = 2 or is_exam = 3) GROUP BY date_format(ke.start_time,'%Y-%m-%d'),str.training_unit_id ) b
        on a.time = b.time and a.training_unit_id = b.training_unit_id
        left join
        (select count(*) c,date_format(ke.start_time,'%Y-%m-%d') time,str.training_unit_id from sys_training_registration str left join ksxt_exam ke on ke.id = str.train_exam_id where 1=1 and ke.audit_status =1 and is_exam = 5 GROUP BY date_format(ke.start_time,'%Y-%m-%d'),str.training_unit_id ) f
        on a.time = f.time and a.training_unit_id = f.training_unit_id
        left join
        (select count(*) c,date_format(ke.start_time,'%Y-%m-%d') time,str.training_unit_id from sys_training_registration str left join ksxt_exam ke on ke.id = str.train_exam_id left join blade_user bu on bu.id = str.user_id where 1=1 and is_exam = 4 GROUP BY date_format(ke.start_time,'%Y-%m-%d'),str.training_unit_id ) c
        on a.time = c.time and a.training_unit_id = c.training_unit_id
        left join
        (select count(*) c,date_format(ke.start_time,'%Y-%m-%d') time,str.training_unit_id from sys_training_registration str left join ksxt_exam ke on ke.id = str.train_exam_id left join blade_user bu on bu.id = str.user_id where 1=1 and cancel =1 and is_exam = 1 and bu.examination_type = 1 GROUP BY date_format(ke.start_time,'%Y-%m-%d'),str.training_unit_id ) d
        on a.time = d.time and a.training_unit_id = d.training_unit_id
        left join
        (select count(*) c,date_format(ke.start_time,'%Y-%m-%d') time,str.training_unit_id from sys_training_registration str left join ksxt_exam ke on ke.id = str.train_exam_id where 1=1 and is_exam = 1 and cancel =2 GROUP BY date_format(ke.start_time,'%Y-%m-%d'),str.training_unit_id ) e
        on a.time = e.time and a.training_unit_id = e.training_unit_id
        left join sys_information si on si.departmentid = a.training_unit_id
        where 1=1
        <if test="examPaper.schoolName!=null and examPaper.schoolName!=''">
            and si.enterpriseName like concat('%',#{examPaper.schoolName},'%')
        </if>
        <if test="examPaper.examTime!=null and examPaper.examTime!=''">
            and a.time = #{examPaper.examTime}
        </if>
        order by a.time desc,si.enterpriseName desc
    </select>
    <!--根据考试id 统计查询考试信息-->
    <select id="getExamInfoByExamId" resultType="org.springblade.modules.exam.vo.ExamStatisticsVO">
        select
        a.dept_id id,
        bd.dept_name deptName,
        ifnull(a.c,0) znum,
        ifnull(b.c,0) qknum,
        ifnull(d.c,0) ycnum,
        ifnull(c.c,0) yknum from
        (select bu.dept_id,count(*) c from sys_training_registration str left join blade_user bu on bu.id = str.user_id left join ksxt_exam ke on ke.id = str.train_exam_id where str.training_unit_id = #{examPaper.trainUnitId} and date_format(ke.start_time,'%Y-%m-%d') = #{examPaper.startTime} GROUP BY bu.dept_id) a
        left join blade_dept bd on a.dept_id = bd.id
        left join (select bu.dept_id,count(*) c from sys_training_registration str left join blade_user bu on bu.id = str.user_id left join ksxt_exam ke on ke.id = str.train_exam_id where str.training_unit_id = #{examPaper.trainUnitId} and date_format(ke.start_time,'%Y-%m-%d') = #{examPaper.startTime} and cancel =1 and is_exam = 1 and bu.examination_type = 1 GROUP BY bu.dept_id) d on d.dept_id = a.dept_id
        left join (select bu.dept_id,count(*) c from sys_training_registration str left join blade_user bu on bu.id = str.user_id left join ksxt_exam ke on ke.id = str.train_exam_id where str.training_unit_id = #{examPaper.trainUnitId} and date_format(ke.start_time,'%Y-%m-%d') = #{examPaper.startTime} and is_exam = 4 GROUP BY bu.dept_id) b on b.dept_id = a.dept_id
        left join (select bu.dept_id,count(*) c from exam_score es left join blade_user bu on bu.id = es.user_id left join ksxt_exam ke on ke.id = es.exam_id left join sys_training_registration str on str.id = es.apply_id where str.training_unit_id = #{examPaper.trainUnitId} and es.is_deleted = 0 and date_format(ke.start_time,'%Y-%m-%d') = #{examPaper.startTime} and es.theory_grade &gt;= 60 GROUP BY bu.dept_id) c on c.dept_id = a.dept_id
    </select>
    <!--根据考试id 统计查询考试信息-->
    <select id="getExamInfoByExamIdList" resultType="org.springblade.modules.exam.vo.ExamStatisticsVO">
        select (@i:=@i+1) no,aa.*  from (
        select
        bd.dept_name deptName,
        ifnull(a.c,0) znum,
        ifnull(b.c,0) qknum,
        ifnull(d.c,0) ycnum,
        ifnull(c.c,0) yknum from
        (select bu.dept_id,count(*) c from sys_training_registration str left join blade_user bu on bu.id = str.user_id left join ksxt_exam ke on ke.id = str.train_exam_id where str.training_unit_id = #{examPaper.trainUnitId} and date_format(ke.start_time,'%Y-%m-%d') = #{examPaper.examDate} GROUP BY bu.dept_id) a
        left join blade_dept bd on a.dept_id = bd.id
        left join (select bu.dept_id,count(*) c from sys_training_registration str left join blade_user bu on bu.id = str.user_id left join ksxt_exam ke on ke.id = str.train_exam_id where str.training_unit_id = #{examPaper.trainUnitId} and date_format(ke.start_time,'%Y-%m-%d') = #{examPaper.examDate} and cancel =1 and is_exam = 1 and bu.examination_type = 1 GROUP BY bu.dept_id) d on d.dept_id = a.dept_id
        left join (select bu.dept_id,count(*) c from sys_training_registration str left join blade_user bu on bu.id = str.user_id left join ksxt_exam ke on ke.id = str.train_exam_id where str.training_unit_id = #{examPaper.trainUnitId} and date_format(ke.start_time,'%Y-%m-%d') = #{examPaper.examDate} and is_exam = 4 GROUP BY bu.dept_id) b on b.dept_id = a.dept_id
        left join (select bu.dept_id,count(*) c from exam_score es left join blade_user bu on bu.id = es.user_id left join ksxt_exam ke on ke.id = es.exam_id left join sys_training_registration str on str.id = es.apply_id where str.training_unit_id = #{examPaper.trainUnitId} and es.is_deleted = 0 and date_format(ke.start_time,'%Y-%m-%d') = #{examPaper.examDate} and es.theory_grade &gt;= 60 GROUP BY bu.dept_id) c on c.dept_id = a.dept_id
        ) aa,(select @i:=0) bb
    </select>
    <!--导出-按条件查询成绩数据-模拟考试-->
    <select id="getExamScoreList" resultType="org.springblade.modules.exam.vo.ExamScoreVO">
        select (@i:=@i+1) no,aa.* from (
        SELECT
        bu.real_name securityName,
        bd.dept_name companyName,
        es.theory_grade theoryGrade,es.learn_grade learnGrade,es.all_grade allGrade,
        case when es.qualified=0 then "合格"
        when es.qualified=1 then "不合格"
        when es.qualified=2 then "暂未录入实操成绩"
        when es.qualified=3 then "缺考"
        else "" end as sortName
        from
        exam_score es
        left join
        ksxt_exam ke
        on
        ke.id = es.exam_id
        left join
        blade_user bu
        on
        es.user_id = bu.id
        left join
        blade_dept bd
        on
        bd.id = bu.dept_id
        left join
        sys_training_registration str
        on
        str.id = es.apply_id
        where
        1=1 and es.is_deleted = 0
        and (str.is_exam = 2 or str.is_exam = 3 or str.is_exam = 4 or str.is_exam = 5)
        <if test="examScore.trainUnitId!=null">
            and str.training_unit_id = #{examScore.trainUnitId}
        </if>
        <if test="examScore.isExam!=null and  examScore.isExam!=''">
            and str.is_exam = #{examScore.isExam}
        </if>
        <if test="examScore.examType!=null and  examScore.examType!=''">
            and ke.exam_type = #{examScore.examType}
        </if>
        <if test="examScore.examDate!=null  and examScore.examDate!=''">
            and date_format(ke.start_time,'%Y-%m-%d') = #{examScore.examDate}
        </if>
        order by es.id desc
        ) aa,(select @i:=0) bb
    </select>
    <!--ExamSubjectChoicesInfoMap 多表联查 一对多查询 -->
    <resultMap id="ExamSubjectChoicesInfoMap" type="org.springblade.modules.exam.vo.ExamSubjectChoicesVO">
        <id property="id" column="id"/>
        <id property="categoryId" column="category_id"/>
        <id property="subjectName" column="subject_name"/>
        <id property="choicesType" column="choices_type"/>
        <id property="answer" column="answer"/>
        <id property="score" column="score"/>
        <id property="level" column="level"/>
        <result column="id" property="id"/>
        <collection property="examSubjectOptions" javaType="java.util.List" ofType="org.springblade.modules.exam.entity.ExamSubjectOption" autoMapping="true">
            <id property="id" column="eso_id"/>
        </collection>
    </resultMap>
    <!--已缴费人员题目查询-->
    <select id="queryRandomSubjectList" resultMap="ExamSubjectChoicesInfoMap">
        select
        esc.id,esc.category_id,esc.subject_name,esc.choices_type,esc.score,esc.answer,
        eso.id eso_id,eso.subject_choices_id,eso.option_name,eso.option_content,eso.creator,
        eso.create_date,eso.modifier,eso.modify_date,eso.del_flag,eso.application_code,eso.tenant_code
        from (
            select
            id,
            category_id,
            subject_name,
            choices_type,
            score,
            answer,
            analysis,
            tktype
            from (
            select * from exam_subject_choices
            where id in
            <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
            ) a ORDER BY RAND() LIMIT #{number}
        ) esc
        left join
        exam_subject_option eso
        on
        esc.id = eso.subject_choices_id
    </select>
    <!--模拟考试随机抽题-->
    <select id="simulateQueryRandomSubjectList" resultMap="ExamSubjectChoicesInfoMap">
        SELECT
            esc.id,
            esc.category_id,
            esc.subject_name,
            esc.choices_type,
            esc.score,
            esc.answer,
            eso.id eso_id,
            eso.subject_choices_id,
            eso.option_name,
            eso.option_content,
            eso.creator,
            eso.create_date,
            eso.modifier,
            eso.modify_date,
            eso.del_flag,
            eso.application_code,
            eso.tenant_code
        FROM
            (
                SELECT * FROM ( SELECT * FROM exam_subject_choices WHERE choices_type = 0 ORDER BY RAND( ) LIMIT 70 ) a UNION ALL
                SELECT * FROM ( SELECT * FROM exam_subject_choices WHERE choices_type = 1 ORDER BY RAND( ) LIMIT 10 ) b UNION ALL
                SELECT * FROM ( SELECT * FROM exam_subject_choices WHERE choices_type = 2 ORDER BY RAND( ) LIMIT 20 ) c
            ) esc
            LEFT JOIN exam_subject_option eso ON esc.id = eso.subject_choices_id
    </select>
    <select id="getList" resultType="org.springblade.modules.exam.vo.ExamPaperVO">
        SELECT * FROM ksxt_exam
        where 1=1
        <if test="vo.examTime != null and vo.examTime != ''">
            AND DATE_FORMAT(start_time,'%Y-%m-%d') = DATE_FORMAT(#{vo.examTime},'%Y-%m-%d')
        </if>
        ORDER BY start_time DESC
    </select>
    <select id="getLatest" resultType="org.springblade.modules.exam.vo.ExamPaperVO">
        SELECT * FROM ksxt_exam
        where 1=1
        <if test="vo.examTime != null and vo.examTime != ''">
            AND DATE_FORMAT(start_time,'%Y-%m-%d') = DATE_FORMAT(#{vo.examTime},'%Y-%m-%d')
        </if>
        ORDER BY start_time DESC
        LIMIT 1
    </select>
</mapper>