86 lines
3.1 KiB
XML
86 lines
3.1 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="HearExam">
|
|
|
|
<insert id="insertHearExam" parameterType="HearExam">
|
|
INSERT INTO HearExam ( 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="updateHearExam" parameterType="HearExam">
|
|
|
|
|
|
UPDATE HearExam 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="getHearExamByKey" parameterType="java.lang.Integer" resultType="HearExam">
|
|
|
|
|
|
|
|
SELECT examId , examType , isRecommend , title , description , hearPaperId , created , startTime , endTime , isNetExam , teacherId
|
|
FROM HearExam WHERE examId=#{examId}
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getSeqHearExam" resultType="Integer" useCache="false" flushCache="true">
|
|
|
|
SELECT nextval('seq_hearExamId') ;
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getHearExamsCountByClassesId" parameterType="java.util.Map" resultType="Integer">
|
|
SELECT COUNT(*)
|
|
FROM ClassOwnHear a
|
|
INNER join HearExam b
|
|
ON a.classesId = #{classesId} and a.examId = b.examId
|
|
<if test="examType!=null">
|
|
and b.examType = #{examType}
|
|
</if>
|
|
<if test="endTime!=null">
|
|
<![CDATA[
|
|
and b.endTime <= #{endTime}
|
|
]]>
|
|
</if>
|
|
<if test="startTime!=null">
|
|
<![CDATA[
|
|
and b.startTime >= #{startTime}
|
|
]]>
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getHearExamsByClassesId" parameterType="java.util.Map" resultType="HearExam">
|
|
SELECT b.examId , b.examType , b.isRecommend , b.title , b.description , b.hearPaperId , b.created , b.startTime , b.endTime , b.isNetExam , b.teacherId
|
|
FROM ClassOwnHear a
|
|
INNER join HearExam b
|
|
ON a.classesId = #{classesId} and a.examId = b.examId
|
|
<if test="examType!=null">
|
|
and b.examType = #{examType}
|
|
</if>
|
|
<if test="endTime!=null">
|
|
<![CDATA[
|
|
and b.endTime <= #{endTime}
|
|
]]>
|
|
</if>
|
|
<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> |