80 lines
2.9 KiB
XML
80 lines
2.9 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="UnivHearExam">
|
||
|
|
|
||
|
|
|
||
|
|
<insert id="insertUnivHearExam" parameterType="UnivHearExam">
|
||
|
|
INSERT INTO UnivHearExam ( examId, examType, isRecommend, title,
|
||
|
|
description, hearPaperId, created, startTime, endTime,
|
||
|
|
isNetExam , teacherId )
|
||
|
|
Values ( #{examId}, #{examType}, #{isRecommend}, #{title},
|
||
|
|
#{description}, #{hearPaperId}, current_timestamp, #{startTime},
|
||
|
|
#{endTime}, #{isNetExam} , #{teacherId} )
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="updateUnivHearExam" parameterType="UnivHearExam">
|
||
|
|
UPDATE UnivHearExam
|
||
|
|
SET examId = #{examId}, examType = #{examType},
|
||
|
|
isRecommend = #{isRecommend}, title = #{title},
|
||
|
|
description = #{description}, hearPaperId = #{hearPaperId},
|
||
|
|
created = #{created}, startTime = #{startTime},
|
||
|
|
endTime = #{endTime},
|
||
|
|
isNetExam = #{isNetExam} , teacherId = #{teacherId}
|
||
|
|
WHERE examId=#{examId}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<select id="getUnivHearExamByKey" parameterType="java.lang.Integer" resultType="UnivHearExam">
|
||
|
|
SELECT examId , examType , isRecommend , title , description ,
|
||
|
|
hearPaperId , created ,
|
||
|
|
startTime , endTime , isNetExam , teacherId
|
||
|
|
FROM UnivHearExam
|
||
|
|
WHERE examId=#{examId}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getSeqUnivHearExam" resultType="Integer" useCache="false" flushCache="true">
|
||
|
|
SELECT nextval('seq_UnivhearExamId') ;
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getUnivHearExamsCountByClassesId" parameterType="java.util.Map" resultType="Integer">
|
||
|
|
SELECT COUNT(*)
|
||
|
|
FROM UnivClassOwnHear a
|
||
|
|
INNER join UnivHearExam b
|
||
|
|
ON a.classesId = #{classesId} 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="getUnivHearExamsByClassesId" parameterType="java.util.Map" resultType="UnivHearExam">
|
||
|
|
SELECT b.examId , b.examType , b.isRecommend , b.title , b.description , b.hearPaperId ,
|
||
|
|
b.created , b.startTime , b.endTime , b.isNetExam , b.teacherId
|
||
|
|
FROM UnivClassOwnHear a
|
||
|
|
INNER join UnivHearExam b
|
||
|
|
ON a.classesId = #{classesId} 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>
|
||
|
|
|
||
|
|
</mapper>
|