<?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.ycl.jxkg.mapper.ExamPaperMapper">
|
<resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.entity.ExamPaper">
|
<id column="id" property="id"/>
|
<result column="name" property="name"/>
|
<result column="paper_type" property="paperType"/>
|
<result column="score" property="score"/>
|
<result column="question_count" property="questionCount"/>
|
<result column="suggest_time" property="suggestTime"/>
|
<result column="visibility" property="visibility"/>
|
<result column="deduct_type" property="deductType"/>
|
<result column="deduct_type_score" property="deductTypeScore"/>
|
<result column="content" property="content"/>
|
<result column="create_user" property="createUser"/>
|
<result column="create_time" property="createTime"/>
|
<result column="deleted" property="deleted"/>
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
id, name, paper_type, score, question_count, suggest_time,visibility
|
,deduct_type,deduct_type_score,create_user, create_time,deleted
|
</sql>
|
|
<resultMap id="PaperInfoResultMap" type="com.ycl.jxkg.domain.vo.student.dashboard.PaperInfo">
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
|
</resultMap>
|
|
|
<select id="page" resultMap="BaseResultMap">
|
SELECT
|
tep.*
|
FROM t_exam_paper tep
|
<where>
|
and tep.deleted=0 and (create_user = #{createUser} or visibility = 'Public')
|
<if test="id != null ">
|
and tep.id= #{id}
|
</if>
|
<if test="name != null and name != ''">
|
and tep.name like concat('%',#{name},'%')
|
</if>
|
<if test="paperType != null ">
|
and tep.paper_type= #{paperType}
|
</if>
|
</where>
|
</select>
|
|
<select id="taskExamPage" resultMap="BaseResultMap"
|
parameterType="com.ycl.jxkg.domain.vo.admin.exam.ExamPaperPageRequestVO">
|
SELECT
|
<include refid="Base_Column_List"/>
|
FROM t_exam_paper
|
<where>
|
and deleted=0
|
and paper_type=#{paperType}
|
</where>
|
</select>
|
|
<select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.domain.vo.student.exam.ExamPaperPageVO">
|
SELECT
|
<include refid="Base_Column_List"/>
|
FROM t_exam_paper
|
<where>
|
and deleted=0
|
<if test="levelId != null ">
|
and grade_level=#{levelId}
|
</if>
|
and paper_type=#{paperType}
|
</where>
|
</select>
|
|
<select id="indexPaper" resultMap="PaperInfoResultMap"
|
parameterType="com.ycl.jxkg.domain.vo.student.dashboard.PaperFilter">
|
SELECT id,name,limit_start_time,limit_end_time
|
FROM t_exam_paper
|
<where>
|
and deleted=0
|
and paper_type= #{examPaperType}
|
and grade_level=#{gradeLevel}
|
<if test="examPaperType == 3 ">
|
</if>
|
<if test="examPaperType == 4 ">
|
and #{dateTime} between limit_start_time and limit_end_time
|
</if>
|
</where>
|
ORDER BY id desc limit 5
|
</select>
|
|
<select id="selectAllCount" resultType="java.lang.Integer">
|
SELECT count(*)
|
from t_exam_paper
|
where deleted = 0
|
</select>
|
|
<select id="selectCountByDate" resultType="com.ycl.jxkg.domain.other.KeyValue">
|
SELECT create_time as name, COUNT(create_time) as value
|
from
|
(
|
SELECT DATE_FORMAT(create_time, '%Y-%m-%d') as create_time from t_exam_paper
|
WHERE deleted=0 and create_time between #{startTime} and #{endTime}
|
) a
|
GROUP BY create_time
|
</select>
|
|
<update id="updateTaskPaper">
|
update t_exam_paper set task_exam_id = #{taskId} where id in
|
<foreach item="id" collection="paperIds" open="(" separator=","
|
close=")">
|
#{id}
|
</foreach>
|
</update>
|
|
<update id="clearTaskPaper" parameterType="java.util.List">
|
update t_exam_paper set task_exam_id = null where id in
|
<foreach item="id" collection="paperIds" open="(" separator=","
|
close=")">
|
#{id}
|
</foreach>
|
</update>
|
|
</mapper>
|