瀏覽代碼

exists条件修改

wangliang 4 年之前
父節點
當前提交
a443618c23

+ 47 - 48
themis-business/src/main/resources/mapper/TIeInvigilateWarnInfoMapper.xml

@@ -7,16 +7,15 @@
         from t_ie_invigilate_warn_info tiiwi
         left join t_e_exam_student tees on tees.id = tiiwi.exam_student_id
         left join t_e_exam tee on tee.id = tees.exam_id
-        inner join (select toer.id from t_oe_exam_record toer where EXISTS(select tees.id from t_e_exam_student tees where EXISTS (select distinct tbeiu.room_code from t_b_exam_invigilate_user tbeiu
-        where
-        <if test="userId != null and userId != ''">
-            tbeiu.user_id = #{userId} and
-        </if>
-        tbeiu.room_code = tees.room_code and toer.exam_id = tbeiu.exam_id and toer.exam_student_id = tees.id))) t on t.id = tiiwi.exam_record_id
-        <where>
+        <where> 1 = 1
             <if test="examId != null and examId != ''">
                 and tiiwi.exam_id = #{examId}
             </if>
+            <if test="userId != null and userId != ''">
+                and exists (select tbeiu.exam_id from t_b_exam_invigilate_user tbeiu
+                where tbeiu.user_id = #{userId}
+                and tbeiu.exam_id = tees.exam_id and tbeiu.room_code = tees.room_code)
+            </if>
             <if test="orgId != null and orgId != ''">
                 and tee.org_id = #{orgId}
             </if>
@@ -33,21 +32,21 @@
 
     <select id="warningMessage" resultType="com.qmth.themis.business.dto.response.TIeWarningNotifyDto">
         select
-            tees.id as examStudentId,
-            tees.name,
-            tiiwi.info,
-            tiiwi.`level`,
-            tiiwi.id as warningId,
-            tiiwi.remark,
-            tiiwi.exam_id as examId,
-            tiiwi.exam_record_id as examRecordId
+        tees.id as examStudentId,
+        tees.name,
+        tiiwi.info,
+        tiiwi.`level`,
+        tiiwi.id as warningId,
+        tiiwi.remark,
+        tiiwi.exam_id as examId,
+        tiiwi.exam_record_id as examRecordId
         from
-            t_ie_invigilate_warn_info tiiwi
+        t_ie_invigilate_warn_info tiiwi
         left join t_e_exam_student tees on
-            tees.id = tiiwi.exam_student_id
+        tees.id = tiiwi.exam_student_id
         left join t_b_exam_invigilate_user tbeiu on
-            tbeiu.exam_id = tiiwi.exam_id
-            and tbeiu.room_code = tees.room_code
+        tbeiu.exam_id = tiiwi.exam_id
+        and tbeiu.room_code = tees.room_code
         <where>
             <if test="examId != null and examId != ''">
                 and tiiwi.exam_id = #{examId}
@@ -63,34 +62,34 @@
         </where>
     </select>
 
-    <select id="findLastMsg" resultType="com.qmth.themis.business.bean.backend.WarningNotifyBean">
-    	SELECT
-			f.identity,
-			f.name,
-			f.room_code roomCode,
-			tem.*
-		FROM
-			(
-				SELECT
-					t.exam_student_id AS examStudentId,
-					t.info,
-					t.`level`,
-					t.id AS warningId,
-					t.remark,
-					t.exam_id AS examId,
-					t.exam_record_id AS examRecordId,
-					t.create_time createTime
-				FROM
-					t_ie_invigilate_warn_info t
-				left join t_e_exam h on t.exam_id=h.id
-				where 1=1
-				<if test="orgId != null">
-				 	and h.org_id=#{orgId}
-				</if>
-				ORDER BY
-					t.id DESC
-				limit #{conut}
-			) tem
-		LEFT JOIN t_e_exam_student f ON tem.examStudentId = f.id
+    <select id="findLastMsg" resultType="com.qmth.themis.business.bean.admin.WarningNotifyBean">
+        SELECT
+        f.identity,
+        f.name,
+        f.room_code roomCode,
+        tem.*
+        FROM
+        (
+        SELECT
+        t.exam_student_id AS examStudentId,
+        t.info,
+        t.`level`,
+        t.id AS warningId,
+        t.remark,
+        t.exam_id AS examId,
+        t.exam_record_id AS examRecordId,
+        t.create_time createTime
+        FROM
+        t_ie_invigilate_warn_info t
+        left join t_e_exam h on t.exam_id=h.id
+        where 1=1
+        <if test="orgId != null">
+            and h.org_id=#{orgId}
+        </if>
+        ORDER BY
+        t.id DESC
+        limit #{conut}
+        ) tem
+        LEFT JOIN t_e_exam_student f ON tem.examStudentId = f.id
     </select>
 </mapper>

+ 122 - 193
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -110,15 +110,6 @@
 		left join t_e_exam_student s on t.exam_student_id = s.id
 		left join t_e_exam tee on tee.id = t.exam_id
 		left join t_e_exam_activity teea on teea.id = t.exam_activity_id
-		inner join (select toer.id from t_oe_exam_record toer where EXISTS(select
-		tees.id from t_e_exam_student tees where EXISTS (select distinct
-		tbeiu.room_code from t_b_exam_invigilate_user tbeiu
-		where
-		<if test="userId != null and userId != ''">
-			tbeiu.user_id = #{userId} and
-		</if>
-		tbeiu.room_code = tees.room_code and tees.exam_id = tbeiu.exam_id and toer.exam_student_id = tees.id)))
-		t1 on t1.id = t.id
 	</sql>
 
 	<sql id="invigilatePageFoot">
@@ -126,6 +117,11 @@
 			<if test="examId != null and examId != ''">
 				and t.exam_id = #{examId}
 			</if>
+			<if test="userId != null and userId != ''">
+				and exists (select tbeiu.exam_id from t_b_exam_invigilate_user tbeiu
+				where tbeiu.user_id = #{userId}
+				and tbeiu.exam_id = s.exam_id and tbeiu.room_code = s.room_code)
+			</if>
 			<if test="orgId != null and orgId != ''">
 				and tee.org_id = #{orgId}
 			</if>
@@ -160,18 +156,20 @@
 			<if test="clientWebsocketStatus != null and clientWebsocketStatus != ''">
 				and t.client_websocket_status = #{clientWebsocketStatus}
 			</if>
-			and s.enable = 1
-			and tee.enable = 1
-			and teea.enable = 1
 			and teea.finish_time > unix_timestamp(current_timestamp()) * 1000
 		</where>
 	</sql>
 
 	<sql id="invigilatePageHistoryFoot">
-		<where>
+		<where> 1 = 1
 			<if test="examId != null and examId != ''">
 				and t.exam_id = #{examId}
 			</if>
+			<if test="userId != null and userId != ''">
+				and exists (select tbeiu.exam_id from t_b_exam_invigilate_user tbeiu
+				where tbeiu.user_id = #{userId}
+				and tbeiu.exam_id = t.exam_id and tbeiu.room_code = s.room_code)
+			</if>
 			<if test="orgId != null and orgId != ''">
 				and tee.org_id = #{orgId}
 			</if>
@@ -203,13 +201,10 @@
 			<if test="minWarningCount != null and minWarningCount != '' or minWarningCount == 0">
 				and t.warning_count &gt;= #{minWarningCount}
 			</if>
-			and s.enable = 1
-			and tee.enable = 1
-			and teea.enable = 1
 		</where>
 	</sql>
 
-	<select id="invigilatePageList" resultType="com.qmth.themis.business.bean.backend.InvigilateListBean">
+	<select id="invigilatePageList" resultType="com.qmth.themis.business.bean.admin.InvigilateListBean">
 		select
 		(@i := @i + 1) as seq,
 		t.*
@@ -218,11 +213,6 @@
 		<include refid="invigilatePageHead"/>
 		,(select count(1) from t_ie_invigilate_warn_info tiiwi where tiiwi.exam_record_id = t.id and
 		tiiwi.approve_status = 0) as warningNew
-		<!--,case
-		when tee.mode = 'ANYTIME' then SEC_TO_TIME(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds)
-		when tee.mode = 'TOGETHER' and tee.force_finish = 1 then SEC_TO_TIME((IFNULL(teea.finish_time, tee.end_time) - unix_timestamp(current_timestamp()) * 1000) / 1000)
-		else SEC_TO_TIME(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds)
-		end as remainTime-->
 		<include refid="invigilatePageMiddle"/>
 		<include refid="invigilatePageFoot"/>
 		<if test="paperDownload != null and paperDownload != '' or paperDownload == 0">
@@ -236,7 +226,7 @@
 		order by t.warningNew desc
 	</select>
 
-	<select id="invigilatePageListVideo" resultType="com.qmth.themis.business.bean.backend.InvigilateListVideoBean">
+	<select id="invigilatePageListVideo" resultType="com.qmth.themis.business.bean.admin.InvigilateListVideoBean">
 		select
 		(@i := @i + 1) as seq,
 		t.*
@@ -245,11 +235,6 @@
 		<include refid="invigilatePageHead" />
 		,t.monitor_live_url as monitorLiveUrl
 		,(select count(1) from t_ie_invigilate_warn_info tiiwi where tiiwi.exam_record_id = t.id and tiiwi.approve_status = 0) as warningNew
-		<!--,case
-		when tee.mode = 'ANYTIME' then SEC_TO_TIME(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds)
-		when tee.mode = 'TOGETHER' and tee.force_finish = 1 then SEC_TO_TIME((IFNULL(teea.finish_time, tee.end_time) - unix_timestamp(current_timestamp()) * 1000) / 1000)
-		else SEC_TO_TIME(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds)
-		end as remainTime-->
 		<include refid="invigilatePageMiddle" />
 		<include refid="invigilatePageFoot" />
 		<if test="paperDownload != null and paperDownload != '' or paperDownload == 0">
@@ -263,15 +248,10 @@
 		order by t.warningNew desc
 	</select>
 
-	<select id="invigilatePageListVideoRandom" resultType="com.qmth.themis.business.bean.backend.InvigilateListVideoBean">
+	<select id="invigilatePageListVideoRandom" resultType="com.qmth.themis.business.bean.admin.InvigilateListVideoBean">
 		<include refid="invigilatePageHead" />
 		,t.monitor_live_url as monitorLiveUrl
 		,(select count(1) from t_ie_invigilate_warn_info tiiwi where tiiwi.exam_record_id = t.id and tiiwi.approve_status = 0) as warningNew
-		<!--,case
-		when tee.mode = 'ANYTIME' then SEC_TO_TIME(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds)
-		when tee.mode = 'TOGETHER' and tee.force_finish = 1 then SEC_TO_TIME((IFNULL(teea.finish_time, tee.end_time) - unix_timestamp(current_timestamp()) * 1000) / 1000)
-		else SEC_TO_TIME(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds)
-		end as remainTime-->
 		<include refid="invigilatePageMiddle" />
 		<where> 1 = 1
 			<if test="examId != null and examId != ''">
@@ -285,16 +265,11 @@
 		ORDER BY RAND() LIMIT #{randomNum}
 	</select>
 
-	<select id="invigilatePagePatrolList" resultType="com.qmth.themis.business.bean.backend.InvigilateListPatrolBean">
+	<select id="invigilatePagePatrolList" resultType="com.qmth.themis.business.bean.admin.InvigilateListPatrolBean">
 		select (@i := @i + 1) as seq,t.* from(<include refid="invigilatePageHead" />
 		,(select count(1) from t_ie_invigilate_exception_info tiiei where tiiei.exam_record_id = t.id) as exceptionCount
 		,(select count(1) from t_ie_invigilate_warn_info tiiwi where tiiwi.exam_record_id = t.id and tiiwi.`type` =
 		'FACE_COUNT_ERROR' and tiiwi.`level` = 'D8') as multipleFaceCount
-		<!--,case
-		when tee.mode = 'ANYTIME' then SEC_TO_TIME(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds)
-		when tee.mode = 'TOGETHER' and tee.force_finish = 1 then SEC_TO_TIME((IFNULL(teea.finish_time, tee.end_time) - unix_timestamp(current_timestamp()) * 1000) / 1000)
-		else SEC_TO_TIME(IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) - t.duration_seconds)
-		end as remainTime-->
 		<include refid="invigilatePageMiddle" />
 		<include refid="invigilatePageFoot" />
 		<if test="status == null or status == ''">
@@ -318,7 +293,7 @@
 		order by t.roomCode
 	</select>
 
-	<select id="invigilatePageWarningList" resultType="com.qmth.themis.business.bean.backend.InvigilateListWarningBean">
+	<select id="invigilatePageWarningList" resultType="com.qmth.themis.business.bean.admin.InvigilateListWarningBean">
 		select (@i := @i + 1) as seq,t.* from(select
 		tiiwi.id as warningId,
 		tee.id as examId,
@@ -346,21 +321,17 @@
 		from t_ie_invigilate_warn_info tiiwi
 		left join t_e_exam tee on tee.id = tiiwi.exam_id
 		left join t_e_exam_activity teea on teea.id = tiiwi.exam_activity_id
-		inner join (select toer.id from t_oe_exam_record toer where EXISTS(select
-		tees.id from t_e_exam_student tees where EXISTS (select distinct
-		tbeiu.room_code from t_b_exam_invigilate_user tbeiu
-		where
-		<if test="userId != null and userId != ''">
-			tbeiu.user_id = #{userId} and
-		</if>
-		tbeiu.room_code = tees.room_code and tees.exam_id = tbeiu.exam_id and toer.exam_student_id = tees.id)))
-		t on t.id = tiiwi.exam_record_id
-		left join t_oe_exam_record toer on toer.id = t.id
+		left join t_oe_exam_record toer on toer.id = tiiwi.exam_record_id
 		left join t_e_exam_student tees on tees.id = tiiwi.exam_student_id
-		<where>
+		<where> 1 = 1
 			<if test="examId != null and examId != ''">
 				and tiiwi.exam_id = #{examId}
 			</if>
+			<if test="userId != null and userId != ''">
+				and exists (select tbeiu.exam_id from t_b_exam_invigilate_user tbeiu
+				where tbeiu.user_id = #{userId}
+				and tbeiu.exam_id = tees.exam_id and tbeiu.room_code = tees.room_code)
+			</if>
 			<if test="orgId != null and orgId != ''">
 				and tee.org_id = #{orgId}
 			</if>
@@ -385,8 +356,6 @@
 			<if test="minWarningCount != null and minWarningCount != '' or minWarningCount == 0">
 				and toer.warning_count &gt;= #{minWarningCount}
 			</if>
-			and tee.enable = 1
-			and teea.enable = 1
 		</where>
 		) t,(SELECT @i := 0) as i
 		<where>
@@ -436,21 +405,17 @@
 		from t_ie_invigilate_warn_info tiiwi
 		left join t_e_exam tee on tee.id = tiiwi.exam_id
 		left join t_e_exam_activity teea on teea.id = tiiwi.exam_activity_id
-		inner join (select toer.id from t_oe_exam_record toer where EXISTS(select
-		tees.id from t_e_exam_student tees where EXISTS (select distinct
-		tbeiu.room_code from t_b_exam_invigilate_user tbeiu
-		where
-		<if test="userId != null and userId != ''">
-			tbeiu.user_id = #{userId} and
-		</if>
-		tbeiu.room_code = tees.room_code and tees.exam_id = tbeiu.exam_id and toer.exam_student_id = tees.id)))
-		t on t.id = tiiwi.exam_record_id
 		left join t_oe_exam_record toer on toer.id = t.id
 		left join t_e_exam_student tees on tees.id = tiiwi.exam_student_id
-		<where>
+		<where> 1 = 1
 			<if test="examId != null and examId != ''">
 				and tiiwi.exam_id = #{examId}
 			</if>
+			<if test="userId != null and userId != ''">
+				and exists (select tbeiu.exam_id from t_b_exam_invigilate_user tbeiu
+				where tbeiu.user_id = #{userId}
+				and tbeiu.exam_id = tees.exam_id and tbeiu.room_code = tees.room_code)
+			</if>
 			<if test="orgId != null and orgId != ''">
 				and tee.org_id = #{orgId}
 			</if>
@@ -475,8 +440,6 @@
 			<if test="minWarningCount != null and minWarningCount != '' or minWarningCount == 0">
 				and toer.warning_count &gt;= #{minWarningCount}
 			</if>
-			and tee.enable = 1
-			and teea.enable = 1
 		</where>
 		) t
 		<where> 1 = 1
@@ -496,7 +459,7 @@
 		and t.warningId = tiiwi.id)
 	</update>
 
-	<select id="invigilatePageProgressList" resultType="com.qmth.themis.business.bean.backend.InvigilateListProgressBean">
+	<select id="invigilatePageProgressList" resultType="com.qmth.themis.business.bean.admin.InvigilateListProgressBean">
 		select
 		distinct tee.id as examId,
 		tee.name as examName,
@@ -520,20 +483,15 @@
 		left join t_e_exam_activity teea on
 		teea.id = tees.exam_activity_id
 		left join t_e_student tes on tees.student_id = tes.id
-		<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
-			)
+		<where> 1 = 1
 			<if test="examId != null and examId != ''">
 				and tees.exam_id = #{examId}
 			</if>
+			<if test="userId != null and userId != ''">
+				and exists (select tbeiu.exam_id from t_b_exam_invigilate_user tbeiu
+				where tbeiu.user_id = #{userId}
+				and tbeiu.exam_id = tees.exam_id and tbeiu.room_code = tees.room_code)
+			</if>
 			<if test="orgId != null and orgId != ''">
 				and tee.org_id = #{orgId}
 			</if>
@@ -552,14 +510,12 @@
 			<if test="identity != null and identity !=''">
 				and tees.identity like CONCAT('%', #{identity},'%')
 			</if>
-			and tee.enable = 1
-			and teea.enable = 1
 			and tee.monitor_status <![CDATA[ <> ]]> 'FINISHED'
 		</where>
 		order by tees.room_code
 	</select>
 
-	<select id="invigilatePageProgressListExport" resultType="com.qmth.themis.business.bean.backend.InvigilateListProgressExcelBean">
+	<select id="invigilatePageProgressListExport" resultType="com.qmth.themis.business.bean.admin.InvigilateListProgressExcelBean">
 		select
 		distinct tee.id as examId,
 		tee.name as examName,
@@ -582,20 +538,15 @@
 		left join t_e_exam_activity teea on
 		teea.id = tees.exam_activity_id
 		left join t_e_student tes on tees.student_id = tes.id
-		<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
-			)
+		<where> 1 = 1
 			<if test="examId != null and examId != ''">
 				and tees.exam_id = #{examId}
 			</if>
+			<if test="userId != null and userId != ''">
+				and exists (select tbeiu.exam_id from t_b_exam_invigilate_user tbeiu
+				where tbeiu.user_id = #{userId}
+				and tbeiu.exam_id = tees.exam_id and tbeiu.room_code = tees.room_code)
+			</if>
 			<if test="orgId != null and orgId != ''">
 				and tee.org_id = #{orgId}
 			</if>
@@ -614,15 +565,13 @@
 			<if test="identity != null and identity !=''">
 				and tees.identity like CONCAT('%', #{identity},'%')
 			</if>
-			and tee.enable = 1
-			and teea.enable = 1
 			and tee.monitor_status <![CDATA[ <> ]]> 'FINISHED'
 		</where>
 		group by tee.id,tees.room_code,tee.name,teea.id,teea.code,tees.`identity`,tees.name,leftExamCount,status,tes.mobile_number
 		order by tees.room_code
 	</select>
 
-	<select id="invigilatePageListHistory" resultType="com.qmth.themis.business.bean.backend.InvigilateListHistoryBean">
+	<select id="invigilatePageListHistory" resultType="com.qmth.themis.business.bean.admin.InvigilateListHistoryBean">
 		select (@i := @i + 1) as seq,t.* from(
 		<include refid="invigilatePageHead" />
 		,tes.mobile_number as mobileNumber
@@ -660,7 +609,7 @@
 		left join t_e_student h on t.student_id=h.id
 		where f.exam_id = #{examId}
 		<if test="orgId != null">
-		 	and h.org_id=#{orgId}
+			and h.org_id=#{orgId}
 		</if>
 		<if test="activityId != null and activityId != ''">
 			and f.exam_activity_id = #{activityId}
@@ -682,7 +631,7 @@
 		left join t_e_student h on t.student_id=h.id
 		where f.exam_id = #{examId}
 		<if test="orgId != null">
-		 	and h.org_id=#{orgId}
+			and h.org_id=#{orgId}
 		</if>
 		<if test="activityId != null and activityId != ''">
 			and f.exam_activity_id = #{activityId}
@@ -732,7 +681,7 @@
 		limit 1
 	</select>
 
-	<select id="patrolReport" resultType="com.qmth.themis.business.bean.backend.InvigilateListPatrolReportBean">
+	<select id="patrolReport" resultType="com.qmth.themis.business.bean.admin.InvigilateListPatrolReportBean">
 		select
 		t.roomCode,
 		t.roomName,
@@ -751,35 +700,15 @@
 		tee.id = t.exam_id
 		left join t_e_exam_activity teea on
 		teea.id = t.exam_activity_id
-		inner join (
-		select
-		toer.id
-		from
-		t_oe_exam_record toer
-		where
-		EXISTS(
-		select
-		tees.id
-		from
-		t_e_exam_student tees
-		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))) t1 on
-		t1.id = t.id
-		<where> 1 = 1
+		<where>
 			<if test="examId != null and examId != ''">
 				and t.exam_id = #{examId}
 			</if>
-			and s.enable = 1
-			and tee.enable = 1
-			and teea.enable = 1
+			<if test="userId != null and userId != ''">
+				and exists (select tbeiu.exam_id from t_b_exam_invigilate_user tbeiu
+				where tbeiu.user_id = #{userId}
+				and tbeiu.exam_id = t.exam_id and tbeiu.room_code = s.room_code)
+			</if>
 			and (t.status <![CDATA[ <> ]]> 'PERSISTED' and t.status <![CDATA[ <> ]]> 'FINISHED')
 		</where> ) t
 		group by
@@ -793,7 +722,7 @@
 		left join t_e_exam h on f.exam_id=h.id
 		where f.client_websocket_status='ON_LINE'
 		<if test="orgId != null">
-		 	and h.org_id=#{orgId}
+			and h.org_id=#{orgId}
 		</if>
 	</select>
 	<select id="getExamingCount" resultType="java.lang.Long">
@@ -801,35 +730,35 @@
 		left join t_e_exam h on f.exam_id=h.id
 		where f.status != 'FINISHED' and f.status != 'PERSISTED' and f.client_websocket_status='ON_LINE'
 		<if test="orgId != null">
-		 	and h.org_id=#{orgId}
+			and h.org_id=#{orgId}
 		</if>
 	</select>
 	<select id="getExceptionCount" resultType="java.lang.Long">
-			SELECT
-			count(DISTINCT(f.id))
+		SELECT
+		count(DISTINCT(f.id))
 		FROM
-			t_oe_exam_record f
+		t_oe_exam_record f
 		LEFT JOIN t_ie_invigilate_exception_info t ON f.id = t.exam_record_id
 		left join t_e_exam h on f.exam_id=h.id
 		WHERE
-			f. STATUS != 'FINISHED'
+		f. STATUS != 'FINISHED'
 		<if test="orgId != null">
-		 	and h.org_id=#{orgId}
+			and h.org_id=#{orgId}
 		</if>
 		AND f. STATUS != 'PERSISTED'
 		AND t.id IS NOT NULL
 	</select>
 	<select id="getWarnCount" resultType="java.lang.Long">
 		SELECT
-			count(DISTINCT(f.id))
+		count(DISTINCT(f.id))
 		FROM
-			t_oe_exam_record f
+		t_oe_exam_record f
 		LEFT JOIN t_ie_invigilate_warn_info t ON f.id = t.exam_record_id
 		left join t_e_exam h on f.exam_id=h.id
 		WHERE
-			f. STATUS != 'FINISHED'
+		f. STATUS != 'FINISHED'
 		<if test="orgId != null">
-		 	and h.org_id=#{orgId}
+			and h.org_id=#{orgId}
 		</if>
 		AND f. STATUS != 'PERSISTED'
 		AND t.type!='NONE'
@@ -839,92 +768,92 @@
 		SELECT
 		o. NAME orgName,
 		tem.cc count
-	FROM
+		FROM
 		(
-			SELECT
-				h.org_id orgId,
-				count(DISTINCT(h.id)) cc
-			FROM
-				t_oe_exam_record f
-			LEFT JOIN t_e_exam_student t ON f.exam_student_id = t.id
-			LEFT JOIN t_e_student h ON t.student_id = h.id
-			WHERE
-				f. STATUS != 'FINISHED'
-			<if test="orgId != null">
-			 	and h.org_id=#{orgId}
-			</if>
-			AND f. STATUS != 'PERSISTED'
-			AND f.client_websocket_status='ON_LINE'
-			GROUP BY
-				h.org_id
+		SELECT
+		h.org_id orgId,
+		count(DISTINCT(h.id)) cc
+		FROM
+		t_oe_exam_record f
+		LEFT JOIN t_e_exam_student t ON f.exam_student_id = t.id
+		LEFT JOIN t_e_student h ON t.student_id = h.id
+		WHERE
+		f. STATUS != 'FINISHED'
+		<if test="orgId != null">
+			and h.org_id=#{orgId}
+		</if>
+		AND f. STATUS != 'PERSISTED'
+		AND f.client_websocket_status='ON_LINE'
+		GROUP BY
+		h.org_id
 		) tem
-	LEFT JOIN t_b_org o ON o.id = tem.orgId
+		LEFT JOIN t_b_org o ON o.id = tem.orgId
 	</select>
 	<select id="getOrgDistribution" resultType="java.util.Map">
 		SELECT
 		o. NAME orgName,
 		tem.cc count
 		FROM
-			(
-				SELECT
-					h.org_id orgId,
-					count(DISTINCT(w.id)) cc
-				FROM
-					t_oe_exam_record f
-				LEFT JOIN t_ie_invigilate_warn_info w ON f.id = w.exam_record_id
-				LEFT JOIN t_e_exam_student t ON f.exam_student_id = t.id
-				LEFT JOIN t_e_student h ON t.student_id = h.id
-				WHERE
-					f. STATUS != 'FINISHED'
-				<if test="orgId != null">
-				 	and h.org_id=#{orgId}
-				</if>
-				AND f. STATUS != 'PERSISTED'
-				AND w.id IS NOT NULL
-				AND w.type!='NONE'
-				GROUP BY
-					h.org_id
-			) tem
+		(
+		SELECT
+		h.org_id orgId,
+		count(DISTINCT(w.id)) cc
+		FROM
+		t_oe_exam_record f
+		LEFT JOIN t_ie_invigilate_warn_info w ON f.id = w.exam_record_id
+		LEFT JOIN t_e_exam_student t ON f.exam_student_id = t.id
+		LEFT JOIN t_e_student h ON t.student_id = h.id
+		WHERE
+		f. STATUS != 'FINISHED'
+		<if test="orgId != null">
+			and h.org_id=#{orgId}
+		</if>
+		AND f. STATUS != 'PERSISTED'
+		AND w.id IS NOT NULL
+		AND w.type!='NONE'
+		GROUP BY
+		h.org_id
+		) tem
 		LEFT JOIN t_b_org o ON o.id = tem.orgId
 	</select>
 	<select id="getTypeDistribution" resultType="java.util.Map">
 		SELECT
-			w.type type,
-			count(DISTINCT(w.id)) count
+		w.type type,
+		count(DISTINCT(w.id)) count
 		FROM
-			t_oe_exam_record f
+		t_oe_exam_record f
 		LEFT JOIN t_ie_invigilate_warn_info w ON f.id = w.exam_record_id
 		left join t_e_exam h on f.exam_id=h.id
 		WHERE
-			f. STATUS != 'FINISHED'
+		f. STATUS != 'FINISHED'
 		<if test="orgId != null">
-		 	and h.org_id=#{orgId}
+			and h.org_id=#{orgId}
 		</if>
 		AND f. STATUS != 'PERSISTED'
 		AND w.id IS NOT NULL
 		AND w.type!='NONE'
 		GROUP BY
-			w.type
+		w.type
 	</select>
-	<select id="getWarnTrend" resultType="com.qmth.themis.business.bean.backend.ExaminationMonitorHourWarnCountBean">
-			SELECT
-			FROM_UNIXTIME(w.create_time / 1000,'%H') hour,
-			count(1) count
-		FROM  t_ie_invigilate_warn_info w 
+	<select id="getWarnTrend" resultType="com.qmth.themis.business.bean.admin.ExaminationMonitorHourWarnCountBean">
+		SELECT
+		FROM_UNIXTIME(w.create_time / 1000,'%H') hour,
+		count(1) count
+		FROM  t_ie_invigilate_warn_info w
 		left join t_e_exam h on w.exam_id=h.id
 		WHERE w.type!='NONE' and w.create_time&gt;=#{startTime}
 		<if test="orgId != null">
-		 	and h.org_id=#{orgId}
+			and h.org_id=#{orgId}
 		</if>
 		GROUP BY
-			FROM_UNIXTIME(w.create_time / 1000,'%H')
+		FROM_UNIXTIME(w.create_time / 1000,'%H')
 	</select>
 
 	<update id="updateHasAnswerFile">
 		update t_oe_exam_record t set t.has_answer_file=#{hasAnswerFile} where t.id=#{recordId}
 	</update>
 
-	<select id="findExamRecordNeedMark" resultType="com.qmth.themis.business.bean.backend.OpenRecordNeedMarkBean">
+	<select id="findExamRecordNeedMark" resultType="com.qmth.themis.business.bean.admin.OpenRecordNeedMarkBean">
 		SELECT
 		t.id examRecordId,
 		t.exam_student_id examStudentId,
@@ -942,17 +871,17 @@
 		LEFT JOIN t_e_exam_activity g ON t.exam_activity_id = g.id
 		where t.exam_id=#{examId} and t.breach_status!=1 and t.exam_student_id in
 		<foreach collection="examStudentIds" item="examStudentId"
-			index="index" open="(" close=")" separator=",">
+				 index="index" open="(" close=")" separator=",">
 			#{examStudentId}
 		</foreach>
 	</select>
 
 	<select id="findMaxObjectiveScore" resultType="com.qmth.themis.business.entity.TOeExamRecord">
 		select
-			max(toer.objective_score) as objectiveScore,
-			toer.id,toer.paper_id as paperId,toer.finish_time as finishTime
+		max(toer.objective_score) as objectiveScore,
+		toer.id,toer.paper_id as paperId,toer.finish_time as finishTime
 		from
-			t_oe_exam_record toer
+		t_oe_exam_record toer
 		<where>
 			(toer.breach_status = 1
 			or breach_status is null)
@@ -966,6 +895,6 @@
 			</if>
 		</where>
 		group by
-			toer.id,toer.paper_id,toer.finish_time order by toer.objective_score desc,toer.finish_time desc
+		toer.id,toer.paper_id,toer.finish_time order by toer.objective_score desc,toer.finish_time desc
 	</select>
-</mapper>
+</mapper>