wangliang 2 жил өмнө
parent
commit
9d3ebfcd1f

+ 19 - 14
themis-business/src/main/resources/mapper/TEExamReexamMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.qmth.themis.business.dao.TEExamReexamMapper">
 <mapper namespace="com.qmth.themis.business.dao.TEExamReexamMapper">
 
 
     <select id="reexamPageRequestList" resultType="com.qmth.themis.business.bean.admin.ReexamListRequestBean">
     <select id="reexamPageRequestList" resultType="com.qmth.themis.business.bean.admin.ReexamListRequestBean">
-        select * from(select distinct
+        select distinct
         tees.room_code as roomCode,
         tees.room_code as roomCode,
         tees.room_name as roomName,
         tees.room_name as roomName,
         tees.`identity`,
         tees.`identity`,
@@ -14,23 +14,16 @@
         tees.course_name as courseName,
         tees.course_name as courseName,
         tees.exam_id as examId,
         tees.exam_id as examId,
         if(tee.exam_count - tees.already_exam_count <![CDATA[ < ]]> 0,0,tee.exam_count - tees.already_exam_count) as examCount,
         if(tee.exam_count - tees.already_exam_count <![CDATA[ < ]]> 0,0,tee.exam_count - tees.already_exam_count) as examCount,
-        (select count(1) from t_oe_exam_record toer where (toer.status <![CDATA[ <> ]]> 'FINISHED' and toer.status <![CDATA[ <> ]]> 'PERSISTED') and toer.exam_student_id = tees.id) as statusCount,
         (select count(1) from t_e_exam_reexam teer where teer.exam_student_id = tees.id and teer.status = 1) as reexamCount
         (select count(1) from t_e_exam_reexam teer where teer.exam_student_id = tees.id and teer.status = 1) as reexamCount
         from
         from
         t_e_exam_student tees
         t_e_exam_student tees
         left join t_e_exam tee on
         left join t_e_exam tee on
         tees.exam_id = tee.id
         tees.exam_id = tee.id
+        join t_b_exam_invigilate_user tbeiu on
+        tbeiu.exam_id = tee.id
+        and tbeiu.org_id = tee.org_id
+        and tbeiu.room_code = tees.room_code
         <where>
         <where>
-            exists(
-            select
-            distinct tbeiu.exam_id
-            from
-            t_b_exam_invigilate_user tbeiu where 1 = 1
-            <if test="userId != null and userId != ''">
-                and tbeiu.user_id = #{userId}
-            </if>
-            and tbeiu.exam_id = tees.exam_id and tees.room_code = tbeiu.room_code
-            )
             <if test="examId != null and examId != ''">
             <if test="examId != null and examId != ''">
                 and tees.exam_id = #{examId}
                 and tees.exam_id = #{examId}
             </if>
             </if>
@@ -53,9 +46,21 @@
                 and tees.identity like CONCAT('%', #{identity},'%')
                 and tees.identity like CONCAT('%', #{identity},'%')
             </if>
             </if>
             and tee.monitor_status <![CDATA[ <> ]]> 'FINISHED'
             and tee.monitor_status <![CDATA[ <> ]]> 'FINISHED'
+            and (tee.exam_count <![CDATA[ <= ]]> tees.already_exam_count
+            or tee.exam_count = tees.already_exam_count)
+            and not exists(
+            select
+            toer.exam_student_id
+            from
+            t_oe_exam_record toer
+            where 1 = 1
+            <if test="examId != null and examId != ''">
+                and toer.exam_id = #{examId}
+            </if>
+            and toer.status in('FIRST_PREPARE','ANSWERING','BREAK_OFF','RESUME_PREPARE')
+            and toer.exam_student_id = tees.id
+            )
         </where>
         </where>
-        ) t where t.examCount = 0 and statusCount = 0
-        order by t.roomCode
     </select>
     </select>
 
 
     <select id="reexamPageNotDoneList" resultType="com.qmth.themis.business.bean.admin.ReexamListNotDoneBean">
     <select id="reexamPageNotDoneList" resultType="com.qmth.themis.business.bean.admin.ReexamListNotDoneBean">

+ 99 - 148
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -759,7 +759,18 @@
     <sql id="invigilatePageListHistorySql">
     <sql id="invigilatePageListHistorySql">
         select (@i := @i + 1) as seq,t.* from(
         select (@i := @i + 1) as seq,t.* from(
         select
         select
-        temp.*,
+        distinct s.exam_id as examId,
+        tee.name as examName,
+        s.exam_activity_id as examActivityId,
+        teea.code as examActivityCode,
+        s.id as examStudentId,
+        s.identity,
+        s.room_code as roomCode,
+        s.room_name as roomName,
+        s.name,
+        s.course_name as courseName,
+        s.course_code as courseCode,
+        tes.mobile_number as mobileNumber,
         toer.id as examRecordId,
         toer.id as examRecordId,
         IFNULL(toer.paper_download,1) as paperDownload,
         IFNULL(toer.paper_download,1) as paperDownload,
         toer.status as statusCode,
         toer.status as statusCode,
@@ -772,26 +783,18 @@
         toer.monitor_video_source as monitorVideoSource,
         toer.monitor_video_source as monitorVideoSource,
         toer.monitor_record as monitorRecord,
         toer.monitor_record as monitorRecord,
         toer.finish_type as finishType
         toer.finish_type as finishType
-        ,(select count(1) from t_ie_invigilate_warn_info tiiwi where tiiwi.exam_record_id = toer.id and tiiwi.`type` =
-        'FACE_COUNT_ERROR' and tiiwi.`level` = 'D8') as multipleFaceCount
-        ,(select count(1) from t_ie_invigilate_exception_info tiiei where tiiei.exam_record_id = toer.id) as
+        ,(select count(1) from t_ie_invigilate_warn_info tiiwi where 1 = 1
+        <if test="examId != null and examId != ''">
+            and tiiwi.exam_id = #{examId}
+        </if>
+        and tiiwi.exam_record_id = toer.id and tiiwi.`type` = 'FACE_COUNT_ERROR' and tiiwi.`level` = 'D8') as multipleFaceCount
+        ,(select count(1) from t_ie_invigilate_exception_info tiiei where 1 = 1
+        <if test="examId != null and examId != ''">
+            and tiiei.exam_id = #{examId}
+        </if>
+        and tiiei.exam_record_id = toer.id) as
         exceptionCount
         exceptionCount
         from
         from
-        (
-        select
-        distinct s.exam_id as examId,
-        tee.name as examName,
-        s.exam_activity_id as examActivityId,
-        teea.code as examActivityCode,
-        s.id as examStudentId,
-        s.identity,
-        s.room_code as roomCode,
-        s.room_name as roomName,
-        s.name,
-        s.course_name as courseName,
-        s.course_code as courseCode,
-        tes.mobile_number as mobileNumber
-        from
         t_e_exam_student s
         t_e_exam_student s
         left join t_e_exam tee on
         left join t_e_exam tee on
         tee.id = s.exam_id
         tee.id = s.exam_id
@@ -799,33 +802,26 @@
         teea.id = s.exam_activity_id
         teea.id = s.exam_activity_id
         left join t_e_student tes on
         left join t_e_student tes on
         s.student_id = tes.id
         s.student_id = tes.id
-        WHERE
+        left join t_oe_exam_record toer on toer.exam_student_id = s.id
+        WHERE 1 = 1
         <choose>
         <choose>
             <when test="status != null and status != '' and status == 'UN_FINISH'">
             <when test="status != null and status != '' and status == 'UN_FINISH'">
-                NOT EXISTS(
+                and toer.id is null
             </when>
             </when>
             <otherwise>
             <otherwise>
-                EXISTS(
+                and toer.id is not null
             </otherwise>
             </otherwise>
         </choose>
         </choose>
-        select
-        toer.exam_student_id
-        from
-        t_oe_exam_record toer
-        where
-        s.id = toer.exam_student_id
-        <!--<if test="status != null and status != '' and status == 'UN_FINISH'">
-            and (toer.STATUS = 'FINISHED' or toer.STATUS = 'PERSISTED')
-            and toer.first_start_time is not null
-        </if>-->
-        )
         <if test="examId != null and examId != ''">
         <if test="examId != null and examId != ''">
             and s.exam_id = #{examId}
             and s.exam_id = #{examId}
         </if>
         </if>
         <if test="userId != null and userId != ''">
         <if test="userId != null and userId != ''">
             and exists (select tbeiu.exam_id from t_b_exam_invigilate_user tbeiu
             and exists (select tbeiu.exam_id from t_b_exam_invigilate_user tbeiu
             where tbeiu.user_id = #{userId}
             where tbeiu.user_id = #{userId}
-            and tbeiu.exam_id = s.exam_id and tbeiu.room_code = s.room_code)
+            <if test="orgId != null and orgId != ''">
+                and tbeiu.org_id = #{orgId}
+            </if>
+            and tbeiu.exam_id = s.exam_id and tbeiu.org_id = tee.org_id and tbeiu.room_code = s.room_code)
         </if>
         </if>
         <if test="orgId != null and orgId != ''">
         <if test="orgId != null and orgId != ''">
             and tee.org_id = #{orgId}
             and tee.org_id = #{orgId}
@@ -845,64 +841,59 @@
         <if test="courseCode != null and courseCode != ''">
         <if test="courseCode != null and courseCode != ''">
             and s.course_code = #{courseCode}
             and s.course_code = #{courseCode}
         </if>
         </if>
-        ) temp
-        left join t_oe_exam_record toer on
-        toer.exam_student_id = temp.examStudentId
-        <where> 1 = 1
-            <choose>
-                <when test="status == null">
-                    and toer.status <![CDATA[ <> ]]> 'JUNK'
-                </when>
-                <when test="status != null and status != '' and status != 'UN_FINISH'">
-                    <choose>
-                        <when test="status == 'EXAMING'">
-                            and (toer.status = 'ANSWERING' or toer.status = 'RESUME_PREPARE' or toer.status = 'BREAK_OFF')
-                        </when>
-                        <otherwise>
-                            and toer.status = #{status}
-                        </otherwise>
-                    </choose>
-                </when>
-            </choose>
-<!--            <if test="status != null and status != '' and status != 'UN_FINISH'">-->
-<!--                <choose>-->
-<!--                    <when test="status == 'EXAMING'">-->
-<!--                        and (toer.status = 'ANSWERING' or toer.status = 'RESUME_PREPARE' or toer.status = 'BREAK_OFF')-->
-<!--                    </when>-->
-<!--                    <otherwise>-->
-<!--                        and toer.status = #{status}-->
-<!--                    </otherwise>-->
-<!--                </choose>-->
-<!--            </if>-->
-            <!--<if test="status != null and status != '' and status == 'UN_FINISH'">
-                and (toer.first_start_time is null or toer.first_prepare_time is null)
-            </if>-->
-            <if test="maxWarningCount != null and maxWarningCount != '' or maxWarningCount == 0">
-                and toer.warning_count &lt;= #{maxWarningCount}
-            </if>
-            <if test="minWarningCount != null and minWarningCount != '' or minWarningCount == 0">
-                and toer.warning_count &gt;= #{minWarningCount}
-            </if>
-            <if test="breachStatus != null and breachStatus != '' or breachStatus == 0">
-                <if test="breachStatus == 0">
-                    and toer.breach_status = #{breachStatus}
-                </if>
-                <if test="breachStatus == 1">
-                    and (toer.breach_status = #{breachStatus} or toer.breach_status is null)
-                </if>
-            </if>
-            <if test="finishType != null and finishType != ''">
+        <choose>
+            <when test="status == null">
+                and toer.status <![CDATA[ <> ]]> 'JUNK'
+            </when>
+            <when test="status != null and status != '' and status != 'UN_FINISH'">
                 <choose>
                 <choose>
-                    <when test="finishType == 'ALL'">
-                        and (toer.finish_type = 'MANUAL' or toer.finish_type = 'AUTO' or toer.finish_type = 'BREACH' or
-                        toer.finish_type = 'INTERRUPT')
+                    <when test="status == 'EXAMING'">
+                        and (toer.status = 'ANSWERING' or toer.status = 'RESUME_PREPARE' or toer.status = 'BREAK_OFF')
                     </when>
                     </when>
                     <otherwise>
                     <otherwise>
-                        and toer.finish_type = #{finishType}
+                        and toer.status = #{status}
                     </otherwise>
                     </otherwise>
                 </choose>
                 </choose>
+            </when>
+        </choose>
+        <!--            <if test="status != null and status != '' and status != 'UN_FINISH'">-->
+        <!--                <choose>-->
+        <!--                    <when test="status == 'EXAMING'">-->
+        <!--                        and (toer.status = 'ANSWERING' or toer.status = 'RESUME_PREPARE' or toer.status = 'BREAK_OFF')-->
+        <!--                    </when>-->
+        <!--                    <otherwise>-->
+        <!--                        and toer.status = #{status}-->
+        <!--                    </otherwise>-->
+        <!--                </choose>-->
+        <!--            </if>-->
+        <!--<if test="status != null and status != '' and status == 'UN_FINISH'">
+            and (toer.first_start_time is null or toer.first_prepare_time is null)
+        </if>-->
+        <if test="maxWarningCount != null and maxWarningCount != '' or maxWarningCount == 0">
+            and toer.warning_count &lt;= #{maxWarningCount}
+        </if>
+        <if test="minWarningCount != null and minWarningCount != '' or minWarningCount == 0">
+            and toer.warning_count &gt;= #{minWarningCount}
+        </if>
+        <if test="breachStatus != null and breachStatus != '' or breachStatus == 0">
+            <if test="breachStatus == 0">
+                and toer.breach_status = #{breachStatus}
             </if>
             </if>
-        </where>
+            <if test="breachStatus == 1">
+                and (toer.breach_status = #{breachStatus} or toer.breach_status is null)
+            </if>
+        </if>
+        <if test="finishType != null and finishType != ''">
+            <choose>
+                <when test="finishType == 'ALL'">
+                    and (toer.finish_type = 'MANUAL' or toer.finish_type = 'AUTO' or toer.finish_type = 'BREACH' or
+                    toer.finish_type = 'INTERRUPT')
+                </when>
+                <otherwise>
+                    and toer.finish_type = #{finishType}
+                </otherwise>
+            </choose>
+        </if>
         ) t,
         ) t,
         (SELECT @i := 0) as i
         (SELECT @i := 0) as i
         <where>1 = 1
         <where>1 = 1
@@ -919,7 +910,6 @@
                 and t.exceptionCount &lt;= #{maxExceptionCount}
                 and t.exceptionCount &lt;= #{maxExceptionCount}
             </if>
             </if>
         </where>
         </where>
-        order by t.roomCode
     </sql>
     </sql>
 
 
     <select id="invigilatePageListHistoryExport"
     <select id="invigilatePageListHistoryExport"
@@ -1459,36 +1449,19 @@
         count(1) as c
         count(1) as c
         from
         from
         t_e_exam_student tees
         t_e_exam_student tees
-        join t_e_student tes on
-        tees.student_id = tes.id
         where 1 = 1
         where 1 = 1
         <if test="examId != null and examId != ''">
         <if test="examId != null and examId != ''">
             and tees.exam_id = #{examId}
             and tees.exam_id = #{examId}
         </if>
         </if>
-        and exists(
-        select
-        tee.id
-        from
-        t_e_exam tee
-        <where>1 = 1
-            <if test="orgId != null and orgId != ''">
-                and tee.org_id = #{orgId}
-            </if>
-            <if test="examId != null and examId != ''">
-                and tee.id = #{examId}
-            </if>
-            <if test="examActivityId != null and examActivityId != ''">
-                and tees.exam_activity_id = #{examActivityId}
-            </if>
-            <if test="roomCode != null and roomCode != ''">
-                and tees.room_code = #{roomCode}
-            </if>
-            <if test="courseCode != null and courseCode != ''">
-                and tees.course_code = #{courseCode}
-            </if>
-            and tes.org_id = tee.org_id
-        </where>
-        )
+        <if test="examActivityId != null and examActivityId != ''">
+            and tees.exam_activity_id = #{examActivityId}
+        </if>
+        <if test="roomCode != null and roomCode != ''">
+            and tees.room_code = #{roomCode}
+        </if>
+        <if test="courseCode != null and courseCode != ''">
+            and tees.course_code = #{courseCode}
+        </if>
         union all
         union all
         select
         select
         count(distinct toer.exam_student_id) as c
         count(distinct toer.exam_student_id) as c
@@ -1498,50 +1471,28 @@
         <if test="examId != null and examId != ''">
         <if test="examId != null and examId != ''">
             and toer.exam_id = #{examId}
             and toer.exam_id = #{examId}
         </if>
         </if>
-        and exists (
-        select
-        *
-        from
-        (
-        select
+        and exists (select
         tees.id
         tees.id
         from
         from
         t_e_exam_student tees
         t_e_exam_student tees
-        join t_e_student tes on
-        tees.student_id = tes.id
         where 1 = 1
         where 1 = 1
         <if test="examId != null and examId != ''">
         <if test="examId != null and examId != ''">
             and tees.exam_id = #{examId}
             and tees.exam_id = #{examId}
         </if>
         </if>
-        and exists(
-        select
-        tee.id
-        from
-        t_e_exam tee
-        <where> 1 = 1
-            <if test="orgId != null and orgId != ''">
-                and tee.org_id = #{orgId}
-            </if>
-            <if test="examId != null and examId != ''">
-                and tee.id = #{examId}
-            </if>
-            <if test="examActivityId != null and examActivityId != ''">
-                and tees.exam_activity_id = #{examActivityId}
-            </if>
-            <if test="roomCode != null and roomCode != ''">
-                and tees.room_code = #{roomCode}
-            </if>
-            <if test="courseCode != null and courseCode != ''">
-                and tees.course_code = #{courseCode}
-            </if>
-            and tes.org_id = tee.org_id
-        </where>
-        )) t
-        where
-        t.id = toer.exam_student_id
+        <if test="examActivityId != null and examActivityId != ''">
+            and tees.exam_activity_id = #{examActivityId}
+        </if>
+        <if test="roomCode != null and roomCode != ''">
+            and tees.room_code = #{roomCode}
+        </if>
+        <if test="courseCode != null and courseCode != ''">
+            and tees.course_code = #{courseCode}
+        </if>
+        and toer.exam_student_id = tees.id
+        )
         <if test="monitorStatus != null and monitorStatus != '' and monitorStatus == 'FINISHED'">
         <if test="monitorStatus != null and monitorStatus != '' and monitorStatus == 'FINISHED'">
             and toer.first_start_time is not null
             and toer.first_start_time is not null
-        </if>)
+        </if>
         union all
         union all
         select
         select
         count(1)
         count(1)