233 lines
10 KiB
XML
Raw Permalink Normal View History

2026-03-10 16:40:19 +08:00
<?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._3e.dao.SouthExamDao">
<select id= "getNextSeq" resultType="int">
SELECT NEXTVAL('seq_SouthExamId')
</select>
<insert id= "doSave" parameterType="com._3e.entity.SouthExam">
INSERT INTO southExam(examid,examtype,title,description,exampapercount,exampapers,created,starttime,endtime,isnetexam,isrecommend,isoral,teacherid,assignTime)
VALUES (
<if test="examid == 0">
(SELECT NEXTVAL('seq_SouthExamId')),
</if>
<if test="examid != 0">
#{examid},
</if>
#{examtype},#{title},#{description},#{exampapercount},#{exampapers},#{created},#{starttime},#{endtime},#{isnetexam},#{isrecommend},#{isoral},#{teacherid},#{assignTime})
</insert>
<insert id="doExamToClasses" parameterType="com._3e.entity.ClassOwnSouth" >
INSERT INTO ClassOwnSouth(classesid,examid,areaid,objecttype)
VALUES (#{classesid},#{examid},#{areaid},#{objecttype})
</insert>
<select id="findAssignSouthExam" parameterType="map" resultType="com._3e.http.teachercenter.dto.manageexam._3EResAssignedExam" >
SELECT b.examid, b.examtype, b.title, b.description, b.exampapers,b.created,b.assignTime,
b.starttime, b.endtime, b.isnetexam, b.teacherId, b.isoral,b.status
FROM ClassOwnSouth a
INNER join SouthExam b
ON a.classesId = #{classesId} and a.examId = b.examId
AND b.isoral = #{isOral}
<if test="examType != null">
AND b.examType = #{examType}
</if>
<if test="startTime != null">
and b.startTime &gt;= #{startTime}
</if>
<if test="endTime != null">
and b.endTime &lt;= #{endTime}
</if>
ORDER BY b.examId DESC
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>
</select>
<select id="findSouthExamPaperNamesByPaperIds" parameterType="java.util.List" resultType="com._3e.http.teachercenter.dto.manageexam._3EResPaper">
select sp.exampaperid as paperId ,su.lessonname unitName,sb.lessonname bookName,sp.title from southpaper sp
INNER JOIN southlesson su on sp.lessonid = su.lessonid
INNER JOIN southlesson sb on su.parentid = sb.lessonid
where sp.exampaperid
in
<foreach collection="list" index="index" item="item" separator="," close=")" open="(">
#{item}
</foreach>
</select>
<select id= "findExam" parameterType="int" resultType="com._3e.entity.SouthExam" >
SELECT * FROM southExam WHERE examid = #{examId}
</select>
<update id="doSaveUpdate" parameterType="com._3e.entity.SouthExam" >
UPDATE southExam
<set>
<if test="examtype != null">
examtype = #{examtype},
</if>
<if test="isrecommend != null">
isrecommend = #{isrecommend},
</if>
<if test="title != null">
title = #{title},
</if>
<if test="description != null">
description = #{description},
</if>
<if test="exampapercount != null">
exampapercount = #{exampapercount},
</if>
<if test="exampapers != null">
exampapers = #{exampapers},
</if>
<if test="created != null">
created = #{created},
</if>
<if test="starttime != null">
starttime = #{starttime},
</if>
<if test="endtime != null">
endtime = #{endtime},
</if>
<if test="isnetexam != null">
isnetexam = #{isnetexam},
</if>
<if test="teacherid != null">
teacherid = #{teacherid},
</if>
<if test="isoral != null">
isoral = #{isoral},
</if>
<if test="status != null">
status = #{status}
</if>
</set>
WHERE examid = #{examid}
</update>
<select id="findClassOwnExamByExamid" resultType="com._3e.entity.ClassOwnSouth" parameterType="int">
select * from classownsouth where examid = #{examid}
</select>
<select id= "findSouthExam_v6" parameterType="map" resultType="com._3e.entity.SouthExam" >
select cl.teacherid,cl.classname,e.examid,e.examtype,e.examtype,e.title,e.description,e.exampapercount
,e.exampapers,e.created,e.starttime,e.endtime,e.isoral,e.assignTime from classownsouth ce inner join
southexam e on ce.examid=e.examid inner join classes cl on ce.classesid=cl.classesid
where cl.teacherid=e.teacherid and cl.classesid = #{classid}
and e.endtime &gt; NOW()
<if test="title != null">
and title like '%'||#{title}||'%'
</if>
order by e.created desc,e.title desc
</select>
<select id= "findSouthExam_v3" parameterType="map" resultType="com._3e.entity.SouthExam" >
select DISTINCT cl.teacherid,cl.classname,e.examid,e.examtype,e.examtype,e.title,e.description,e.exampapercount
,e.exampapers,e.created,e.starttime,e.endtime,e.isoral,e.assignTime from classownsouth ce inner join
southexam e on ce.examid=e.examid inner join classes cl on ce.classesid=cl.classesid
where cl.teacherid=e.teacherid and cl.teacherid IN
<foreach item="teacherid" index="index" collection="teacherlist"
open="(" separator="," close=")">
#{teacherid}
</foreach>
<if test="status== '2'.toString()">
and e.endtime &lt; NOW()
</if>
<if test="status== '1'.toString()">
and e.endtime &gt; NOW()
</if>
and ce.classesid=#{classesid}
<if test="title != null">
and title like '%'||#{title}||'%'
</if>
<!-- and e.examtype='S' -->
order by e.created desc,e.title desc
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>
</select>
<select id= "findSouthExam_v4" parameterType="map" resultType="com._3e.entity.SouthExam" >
select cl.teacherid,cl.classname,e.examid,e.examtype,e.examtype,e.title,e.description,e.exampapercount
,e.exampapers,e.created,e.starttime,e.endtime,e.isoral,e.assignTime from classownsouth ce inner join
southexam e on ce.examid=e.examid inner join classes cl on ce.classesid=cl.classesid
where cl.teacherid=e.teacherid and cl.classesid IN
<foreach item="item" index="index" collection="classids"
open="(" separator="," close=")">
#{item}
</foreach>
<if test="status== '2'.toString()">
and e.endtime &lt; NOW()
</if>
<if test="status== '1'.toString()">
and e.endtime &gt; NOW()
</if>
<if test="title != null">
and title like '%'||#{title}||'%'
</if>
<!-- and e.examtype='S' -->
order by e.created desc,e.title desc
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>
</select>
<select id="findExamAnswerByUidAndExamid" parameterType="map" resultType="com._3e.http.exam.dto.ExamAnswerDto">
select maxscoretime created,truescore,score from finishsouthstat where uid=#{userid}
and areaid = #{areaid}
and examid=#{examid}
order by truescore desc limit 1
</select>
<select id= "findSouthPaper" parameterType="int" resultType="com._3e.entity.SouthPaper" >
SELECT exampaperid, examlevel, title, totalscore, status,papertype,
machinescore, humanscore, paperfile, md5code, content, isoral,assignTime
FROM SouthPaper WHERE exampaperid = #{exampaperid}
</select>
<select id="findSouthAnsweranalyAccordingToGuid" parameterType="map" resultType="com._3e.http.teachercenter.dto.manageexam._3EExamAnsweranaly">
select * from southansweranaly where classesid=#{classesid} and examid=#{examid} and exampaperid=#{exampaperid}
</select>
<select id= "findIsExamToClass" parameterType="map" resultType="boolean" >
SELECT CASE WHEN (COUNT(*) &gt; 0) THEN true ELSE false END AS isFlag
FROM classOwnSouth
WHERE examid = #{examId} and classesid =#{classesId}
</select>
<select id= "findClassExamMaxScore" parameterType="map" resultType="com._3e.dto.ExamScoreDto" >
select o.studentId , se.examId,
se.examType , fs.exampaperid,fs.score, fs.maxscoretime created ,
case when fs.score >= 85 then 'A'
when fs.score >= 80 then 'B'
when fs.score >= 70 then 'C'
when fs.score >= 60 then 'D'
else 'E' end as level, se.title,s.truename, s.recognizecode, s.code,s.studentId AS userId,fs.truescore
from finishsouthstat fs
INNER JOIN southexam se on fs.examid = se.examid and fs.examid = #{examId}
RIGHT JOIN StudentOwnClass o ON fs.uid = o.studentId and o.areaid=#{areaId}
INNER JOIN student s ON s.studentId = o.studentId and s.areaid=#{areaId}
WHERE o.classesId = #{classesId} AND o.status = 1
ORDER BY score DESC, fs.maxscoretime ASC nulls last, uid ASC
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>
</select>
<select id= "findSouthAnswerIdByExam" parameterType="map" resultType="com._3e.http.exam.dto._3EResStudentGrade" >
select sa.examanswerid,sa.content,sp.papertype from southanswer sa inner join southpaper sp on sa.exampaperid = sp.exampaperid
where sa.uid = #{uid} and sa.exampaperid = #{exampaperId} and
sa.created between #{startTime} and #{endTime} order by sa.truescore desc,sa.created desc limit 1
</select>
<select id="findSouthAnswerByUidAndAnswerId" resultType="com._3e.entity.SouthAnswer" parameterType="map">
select * from southAnswer where examanswerid = #{examAnswerId} and uid = #{uid}
</select>
</mapper>