272 lines
9.2 KiB
XML
272 lines
9.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="ModelExam">
|
|
|
|
<insert id="insertModelExam" parameterType="ModelExam">
|
|
INSERT INTO ModelExam ( examId, title, description,
|
|
examPaperCount, examPapers, created, startTime, endTime , isOral,teacherId,examGuid,batchCode)
|
|
Values ( #{examId}, #{title}, #{description},
|
|
#{examPaperCount}, #{examPapers},current_timestamp, #{startTime}, #{endTime} ,#{isOral},#{teacherId},#{examGuid},#{batchCode} )
|
|
|
|
</insert>
|
|
|
|
<update id="updateModelExam" parameterType="ModelExam">
|
|
|
|
UPDATE ModelExam
|
|
SET examId = #{examId},
|
|
title = #{title}, description = #{description}, examPaperCount = #{examPaperCount},
|
|
examPapers = #{examPapers}, created = #{created}, startTime = #{startTime},
|
|
endTime = #{endTime} ,isOral=#{isOral},teacherId=#{teacherId},examGuid=#{examGuid},batchCode=#{batchCode}
|
|
where examId=#{examId}
|
|
|
|
</update>
|
|
|
|
<select id="getModelExamByKey" parameterType="java.lang.Integer" resultType="ModelExam">
|
|
|
|
SELECT examId, title, description,
|
|
examPaperCount, examPapers, created, startTime, endTime , isOral,teacherId,examGuid,batchCode
|
|
FROM ModelExam
|
|
WHERE examId=#{examId}
|
|
|
|
</select>
|
|
|
|
<select id="getSeqModelExam" resultType="Integer" useCache="false" flushCache="true">
|
|
|
|
SELECT nextval('seq_ModelExamId') ;
|
|
|
|
</select>
|
|
|
|
<select id="getExamIdByExamGuid" resultType="Integer" parameterType="java.lang.String">
|
|
|
|
select examId from modelExam where examGuid=#{_parameter} or batchCode=#{_parameter}
|
|
|
|
</select>
|
|
|
|
|
|
<select id="modelExamStatistics" resultType="java.util.Map" parameterType="java.util.Map">
|
|
select sl.schoolid "schoolId",sl.schoolname "schoolName",count(distinct e.examid) "examCount",count(e.userid) as "studentCount" from modelanswer e inner join studentownclass s
|
|
on s.studentid=e.userid and e.created>#{startTime} and e.created<#{endTime}
|
|
inner join classes c on c.classesid=s.classesid
|
|
inner join school sl on c.schoolid=sl.schoolid
|
|
group by sl.schoolid,sl.schoolname
|
|
order by sl.schoolid
|
|
<if test="pageSize!=null">
|
|
limit #{pageSize}
|
|
</if>
|
|
|
|
<if test="offset!=null">
|
|
|
|
offset #{offset}
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
|
|
<select id="modelExamStatisticsCount" resultType="Integer" parameterType="java.util.Map">
|
|
select count(distinct sl.schoolid) from modelanswer e inner join studentownclass s
|
|
on s.studentid=e.userid and e.created>#{startTime} and e.created<#{endTime}
|
|
inner join classes c on c.classesid=s.classesid
|
|
inner join school sl on c.schoolid=sl.schoolid
|
|
-- group by sl.schoolid
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getModelExamRecord" resultType="java.util.Map" parameterType="java.util.Map">
|
|
|
|
select cs.classname "className",cs.classesId "classesId",e.examId "examId",
|
|
tr.truename "teacherName",e.created ,sl.schoolName "schoolName",e.batchCode "batchCode"
|
|
from classownmodel c
|
|
inner join classes cs
|
|
on c.classesid=cs.classesid
|
|
and cs.classtype=1 and cs.status=1
|
|
<if test="roleType==100">
|
|
and cs.teacherid=#{userId}
|
|
</if>
|
|
<if test="roleType==14">
|
|
and cs.schoolId=(select schoolId from admin where adminid=#{userId})
|
|
</if>
|
|
|
|
<if test="roleType==13">
|
|
and cs.schoolId in (select valuelong from parameter where paralong=#{userId} and paratype=9)
|
|
</if>
|
|
|
|
<if test="roleType==15">
|
|
and cs.classesId in (select valuelong from parameter where paralong=#{userId} and paratype=10)
|
|
</if>
|
|
<if test="objectType==3">
|
|
and cs.schoolId in (select schoolid from school where areaId in
|
|
(select areaId from area where parentid in (select areaId from area where parentid=#{areaId} )))
|
|
</if>
|
|
<if test="objectType==2">
|
|
and cs.schoolId in (select schoolid from school where areaId in
|
|
(select areaId from area where parentid=#{areaId} ))
|
|
</if>
|
|
|
|
<if test="objectType==1">
|
|
and cs.schoolId in (select schoolid from school where areaId=#{areaId})
|
|
</if>
|
|
<if test="schoolId!=null">
|
|
and cs.schoolId=#{schoolId}
|
|
</if>
|
|
|
|
<if test="classesId!=null">
|
|
and cs.classesId=#{classesId}
|
|
</if>
|
|
inner join modelexam e
|
|
on e.examid=c.examid
|
|
<if test="startTime!=null">
|
|
and e.created > #{startTime}
|
|
</if>
|
|
|
|
<if test="endTime!=null">
|
|
and e.created < #{endTime}
|
|
</if>
|
|
|
|
<if test="examGuid!=null">
|
|
and e.examGuid=#{examGuid}
|
|
</if>
|
|
inner join teacher tr
|
|
on tr.teacherid=cs.teacherid
|
|
<if test="teacherName!=null">
|
|
and tr.truename=#{teacherName}
|
|
</if>
|
|
inner join school sl
|
|
on sl.schoolid=cs.schoolid
|
|
|
|
order by e.examid desc,c.classesId
|
|
<if test="pageSize!=null">
|
|
limit #{pageSize}
|
|
</if>
|
|
|
|
<if test="offset!=null">
|
|
|
|
offset #{offset}
|
|
|
|
</if>
|
|
</select>
|
|
<select id="getModelExamRecordCount" resultType="Integer" parameterType="java.util.Map">
|
|
|
|
select count(c.examId)
|
|
from classownmodel c
|
|
inner join classes cs
|
|
on c.classesid=cs.classesid
|
|
and cs.classtype=1 and cs.status=1
|
|
<if test="roleType==100">
|
|
and cs.teacherid=#{userId}
|
|
</if>
|
|
<if test="roleType==14">
|
|
and cs.schoolId=(select schoolId from admin where adminid=#{userId})
|
|
</if>
|
|
|
|
<if test="roleType==13">
|
|
and cs.schoolId in (select valuelong from parameter where paralong=#{userId} and paratype=9)
|
|
</if>
|
|
|
|
<if test="roleType==15">
|
|
and cs.classesId in (select valuelong from parameter where paralong=#{userId} and paratype=10)
|
|
</if>
|
|
<if test="objectType==3">
|
|
and cs.schoolId in (select schoolid from school where areaId in
|
|
(select areaId from area where parentid in (select areaId from area where parentid=#{areaId} )))
|
|
</if>
|
|
<if test="objectType==2">
|
|
and cs.schoolId in (select schoolid from school where areaId in
|
|
(select areaId from area where parentid=#{areaId} ))
|
|
</if>
|
|
|
|
<if test="objectType==1">
|
|
and cs.schoolId in (select schoolid from school where areaId=#{areaId})
|
|
</if>
|
|
<if test="schoolId!=null">
|
|
and cs.schoolId=#{schoolId}
|
|
</if>
|
|
|
|
<if test="classesId!=null">
|
|
and cs.classesId=#{classesId}
|
|
</if>
|
|
inner join modelexam e
|
|
on e.examid=c.examid
|
|
<if test="startTime!=null">
|
|
and e.created > #{startTime}
|
|
</if>
|
|
|
|
<if test="endTime!=null">
|
|
and e.created < #{endTime}
|
|
</if>
|
|
|
|
<if test="examGuid!=null">
|
|
and e.examGuid=#{examGuid}
|
|
</if>
|
|
inner join teacher tr
|
|
on tr.teacherid=cs.teacherid
|
|
<if test="teacherName!=null">
|
|
and tr.truename=#{teacherName}
|
|
</if>
|
|
</select>
|
|
<select id="getModelExamByBatchCode" resultType="ModelExam" parameterType="java.util.Map">
|
|
select examId, title, description,
|
|
examPaperCount,examPapers, created, startTime, endTime , isOral,teacherId,examGuid,batchCode
|
|
from modelExam where batchCode=#{batchCode}
|
|
<!-- <if test="roleType==100">-->
|
|
<!-- and teacherId=#{userId}-->
|
|
<!-- </if>-->
|
|
<if test="roleType==14">
|
|
and teacherId in (select teacherId from teacher where schoolid=(select schoolId from admin where adminid=#{userId}))
|
|
</if>
|
|
|
|
<if test="roleType==13">
|
|
and teacherId in (select teacherId from teacher where schoolid in (select valuelong from parameter where paralong=#{userId} and paratype=9))
|
|
</if>
|
|
|
|
<if test="roleType==15">
|
|
and teacherId in (select teacherId from classes where classesId in (select valuelong from parameter where paralong=#{userId} and paratype=10))
|
|
</if>
|
|
order by examId desc
|
|
<if test="pageSize!=null">
|
|
limit #{pageSize}
|
|
</if>
|
|
|
|
<if test="offset!=null">
|
|
offset #{offset}
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<select id="getModelExamCountByBatchCode" resultType="Integer" parameterType="java.util.Map">
|
|
select count(examId)
|
|
from modelExam where batchCode=#{batchCode}
|
|
<if test="roleType==100">
|
|
and teacherId=#{userId}
|
|
</if>
|
|
<if test="roleType==14">
|
|
and teacherId in (select teacherId from teacher where schoolid=(select schoolId from admin where adminid=#{userId}))
|
|
</if>
|
|
|
|
<if test="roleType==13">
|
|
and teacherId in (select teacherId from teacher where schoolid in (select valuelong from parameter where paralong=#{userId} and paratype=9))
|
|
</if>
|
|
|
|
<if test="roleType==15">
|
|
and teacherId in (select teacherId from classes where classesId in (select valuelong from parameter where paralong=#{userId} and paratype=10))
|
|
</if>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getModelExamsByBatchCodes" resultType="ModelExamDTO" parameterType="java.util.Map">
|
|
select a.examId, a.title, a.description,
|
|
a.examPaperCount,a.examPapers, a.created, a.startTime, a.endTime , a.isOral,a.teacherId,a.examGuid,a.batchCode,b.classesId
|
|
from modelExam as a inner join classownmodel as b on a.examid = b.examid where a.batchCode in
|
|
<foreach collection="list" item="batchCode" open="(" separator="," close=")">
|
|
#{batchCode}
|
|
</foreach>
|
|
|
|
group by a.examId,a.title, a.description, a.examPaperCount,a.examPapers, a.created, a.startTime, a.endTime , a.isOral,a.teacherId,a.examGuid,a.batchCode,b.classesId
|
|
</select>
|
|
</mapper> |