wangliang 4 éve
szülő
commit
96cb5bce98
1 módosított fájl, 142 hozzáadás és 128 törlés
  1. 142 128
      themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

+ 142 - 128
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper
-	namespace="com.qmth.themis.business.dao.TOeExamRecordMapper">
+		namespace="com.qmth.themis.business.dao.TOeExamRecordMapper">
 
 	<select id="getUnFinishExam"
-		resultType="com.qmth.themis.business.dto.response.TEExamUnFinishDto">
+			resultType="com.qmth.themis.business.dto.response.TEExamUnFinishDto">
 		select
 		tee.id,
 		teea.id as examActivityId,
@@ -133,7 +133,14 @@
 				and s.room_code = #{roomCode}
 			</if>
 			<if test="status != null and status != ''">
-				and t.status = #{status}
+				<choose>
+					<when test="status == 'EXAMING'">
+						and (t.status = 'ANSWERING' or t.status = 'RESUME_PREPARE')
+					</when>
+					<otherwise>
+						and t.status = #{status}
+					</otherwise>
+				</choose>
 			</if>
 			<if test="name != null and name !=''">
 				and s.name like CONCAT('%', #{name},'%')
@@ -169,7 +176,14 @@
 				and s.room_code = #{roomCode}
 			</if>
 			<if test="status != null and status != ''">
-				and t.status = #{status}
+				<choose>
+					<when test="status == 'EXAMING'">
+						and (t.status = 'ANSWERING' or t.status = 'RESUME_PREPARE')
+					</when>
+					<otherwise>
+						and t.status = #{status}
+					</otherwise>
+				</choose>
 			</if>
 			<if test="name != null and name !=''">
 				and s.name like CONCAT('%', #{name},'%')
@@ -190,29 +204,29 @@
 	</sql>
 
 	<select id="invigilatePageList" resultType="com.qmth.themis.business.bean.backend.InvigilateListBean">
-        select
-        (@i := @i + 1) as seq,
-        t.*
-        from
-        (
-        <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
+		select
+		(@i := @i + 1) as seq,
+		t.*
+		from
+		(
+		<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="invigilatePageMiddle"/>
 		<include refid="invigilatePageFoot"/>
-        <if test="paperDownload != null and paperDownload != '' or paperDownload == 0">
-            and t.paper_download = #{paperDownload}
-        </if>
+		<if test="paperDownload != null and paperDownload != '' or paperDownload == 0">
+			and t.paper_download = #{paperDownload}
+		</if>
 		<if test="status == null or status == ''">
 			and (t.status = 'FIRST_PREPARE' or t.status = 'ANSWERING' or t.status = 'BREAK_OFF' or t.status = 'RESUME_PREPARE')
 		</if>
-        ) t,
-        (SELECT @i := 0) as i
+		) t,
+		(SELECT @i := 0) as i
 		order by t.warningNew desc
 	</select>
 
@@ -254,9 +268,9 @@
 		end as remainTime
 		<include refid="invigilatePageMiddle" />
 		<where> 1 = 1
-		<if test="examId != null and examId != ''">
-			and t.exam_id = #{examId}
-		</if>
+			<if test="examId != null and examId != ''">
+				and t.exam_id = #{examId}
+			</if>
 			and (t.status = 'FIRST_PREPARE' or t.status = 'ANSWERING' or t.status = 'BREAK_OFF' or t.status = 'RESUME_PREPARE')
 		</where>
 		ORDER BY RAND() LIMIT #{randomNum}
@@ -274,9 +288,9 @@
 		end as remainTime
 		<include refid="invigilatePageMiddle" />
 		<include refid="invigilatePageFoot" />
-			<if test="status == null or status == ''">
-				and (t.status = 'FIRST_PREPARE' or t.status = 'ANSWERING' or t.status = 'BREAK_OFF' or t.status = 'RESUME_PREPARE')
-			</if>
+		<if test="status == null or status == ''">
+			and (t.status = 'FIRST_PREPARE' or t.status = 'ANSWERING' or t.status = 'BREAK_OFF' or t.status = 'RESUME_PREPARE')
+		</if>
 		) t,(SELECT @i := 0) as i
 		<where>
 			<if test="minMultipleFaceCount != null and minMultipleFaceCount != '' or minMultipleFaceCount == 0">
@@ -383,88 +397,88 @@
 	<update id="approveStatusListUpdate">
 		update t_ie_invigilate_warn_info tiiwi set tiiwi.approve_status = 1
 		where exists(
-			select t.warningId from(select
-			tiiwi.id as warningId,
-			tee.id as examId,
-			tee.name as examName,
-			teea.id as examActivityId,
-			tees.id as examStudentId,
-			teea.code as examActivityCode,
-			tees.room_code as roomCode,
-			tees.room_name as roomName,
-			toer.id as examRecordId,
-			tees.`identity`,
-			tees.name,
-			tees.course_code as courseCode,
-			tees.course_name as courseName,
-			toer.status as statusCode,
-			IFNULL(toer.warning_count,0) as warningCount,
-			IFNULL(toer.breach_status,1) as breachStatus,
-			toer.client_last_sync_time as updateTime,
-			tiiwi.approve_status as approveStatus
-			,(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 exceptionCount
-			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 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>
-				<if test="examId != null and examId != ''">
-					and tiiwi.exam_id = #{examId}
-				</if>
-				<if test="examActivityId != null and examActivityId != ''">
-					and tiiwi.exam_activity_id = #{examActivityId}
-				</if>
-				<if test="roomCode != null and roomCode != ''">
-					and tees.room_code = #{roomCode}
-				</if>
-				<if test="approveStatus != null and approveStatus != '' or approveStatus == 0">
-					and tiiwi.approve_status = #{approveStatus}
-				</if>
-				<if test="name != null and name !=''">
-					and tees.name like CONCAT('%', #{name},'%')
-				</if>
-				<if test="identity != null and identity !=''">
-					and tees.identity like CONCAT('%', #{identity},'%')
-				</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>
-				and tee.enable = 1
-				and teea.enable = 1
-			</where>
-			) t
-			<where> 1 = 1
-				<if test="minMultipleFaceCount != null and minMultipleFaceCount != '' or minMultipleFaceCount == 0">
-					and t.multipleFaceCount &gt;= #{minMultipleFaceCount}
-				</if>
-				<if test="maxMultipleFaceCount != null and maxMultipleFaceCount != '' or maxMultipleFaceCount == 0">
-					and t.multipleFaceCount &lt;= #{maxMultipleFaceCount}
-				</if>
-				<if test="minExceptionCount != null and minExceptionCount != '' or minExceptionCount == 0">
-					and t.exceptionCount &gt;= #{minExceptionCount}
-				</if>
-				<if test="maxExceptionCount != null and maxExceptionCount != '' or maxExceptionCount == 0">
-					and t.exceptionCount &lt;= #{maxExceptionCount}
-				</if>
-			</where>
-		 		 and t.warningId = tiiwi.id)
+		select t.warningId from(select
+		tiiwi.id as warningId,
+		tee.id as examId,
+		tee.name as examName,
+		teea.id as examActivityId,
+		tees.id as examStudentId,
+		teea.code as examActivityCode,
+		tees.room_code as roomCode,
+		tees.room_name as roomName,
+		toer.id as examRecordId,
+		tees.`identity`,
+		tees.name,
+		tees.course_code as courseCode,
+		tees.course_name as courseName,
+		toer.status as statusCode,
+		IFNULL(toer.warning_count,0) as warningCount,
+		IFNULL(toer.breach_status,1) as breachStatus,
+		toer.client_last_sync_time as updateTime,
+		tiiwi.approve_status as approveStatus
+		,(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 exceptionCount
+		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 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>
+			<if test="examId != null and examId != ''">
+				and tiiwi.exam_id = #{examId}
+			</if>
+			<if test="examActivityId != null and examActivityId != ''">
+				and tiiwi.exam_activity_id = #{examActivityId}
+			</if>
+			<if test="roomCode != null and roomCode != ''">
+				and tees.room_code = #{roomCode}
+			</if>
+			<if test="approveStatus != null and approveStatus != '' or approveStatus == 0">
+				and tiiwi.approve_status = #{approveStatus}
+			</if>
+			<if test="name != null and name !=''">
+				and tees.name like CONCAT('%', #{name},'%')
+			</if>
+			<if test="identity != null and identity !=''">
+				and tees.identity like CONCAT('%', #{identity},'%')
+			</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>
+			and tee.enable = 1
+			and teea.enable = 1
+		</where>
+		) t
+		<where> 1 = 1
+			<if test="minMultipleFaceCount != null and minMultipleFaceCount != '' or minMultipleFaceCount == 0">
+				and t.multipleFaceCount &gt;= #{minMultipleFaceCount}
+			</if>
+			<if test="maxMultipleFaceCount != null and maxMultipleFaceCount != '' or maxMultipleFaceCount == 0">
+				and t.multipleFaceCount &lt;= #{maxMultipleFaceCount}
+			</if>
+			<if test="minExceptionCount != null and minExceptionCount != '' or minExceptionCount == 0">
+				and t.exceptionCount &gt;= #{minExceptionCount}
+			</if>
+			<if test="maxExceptionCount != null and maxExceptionCount != '' or maxExceptionCount == 0">
+				and t.exceptionCount &lt;= #{maxExceptionCount}
+			</if>
+		</where>
+		and t.warningId = tiiwi.id)
 	</update>
 
 	<select id="invigilatePageProgressList" resultType="com.qmth.themis.business.bean.backend.InvigilateListProgressBean">
@@ -590,7 +604,7 @@
 		<include refid="invigilatePageHistoryFoot" />
 		<if test="breachStatus != null and breachStatus != '' or breachStatus == 0">
 			<if test="breachStatus == 0">
-			 	and t.breach_status = #{breachStatus}
+				and t.breach_status = #{breachStatus}
 			</if>
 			<if test="breachStatus == 1">
 				and (t.breach_status = #{breachStatus} or t.breach_status is null)
@@ -672,7 +686,7 @@
 	<update id="updateObjectiveScore">
 		update t_oe_exam_record t set t.objective_score=#{score} where t.id=#{recordId}
 	</update>
-	
+
 	<select id="findOneByPaperId" resultType="com.qmth.themis.business.entity.TOeExamRecord">
 		select f.* from t_oe_exam_record f
 		where f.paper_id = #{paperId}
@@ -838,30 +852,30 @@
 		GROUP BY
 			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
-				t.id,
-				f.identity,
-				f.NAME,
-				g.CODE activityCode,
-				f.course_code courseCode,
-				f.course_name courseName,
-				t.paper_id paperId,
-				t.objective_score objectiveScore
-			FROM
-				t_oe_exam_record t
-			LEFT JOIN t_e_exam_student f ON t.exam_student_id = f.id
-			LEFT JOIN t_e_exam_activity g ON t.exam_activity_id = g.id
-			where t.exam_id=#{examId} and t.id&gt;#{idGt} 
-			<if test="courseCode != null and courseCode != ''">
+		SELECT
+		t.id,
+		f.identity,
+		f.NAME,
+		g.CODE activityCode,
+		f.course_code courseCode,
+		f.course_name courseName,
+		t.paper_id paperId,
+		t.objective_score objectiveScore
+		FROM
+		t_oe_exam_record t
+		LEFT JOIN t_e_exam_student f ON t.exam_student_id = f.id
+		LEFT JOIN t_e_exam_activity g ON t.exam_activity_id = g.id
+		where t.exam_id=#{examId} and t.id&gt;#{idGt}
+		<if test="courseCode != null and courseCode != ''">
 			and f.course_code=#{courseCode}
-			</if>
-			order by t.id
-			limit #{count}
+		</if>
+		order by t.id
+		limit #{count}
 	</select>
 </mapper>