spokenServer/out/production/pcserver/sqlmap/ExaminationPlaceExport.xml

89 lines
2.3 KiB
XML
Raw Normal View History

2026-03-10 14:30:24 +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="ExaminationPlaceExport">
<sql id="baseSql" >
e.title,f.uid as userId,f.examId,f.examPaperId,f.score,f.trueScore,f.maxScoreTime,f.lastTime,f.areaId,
f.howMuch,f.avgScore,f.bigQuesScore
</sql>
<sql id="caseSql">
, case when f.score &gt;= 85 then 'A'
when f.score &gt;=80 then 'B'
when f.score &gt;=70 then 'C'
when f.score &gt;=60 then 'D'
else 'E' end as level
</sql>
<select id="getClassesExamForStudent" parameterType="java.util.Map" resultType="ExaminationPlaceExportDto">
select <include refid="baseSql"/> <include refid="caseSql"/> from FinishExamStat as f
INNER JOIN Exam as e on e.examId = f.examId
<if test="classesId != null">
inner join StudentOwnClass a on a.studentid = f.uid
</if>
<where>
<if test="classesId != null">
and a.classesId = #{classesId}
</if>
<if test="examId != null">
and f.examId = #{examId}
</if>
<if test="areaId != null">
and f.areaId = #{areaId}
</if>
<if test="isOral != null">
and e.isOral = #{isOral}
</if>
<if test="lowerScore != null">
and f.score&gt;#{lowerScore}
</if>
<if test="upperScore">
and f.score&lt;#{upperScore}
</if>
</where>
ORDER BY f.score desc nulls last
<if test="pageSize != null">
limit #{pageSize}
</if>
<if test="offset != null">
offset #{offset}
</if>
</select>
<select id="getClassesExamForStudentCount" parameterType="java.util.Map" resultType="Integer">
select count(1) from finishExamStat as f
INNER JOIN Exam as e on e.examId = f.examId
<if test="classesId != null">
inner join StudentOwnClass a on a.studentid = f.uid
</if>
<where>
<if test="classesId != null">
and a.classesId = #{classesId}
</if>
<if test="examId != null">
and f.examId = #{examId}
</if>
<if test="areaId != null">
and f.areaId = #{areaId}
</if>
<if test="isOral != null">
and e.isOral = #{isOral}
</if>
<if test="lowerScore != null">
and f.score&gt;#{lowerScore}
</if>
<if test="upperScore">
and f.score&lt;#{upperScore}
</if>
</where>
</select>
</mapper>