|
@@ -31,7 +31,8 @@
|
|
|
p.create_by,
|
|
|
p.create_time,
|
|
|
p.question_count,
|
|
|
- p.has_subjective
|
|
|
+ p.has_subjective,
|
|
|
+ <include refid="stateCondition" />
|
|
|
FROM exam e
|
|
|
LEFT JOIN paper p on e.paper_id = p.id
|
|
|
<where>
|
|
@@ -63,6 +64,7 @@
|
|
|
<result column="image" property="image" jdbcType="VARCHAR"/>
|
|
|
<result column="exam_result_showtype" property="examResultShowtype" jdbcType="INTEGER"/>
|
|
|
<result column="show_deadline" property="showDeadline" jdbcType="INTEGER"/>
|
|
|
+ <result column="state" property="state" jdbcType="INTEGER"/>
|
|
|
|
|
|
<association property="paper" javaType="com.ynfy.buss.exam.paper.entity.Paper">
|
|
|
<id column="paper_id" property="id" jdbcType="VARCHAR"/>
|
|
@@ -89,7 +91,8 @@
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
- *
|
|
|
+ *,
|
|
|
+ <include refid="stateCondition" />
|
|
|
FROM exam
|
|
|
WHERE
|
|
|
open_type = 1
|
|
@@ -97,7 +100,8 @@
|
|
|
<when test="user!=null and user.orgCode!=null and user.orgCode!=''">
|
|
|
UNION
|
|
|
SELECT
|
|
|
- *
|
|
|
+ *,
|
|
|
+ <include refid="stateCondition" />
|
|
|
FROM exam
|
|
|
WHERE
|
|
|
open_type = 2
|
|
@@ -106,7 +110,8 @@
|
|
|
<when test="user!=null and user.username!=null and user.username!=''">
|
|
|
UNION
|
|
|
SELECT
|
|
|
- *
|
|
|
+ *,
|
|
|
+ <include refid="stateCondition" />
|
|
|
FROM exam
|
|
|
WHERE
|
|
|
open_type = 3
|
|
@@ -119,7 +124,7 @@
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
exam_id,
|
|
|
- COUNT ( * ) AS try_count
|
|
|
+ COUNT(*) AS try_count
|
|
|
FROM
|
|
|
user_exam uer
|
|
|
WHERE
|
|
@@ -138,6 +143,9 @@
|
|
|
<if test="exam.openType!=null">
|
|
|
AND tmp1.open_type = #{exam.openType}
|
|
|
</if>
|
|
|
+ <if test="exam.state!=null">
|
|
|
+ AND tmp1.state = #{exam.state}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
@@ -182,4 +190,12 @@
|
|
|
LIMIT #{limit}
|
|
|
</if>
|
|
|
</select>
|
|
|
+ <sql id="stateCondition">
|
|
|
+ CASE
|
|
|
+ WHEN NOW() < START_TIME THEN 2
|
|
|
+ WHEN NOW() > end_TIME THEN 3
|
|
|
+ WHEN NOW() > START_TIME AND NOW() < end_TIME THEN 0
|
|
|
+ ELSE NULL
|
|
|
+ END AS state
|
|
|
+ </sql>
|
|
|
</mapper>
|