wangliang %!s(int64=2) %!d(string=hai) anos
pai
achega
eee381d81a

+ 23 - 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,25 @@
                 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 if(tee.exam_count - tees.already_exam_count <![CDATA[ < ]]> 0,0,
+            tee.exam_count - tees.already_exam_count) = 0
+            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 = 'FIRST_PREPARE'
+            or toer.status = 'ANSWERING'
+            or toer.status = 'BREAK_OFF'
+            or toer.status = 'RESUME_PREPARE')
+            and toer.exam_student_id = tees.id
+            )
+            order by tees.room_code
         </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">

+ 39 - 15
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -750,9 +750,16 @@
         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
         (
         (
@@ -790,8 +797,11 @@
         toer.exam_student_id
         toer.exam_student_id
         from
         from
         t_oe_exam_record toer
         t_oe_exam_record toer
-        where
-        s.id = toer.exam_student_id
+        where 1 = 1
+        <if test="examId != null and examId != ''">
+            and toer.exam_id = #{examId}
+        </if>
+        and s.id = toer.exam_student_id
         <!--<if test="status != null and status != '' and status == 'UN_FINISH'">
         <!--<if test="status != null and status != '' and status == 'UN_FINISH'">
             and (toer.STATUS = 'FINISHED' or toer.STATUS = 'PERSISTED')
             and (toer.STATUS = 'FINISHED' or toer.STATUS = 'PERSISTED')
             and toer.first_start_time is not null
             and toer.first_start_time is not null
@@ -803,7 +813,10 @@
         <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}
@@ -827,6 +840,9 @@
         left join t_oe_exam_record toer on
         left join t_oe_exam_record toer on
         toer.exam_student_id = temp.examStudentId
         toer.exam_student_id = temp.examStudentId
         <where> 1 = 1
         <where> 1 = 1
+            <if test="examId != null and examId != ''">
+                and toer.exam_id = #{examId}
+            </if>
             <choose>
             <choose>
                 <when test="status == null">
                 <when test="status == null">
                     and toer.status <![CDATA[ <> ]]> 'JUNK'
                     and toer.status <![CDATA[ <> ]]> 'JUNK'
@@ -1415,8 +1431,11 @@
         t_e_exam_student tees
         t_e_exam_student tees
         join t_e_student tes on
         join t_e_student tes on
         tees.student_id = tes.id
         tees.student_id = tes.id
-        where
-        exists(
+        where 1 = 1
+        <if test="examId != null and examId != ''">
+            and tees.exam_id = #{examId}
+        </if>
+        and exists(
         select
         select
         tee.id
         tee.id
         from
         from
@@ -1437,7 +1456,6 @@
             <if test="courseCode != null and courseCode != ''">
             <if test="courseCode != null and courseCode != ''">
                 and tees.course_code = #{courseCode}
                 and tees.course_code = #{courseCode}
             </if>
             </if>
-            and tees.exam_id = tee.id
             and tes.org_id = tee.org_id
             and tes.org_id = tee.org_id
         </where>
         </where>
         )
         )
@@ -1446,8 +1464,11 @@
         count(distinct toer.exam_student_id) as c
         count(distinct toer.exam_student_id) as c
         from
         from
         t_oe_exam_record toer
         t_oe_exam_record toer
-        where
-        exists (
+        where 1 = 1
+        <if test="examId != null and examId != ''">
+            and toer.exam_id = #{examId}
+        </if>
+        and exists (
         select
         select
         *
         *
         from
         from
@@ -1458,13 +1479,16 @@
         t_e_exam_student tees
         t_e_exam_student tees
         join t_e_student tes on
         join t_e_student tes on
         tees.student_id = tes.id
         tees.student_id = tes.id
-        where
-        exists(
+        where 1 = 1
+        <if test="examId != null and examId != ''">
+            and tees.exam_id = #{examId}
+        </if>
+        and exists(
         select
         select
         tee.id
         tee.id
         from
         from
         t_e_exam tee
         t_e_exam tee
-        <where>1 = 1
+        <where> 1 = 1
             <if test="orgId != null and orgId != ''">
             <if test="orgId != null and orgId != ''">
                 and tee.org_id = #{orgId}
                 and tee.org_id = #{orgId}
             </if>
             </if>
@@ -1480,7 +1504,7 @@
             <if test="courseCode != null and courseCode != ''">
             <if test="courseCode != null and courseCode != ''">
                 and tees.course_code = #{courseCode}
                 and tees.course_code = #{courseCode}
             </if>
             </if>
-            and tees.exam_id = tee.id
+            and tes.org_id = tee.org_id
         </where>
         </where>
         )) t
         )) t
         where
         where