|
@@ -3,13 +3,10 @@
|
|
|
<mapper namespace="com.qmth.themis.business.dao.TEExamActivityMapper">
|
|
|
|
|
|
<select id="existTable" resultType="java.lang.Integer">
|
|
|
- select
|
|
|
- count(*)
|
|
|
- from
|
|
|
- information_schema.TABLES
|
|
|
- where
|
|
|
- LCASE(TABLE_NAME)= #{tableName}
|
|
|
- and TABLE_SCHEMA = #{schema}
|
|
|
+ select count(*)
|
|
|
+ from information_schema.TABLES
|
|
|
+ where LCASE(TABLE_NAME) = #{tableName}
|
|
|
+ and TABLE_SCHEMA = #{schema}
|
|
|
</select>
|
|
|
|
|
|
<update id="dropTable">
|
|
@@ -17,46 +14,48 @@
|
|
|
</update>
|
|
|
|
|
|
<update id="createNewTable">
|
|
|
- CREATE TABLE ${tableName} (
|
|
|
- `id` bigint NOT NULL COMMENT '主键',
|
|
|
- `exam_id` bigint NOT NULL COMMENT '批次id',
|
|
|
- `code` varchar(50) NOT NULL COMMENT '场次代码',
|
|
|
- `prepare_seconds` int NOT NULL COMMENT '提前多长时间开始候考(秒)',
|
|
|
- `max_duration_seconds` int DEFAULT NULL COMMENT '最大考试时长',
|
|
|
- `enable` tinyint DEFAULT '1' COMMENT '是否启用',
|
|
|
- `opening_seconds` int DEFAULT NULL COMMENT '允许开考时长(秒)',
|
|
|
- `start_time` bigint DEFAULT NULL COMMENT '开考时间',
|
|
|
- `finish_time` bigint DEFAULT NULL COMMENT '结束时间',
|
|
|
- `create_time` bigint DEFAULT NULL COMMENT '创建时间',
|
|
|
- `update_time` bigint DEFAULT NULL COMMENT '更新时间',
|
|
|
- `create_id` bigint DEFAULT NULL COMMENT '创建人id',
|
|
|
- `update_id` bigint DEFAULT NULL COMMENT '更新人id',
|
|
|
- PRIMARY KEY (`id`),
|
|
|
- UNIQUE KEY `${tableName}_examId_code_Idx` (`exam_id`,`code`)
|
|
|
+ CREATE TABLE ${tableName}
|
|
|
+ (
|
|
|
+ `id` bigint NOT NULL COMMENT '主键',
|
|
|
+ `exam_id` bigint NOT NULL COMMENT '批次id',
|
|
|
+ `code` varchar(50) NOT NULL COMMENT '场次代码',
|
|
|
+ `prepare_seconds` int NOT NULL COMMENT '提前多长时间开始候考(秒)',
|
|
|
+ `max_duration_seconds` int DEFAULT NULL COMMENT '最大考试时长',
|
|
|
+ `enable` tinyint DEFAULT '1' COMMENT '是否启用',
|
|
|
+ `opening_seconds` int DEFAULT NULL COMMENT '允许开考时长(秒)',
|
|
|
+ `start_time` bigint DEFAULT NULL COMMENT '开考时间',
|
|
|
+ `finish_time` bigint DEFAULT NULL COMMENT '结束时间',
|
|
|
+ `create_time` bigint DEFAULT NULL COMMENT '创建时间',
|
|
|
+ `update_time` bigint DEFAULT NULL COMMENT '更新时间',
|
|
|
+ `create_id` bigint DEFAULT NULL COMMENT '创建人id',
|
|
|
+ `update_id` bigint DEFAULT NULL COMMENT '更新人id',
|
|
|
+ PRIMARY KEY (`id`),
|
|
|
+ UNIQUE KEY `${tableName}_examId_code_Idx` (`exam_id`,`code`)
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='考试场次'
|
|
|
</update>
|
|
|
|
|
|
<insert id="insertInfo" parameterType="com.qmth.themis.business.entity.TEExamActivity">
|
|
|
INSERT INTO ${tableName}
|
|
|
- (id, exam_id, code, prepare_seconds, max_duration_seconds, enable, opening_seconds, start_time, finish_time, create_time, update_time, create_id, update_id)
|
|
|
- VALUES(
|
|
|
- #{TEExamActivity.id},
|
|
|
- #{TEExamActivity.examId},
|
|
|
- #{TEExamActivity.code},
|
|
|
- #{TEExamActivity.prepareSeconds},
|
|
|
- #{TEExamActivity.maxDurationSeconds},
|
|
|
- #{TEExamActivity.enable},
|
|
|
- #{TEExamActivity.openingSeconds},
|
|
|
- #{TEExamActivity.startTime},
|
|
|
- #{TEExamActivity.finishTime},
|
|
|
- #{TEExamActivity.createTime},
|
|
|
- #{TEExamActivity.updateTime},
|
|
|
- #{TEExamActivity.createId},
|
|
|
- #{TEExamActivity.updateId})
|
|
|
+ (id, exam_id, code, prepare_seconds, max_duration_seconds, enable, opening_seconds, start_time, finish_time,
|
|
|
+ create_time, update_time, create_id, update_id)
|
|
|
+ VALUES (#{TEExamActivity.id},
|
|
|
+ #{TEExamActivity.examId},
|
|
|
+ #{TEExamActivity.code},
|
|
|
+ #{TEExamActivity.prepareSeconds},
|
|
|
+ #{TEExamActivity.maxDurationSeconds},
|
|
|
+ #{TEExamActivity.enable},
|
|
|
+ #{TEExamActivity.openingSeconds},
|
|
|
+ #{TEExamActivity.startTime},
|
|
|
+ #{TEExamActivity.finishTime},
|
|
|
+ #{TEExamActivity.createTime},
|
|
|
+ #{TEExamActivity.updateTime},
|
|
|
+ #{TEExamActivity.createId},
|
|
|
+ #{TEExamActivity.updateId})
|
|
|
</insert>
|
|
|
|
|
|
<select id="selectListPage" resultType="com.qmth.themis.business.entity.TEExamActivity">
|
|
|
- select * from ${tableName}
|
|
|
+ select *
|
|
|
+ from ${tableName}
|
|
|
</select>
|
|
|
|
|
|
<select id="examActivityQuery" resultType="com.qmth.themis.business.dto.response.TEExamActivityQueryDto">
|
|
@@ -113,16 +112,17 @@
|
|
|
</select>
|
|
|
|
|
|
<sql id="getWaitingHeadCommon">
|
|
|
- select
|
|
|
- teea.id,
|
|
|
- teea.code,
|
|
|
- (teea.start_time / 1000 - IFNULL(teea.prepare_seconds, tee.prepare_seconds)) * 1000 as prepareTime,
|
|
|
- IFNULL(teea.start_time, tee.start_time) as minStartTime,
|
|
|
- (teea.start_time / 1000 + IFNULL(teea.opening_seconds, tee.opening_seconds)) * 1000 as maxStartTime,
|
|
|
- IF(tee.mode = 'TOGETHER' and tee.force_finish = 1, IFNULL(teea.finish_time , tee.end_time), null) as maxFinishTime,
|
|
|
- tee.min_duration_seconds as minDurationSeconds,
|
|
|
- IFNULL(teea.max_duration_seconds,tee.max_duration_seconds) as maxDurationSeconds,
|
|
|
- tee.id as examId
|
|
|
+ select teea.id,
|
|
|
+ teea.code,
|
|
|
+ (teea.start_time / 1000 - IFNULL(teea.prepare_seconds, tee.prepare_seconds)) * 1000 as prepareTime,
|
|
|
+ IFNULL(teea.start_time, tee.start_time) as minStartTime,
|
|
|
+ (teea.start_time / 1000 + IFNULL(teea.opening_seconds, tee.opening_seconds)) *
|
|
|
+ 1000 as maxStartTime,
|
|
|
+ IF(tee.mode = 'TOGETHER' and tee.force_finish = 1, IFNULL(teea.finish_time, tee.end_time),
|
|
|
+ null) as maxFinishTime,
|
|
|
+ tee.min_duration_seconds as minDurationSeconds,
|
|
|
+ IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) as maxDurationSeconds,
|
|
|
+ tee.id as examId
|
|
|
</sql>
|
|
|
|
|
|
<select id="getWaitingExam" resultType="com.qmth.themis.business.dto.response.TEExamActivityWaitDto">
|
|
@@ -136,7 +136,7 @@
|
|
|
tee.id = tees.exam_id
|
|
|
left join t_e_exam_activity teea on
|
|
|
teea.id = tees.exam_activity_id
|
|
|
- <where> 1 = 1
|
|
|
+ <where>1 = 1
|
|
|
and teea.id in
|
|
|
<foreach collection="examActivityIds" item="examActivityId" index="index" open="(" close=")" separator=",">
|
|
|
#{examActivityId}
|
|
@@ -180,8 +180,8 @@
|
|
|
from
|
|
|
t_e_exam_activity teea
|
|
|
left join t_e_exam tee on
|
|
|
- tee.id = teea.exam_id
|
|
|
- <where> 1 = 1
|
|
|
+ tee.id = teea.exam_id
|
|
|
+ <where>1 = 1
|
|
|
<if test="examActivityId != null and examActivityId != ''">
|
|
|
and teea.id = #{examActivityId}
|
|
|
</if>
|
|
@@ -198,16 +198,21 @@
|
|
|
and f.org_id=#{orgId}
|
|
|
</if>
|
|
|
</select>
|
|
|
-
|
|
|
- <select id="findMinStartTimeAndMaxFinshTimeByExamId" resultType="java.util.Map" >
|
|
|
- select min(t.start_time) startTime,max(t.finish_time) finishTime from t_e_exam_activity t
|
|
|
- where t.exam_id=#{examId} and t.enable=1
|
|
|
+
|
|
|
+ <select id="findMinStartTimeAndMaxFinshTimeByExamId" resultType="java.util.Map">
|
|
|
+ select min(t.start_time) startTime, max(t.finish_time) finishTime
|
|
|
+ from t_e_exam_activity t
|
|
|
+ where t.exam_id = #{examId}
|
|
|
+ and t.enable = 1
|
|
|
</select>
|
|
|
-
|
|
|
- <select id="findExamIdToday" resultType="java.lang.Long" >
|
|
|
- select distinct t.exam_id from t_e_exam_activity t
|
|
|
- left join t_e_exam f on t.exam_id=f.id
|
|
|
- where t.start_time>=#{startTime} and t.start_time<=#{endTime} and t.enable=1 and f.enable=1
|
|
|
+
|
|
|
+ <select id="findExamIdToday" resultType="java.lang.Long">
|
|
|
+ select distinct t.exam_id
|
|
|
+ from t_e_exam_activity t
|
|
|
+ left join t_e_exam f on t.exam_id = f.id
|
|
|
+ where t.start_time >= #{startTime}
|
|
|
+ and t.start_time <= #{endTime}
|
|
|
+ and t.enable = 1
|
|
|
+ and f.enable = 1
|
|
|
</select>
|
|
|
-
|
|
|
</mapper>
|