wangliang 2 ani în urmă
părinte
comite
ba78d7d265

+ 3 - 7
themis-business/src/main/resources/mapper/TEExamReexamMapper.xml

@@ -46,8 +46,8 @@
                 and tees.identity like CONCAT('%', #{identity},'%')
             </if>
             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 (tee.exam_count <![CDATA[ <= ]]> tees.already_exam_count
+                                or tee.exam_count = tees.already_exam_count)
             and not exists(
             select
             toer.exam_student_id
@@ -57,13 +57,9 @@
             <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.status in('FIRST_PREPARE','ANSWERING','BREAK_OFF','RESUME_PREPARE')
             and toer.exam_student_id = tees.id
             )
-            order by tees.room_code
         </where>
     </select>
 

+ 21 - 63
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -1429,39 +1429,19 @@
         count(1) as c
         from
         t_e_exam_student tees
-        join t_e_student tes on
-        tees.student_id = tes.id
         where 1 = 1
         <if test="examId != null and examId != ''">
             and tees.exam_id = #{examId}
         </if>
-        <if test="orgId != null and orgId != ''">
-            and tes.org_id = #{orgId}
+        <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 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>
-        )
         union all
         select
         count(distinct toer.exam_student_id) as c
@@ -1471,50 +1451,28 @@
         <if test="examId != null and examId != ''">
             and toer.exam_id = #{examId}
         </if>
-        and exists (
-        select
-        *
-        from
-        (
-        select
+        and exists (select
         tees.id
         from
         t_e_exam_student tees
-        join t_e_student tes on
-        tees.student_id = tes.id
         where 1 = 1
         <if test="examId != null and examId != ''">
             and tees.exam_id = #{examId}
         </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'">
             and toer.first_start_time is not null
-        </if>)
+        </if>
         union all
         select
         count(1)