165 lines
6.2 KiB
XML
165 lines
6.2 KiB
XML
<?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="UnivExam">
|
|
|
|
<insert id="insertUnivExam" parameterType="UnivExam">
|
|
INSERT INTO UnivExam ( examId, examType, isRecommend, title, description,
|
|
examPaperCount, examPapers, created, startTime, endTime, isNetExam ,teacherId,isOral )
|
|
Values ( #{examId}, #{examType}, #{isRecommend}, #{title}, #{description},
|
|
#{examPaperCount}, #{examPapers},current_timestamp, #{startTime},
|
|
#{endTime}, #{isNetExam} ,#{teacherId},#{isOral} )
|
|
</insert>
|
|
|
|
<update id="updateUnivExam" parameterType="UnivExam">
|
|
UPDATE UnivExam
|
|
SET examId = #{examId}, examType = #{examType},
|
|
isRecommend = #{isRecommend}, title = #{title},
|
|
description = #{description}, examPaperCount = #{examPaperCount},
|
|
examPapers = #{examPapers}, created = #{created},
|
|
startTime = #{startTime}, endTime = #{endTime},
|
|
isNetExam = #{isNetExam}
|
|
WHERE examId=#{examId}
|
|
</update>
|
|
|
|
<select id="getUnivExamByKey" parameterType="java.lang.Integer" resultType="UnivExam">
|
|
SELECT examId , examType , isRecommend , title , description ,
|
|
examPaperCount , examPapers , created , startTime , endTime ,
|
|
isNetExam
|
|
FROM UnivExam
|
|
WHERE examId=#{examId}
|
|
</select>
|
|
|
|
<select id="getSeqUnivExam" resultType="Integer" useCache="false" flushCache="true">
|
|
SELECT nextval('seq_univExamId')
|
|
</select>
|
|
|
|
<select id="getExamsCountBySchoolId" parameterType="java.util.Map" resultType="Integer">
|
|
SELECT COUNT(*)
|
|
FROM UnivOwnExam a
|
|
INNER join UnivExam b
|
|
ON a.schooId = #{schooId} and a.examId = b.examId
|
|
AND b.examType = #{examType}
|
|
WHERE
|
|
b.endTime <= #{endTime}
|
|
|
|
<if test="startTime!=null">
|
|
<![CDATA[
|
|
and b.startTime >= #{startTime}
|
|
]]>
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getExamsBySchoolId" parameterType="java.util.Map" resultType="UnivExam">
|
|
SELECT b.examId , b.examType , b.isRecommend , b.title , b.description ,
|
|
b.examPaperCount , b.examPapers , b.created , b.startTime ,
|
|
b.endTime , b.isNetExam
|
|
FROM UnivOwnExam a
|
|
INNER join UnivExam b
|
|
ON a.schooId = #{schooId} and a.examId = b.examId
|
|
AND b.examType = #{examType}
|
|
WHERE
|
|
b.endTime <= #{endTime}
|
|
|
|
<if test="startTime!=null">
|
|
<![CDATA[
|
|
and b.startTime >= #{startTime}
|
|
]]>
|
|
</if>
|
|
ORDER BY b.examId DESC
|
|
<if test="pageSize!=null">
|
|
LIMIT #{pageSize}
|
|
</if>
|
|
|
|
<if test="offset!=null">
|
|
OFFSET #{offset}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getUnivExamsCountByClassesId" parameterType="java.util.Map" resultType="Integer">
|
|
SELECT COUNT(*)
|
|
FROM UnivClassOwnExam a
|
|
INNER join UnivExam b
|
|
ON a.classesId = #{classesId} and a.examId = b.examId and a.objectType=#{objectType}
|
|
<if test="examType">
|
|
AND b.examType = #{examType}
|
|
</if>
|
|
WHERE
|
|
b.isOral = #{isOral}
|
|
<if test="endTime!=null">
|
|
and b.endTime <= #{endTime}
|
|
</if>
|
|
|
|
<if test="startTime!=null">
|
|
<![CDATA[
|
|
and b.startTime >= #{startTime}
|
|
]]>
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getUnivExamsByClassesId" parameterType="java.util.Map" resultType="UnivExam">
|
|
SELECT b.examId , b.examType , b.isRecommend , b.title , b.description ,
|
|
b.examPaperCount , b.examPapers , b.created , b.startTime , b.endTime , b.isNetExam ,b.isOral
|
|
FROM UnivClassOwnExam a
|
|
INNER join UnivExam b
|
|
ON a.classesId = #{classesId} and a.examId = b.examId and a.objectType=#{objectType}
|
|
<if test="examType">
|
|
AND b.examType = #{examType}
|
|
</if>
|
|
WHERE
|
|
b.isOral = #{isOral}
|
|
<if test="endTime!=null">
|
|
and b.endTime <= #{endTime}
|
|
</if>
|
|
|
|
<if test="startTime!=null">
|
|
<![CDATA[
|
|
and b.startTime >= #{startTime}
|
|
]]>
|
|
</if>
|
|
ORDER BY b.created DESC,b.title desc
|
|
<if test="pageSize!=null">
|
|
LIMIT #{pageSize}
|
|
</if>
|
|
|
|
<if test="offset!=null">
|
|
OFFSET #{offset}
|
|
</if>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getNewUnivHearExamsCountByClassesId" parameterType="java.lang.Long" resultType="Integer">
|
|
with temp as (SELECT COUNT(*) howmuch
|
|
FROM v_univhearexam a
|
|
INNER join univClassOwnhear b
|
|
ON b.classesId = #{classesId} and a.examId = b.examId and a.isOral=-1),
|
|
temp1 as (SELECT COUNT(*) howmuch
|
|
FROM v_univhearexam a
|
|
INNER join univClassOwnexam b
|
|
ON b.classesId = #{classesId} and a.examId = b.examId and isOral=2)
|
|
select t.howmuch+t1.howmuch from temp t,temp1 t1
|
|
</select>
|
|
|
|
|
|
<select id="getNewUnivHearExamsByClassesId" parameterType="java.util.Map" resultType="UnivExam">
|
|
select h.examId , h.examType , h.isRecommend , h.title , h.description ,
|
|
h.examPaperCount , h.examPapers , h.created , h.startTime , h.endTime ,
|
|
h.isNetExam , h.isOral
|
|
FROM v_univhearexam h inner join univclassownhear c on c.examid = h.examid and c.classesId=#{classesId} and h.isOral=-1
|
|
union
|
|
select
|
|
h.examId , h.examType , h.isRecommend , h.title , h.description ,
|
|
h.examPaperCount , h.examPapers , h.created , h.startTime , h.endTime ,
|
|
h.isNetExam , h.isOral
|
|
FROM v_univhearexam h inner join univclassownexam c on c.examid = h.examid and c.classesId=#{classesId} and isOral=2
|
|
order by created desc ,title desc,isOral
|
|
<if test="pageSize!=null">
|
|
limit #{pageSize}
|
|
</if>
|
|
|
|
<if test="offset!=null">
|
|
offset #{offset}
|
|
</if>
|
|
</select>
|
|
</mapper> |