286 lines
12 KiB
XML
286 lines
12 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="com._3e.dao.SouthLessonDao">
|
||
|
|
<resultMap id="UnitPaperMap" type="com._3e.http.exam.dto._3EResSouthLessonExam">
|
||
|
|
<result column="bookId" property="bookId"></result>
|
||
|
|
<result column="bookName" property="bookName"></result>
|
||
|
|
<collection property="units" ofType="com._3e.http.exam.dto.SouthUnit">
|
||
|
|
<result column="unitId" property="unitId"></result>
|
||
|
|
<result column="unitName" property="unitName"></result>
|
||
|
|
<collection property="papers" ofType="com._3e.entity.SouthPaper">
|
||
|
|
<result column="examPaperId" property="examPaperId"></result>
|
||
|
|
<result column="examLevel" property="examLevel"></result>
|
||
|
|
<result column="title" property="title"></result>
|
||
|
|
<result column="totalScore" property="totalScore"></result>
|
||
|
|
<result column="status" property="status"></result>
|
||
|
|
<result column="areaId" property="areaId"></result>
|
||
|
|
<result column="machineScore" property="machineScore"></result>
|
||
|
|
<result column="humanScore" property="humanScore"></result>
|
||
|
|
<result column="paperFile" property="paperFile"></result>
|
||
|
|
<result column="md5Code" property="md5Code"></result>
|
||
|
|
<result column="content" property="content"></result>
|
||
|
|
<result column="isOral" property="isOral"></result>
|
||
|
|
<result column="lessonId" property="lessonId"></result>
|
||
|
|
<result column="paperType" property="paperType"></result>
|
||
|
|
<result column="assignTime" property="assignTime"></result>
|
||
|
|
</collection>
|
||
|
|
</collection>
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<select id= "getSouthBookByLessonId" resultMap="UnitPaperMap" >
|
||
|
|
select b.lessonid bookId,b.lessonname bookName,u.lessonid unitId,u.lessonname unitName,p.*
|
||
|
|
from southlesson b INNER JOIN southlesson u on u.parentid = b.lessonid
|
||
|
|
INNER JOIN southpaper p on u.lessonid = p.lessonid
|
||
|
|
where b.lessonid = #{lessonId} and b.status=1 and u.status=1 and p.status != 0 ORDER BY u.orderid,p.orderid,p.exampaperid
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "getSeqSouthAnswer" resultType="int">
|
||
|
|
SELECT NEXTVAL('seq_southAnswerid')
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "getSouthActivateBookByUId" parameterType="long" resultType="com._3e.http.exam.dto._3EResSouthLesson" >
|
||
|
|
select l.lessonId,l.lessonname lessonName,l.description,l.bigicon,a.endtime
|
||
|
|
from southactive a inner join southlesson l on a.lessonid = l.lessonid
|
||
|
|
where uid = #{studentId} and a.status = 1 and l.status = 1 order by lessonid
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "getSouthActivateBookByUIdAndSource" parameterType="map" resultType="com._3e.http.exam.dto._3EResSouthLesson" >
|
||
|
|
select *
|
||
|
|
from southactive
|
||
|
|
where uid = #{studentId} and status = 1 and source = #{source} and type = #{type}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "getAllBookByUId" parameterType="long" resultType="com._3e.http.exam.dto._3EResSouthLesson" >
|
||
|
|
select l.lessonId,l.lessonname lessonName,l.description,l.bigicon
|
||
|
|
from southlesson l
|
||
|
|
where l.status = 1 and l.lessontype = 'B' order by orderid
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "getAllBookByUIdAndCLessonId" parameterType="long" resultType="com._3e.http.exam.dto._3EResSouthLesson" >
|
||
|
|
select l.lessonId,l.lessonname lessonName,l.description,l.bigicon
|
||
|
|
from southlesson l
|
||
|
|
where l.status = 1 and l.lessontype = 'B'
|
||
|
|
AND l.parentid in
|
||
|
|
<foreach item="lessonid" index="index" collection="cLessonIds"
|
||
|
|
open="(" separator="," close=")">
|
||
|
|
#{lessonid}
|
||
|
|
</foreach>
|
||
|
|
order by orderid
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "getSouthLessonIdByActivation" parameterType="string" resultType="com._3e.entity.SouthActive" >
|
||
|
|
select * from southactive where activecode = #{activation} and status = 1
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "getSouthActivateByUIdAndLessonId" parameterType="map" resultType="com._3e.entity.SouthActive" >
|
||
|
|
select * from southactive where memo like concat('%',#{studentId},'%') and lessonid = #{lessonId} and status = 0 limit 1
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<update id= "doUpdateSouthActiveBy" parameterType="com._3e.entity.SouthActive" >
|
||
|
|
update southactive set uid = #{uId},activetime = #{activeTime},endtime = #{endTime},memo = #{memo},type = #{type}
|
||
|
|
where activecode = #{activeCode} and status = 1
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<update id= "doUpdateSouthAnswerById" parameterType="com._3e.entity.SouthAnswer">
|
||
|
|
UPDATE SouthAnswer
|
||
|
|
<set>
|
||
|
|
<if test="uid != null">uid=#{uid},</if>
|
||
|
|
<if test="examPaperId != null"> exampaperid=#{examPaperId},</if>
|
||
|
|
<if test="deviceType != null"> devicetype=#{deviceType},</if>
|
||
|
|
<if test="origiScore != null"> origiscore=#{origiScore},</if>
|
||
|
|
<if test="score != null"> score=#{score},</if>
|
||
|
|
<if test="trueScore != null"> truescore=#{trueScore},</if>
|
||
|
|
<if test="created != null"> created=#{created},</if>
|
||
|
|
<if test="areaId != null"> areaid=#{areaId},</if>
|
||
|
|
<if test="machineScore != null"> machinescore=#{machineScore},</if>
|
||
|
|
<if test="humanScore != null"> humanscore=#{humanScore},</if>
|
||
|
|
<if test="paperFile != null"> paperfile=#{paperFile},</if>
|
||
|
|
<if test="md5code != null"> md5code=#{md5code},</if>
|
||
|
|
<if test="content != null"> content=#{content}</if>
|
||
|
|
</set>
|
||
|
|
WHERE examAnswerId = #{examAnswerId} and areaId=#{areaId}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<insert id= "doSaveSouthAnswer" parameterType="com._3e.entity.SouthAnswer" >
|
||
|
|
INSERT INTO SouthAnswer(
|
||
|
|
examanswerid, uid, examPaperId, deviceType, origiscore,
|
||
|
|
score, truescore, created, areaid, machinescore, humanscore,
|
||
|
|
paperfile, md5code, content)
|
||
|
|
VALUES (
|
||
|
|
<if test="examAnswerId != 0">
|
||
|
|
#{examAnswerId},
|
||
|
|
</if>
|
||
|
|
#{uid}, #{examPaperId}, #{deviceType}, #{origiScore},
|
||
|
|
#{score}, #{ trueScore}, #{ created}, #{ areaId}, #{ machineScore}, #{ humanScore},
|
||
|
|
#{paperFile}, #{ md5code}, #{ content})
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<select id= "findStudentGradeCurve" parameterType="map" resultType="com._3e.dto.VUserGradeCurve" >
|
||
|
|
SELECT extract( year from created ) as myYear ,
|
||
|
|
extract( month from created ) as myMonth,
|
||
|
|
extract( day from created ) as myDay,
|
||
|
|
max( score ) as maxScore , avg( score ) as avgScore
|
||
|
|
FROM southanswer
|
||
|
|
WHERE uid = #{uid}
|
||
|
|
<if test="beginTime != null">
|
||
|
|
and created > #{beginTime}
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
and created <= #{endTime}
|
||
|
|
</if>
|
||
|
|
GROUP BY extract( year from created ) ,
|
||
|
|
extract( month from created ),
|
||
|
|
extract( day from created )
|
||
|
|
ORDER BY myYear , myMonth , myDay
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "findStudentMaxGradeCurve" parameterType="map" resultType="com._3e.dto.VUserGradeCurve" >
|
||
|
|
SELECT extract( year from created ) as myYear ,
|
||
|
|
extract( month from created ) as myMonth,
|
||
|
|
extract( day from created ) as myDay,
|
||
|
|
max( score ) as maxScore , avg( score ) as avgScore
|
||
|
|
FROM (
|
||
|
|
SELECT *,row_number()over(PARTITION by extract( day from created ),exampaperid ORDER BY score desc,created desc) rownum from southanswer
|
||
|
|
WHERE uid = #{uid}
|
||
|
|
<if test="beginTime != null">
|
||
|
|
and created > #{beginTime}
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
and created <= #{endTime}
|
||
|
|
</if>
|
||
|
|
) a where rownum =1
|
||
|
|
GROUP BY extract( year from created ) ,
|
||
|
|
extract( month from created ),
|
||
|
|
extract( day from created )
|
||
|
|
ORDER BY myYear , myMonth , myDay
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "findSouthAnswerByUid" parameterType="map" resultType="com._3e.http.exam.dto._3EResStudentGrade" >
|
||
|
|
SELECT l.lessonname bookname,u.lessonname unitname,p.title ,p.papertype ,a.*
|
||
|
|
FROM southanswer a INNER JOIN southpaper p on a.exampaperid = p.exampaperid
|
||
|
|
INNER JOIN southlesson u on p.lessonid = u.lessonid
|
||
|
|
INNER JOIN southlesson l on u.parentid = l.lessonid
|
||
|
|
WHERE uid = #{uid}
|
||
|
|
<if test="beginTime != null">
|
||
|
|
and created > #{beginTime}
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
and created <= #{endTime}
|
||
|
|
</if>
|
||
|
|
ORDER BY a.created desc
|
||
|
|
<if test="page != null">
|
||
|
|
LIMIT #{page.limit} OFFSET #{page.offset}
|
||
|
|
</if>
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "findSouthMaxAnswerByUid" parameterType="map" resultType="com._3e.http.exam.dto._3EResStudentGrade" >
|
||
|
|
SELECT l.lessonname bookname,u.lessonname unitname,p.title ,p.papertype,a.*
|
||
|
|
FROM(
|
||
|
|
SELECT *,row_number()over(PARTITION by exampaperid ORDER BY score desc,created desc) rownum from southanswer
|
||
|
|
WHERE uid = #{uid}
|
||
|
|
<if test="beginTime != null">
|
||
|
|
and created > #{beginTime}
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
and created <= #{endTime}
|
||
|
|
</if> ) a
|
||
|
|
INNER JOIN southpaper p on a.exampaperid = p.exampaperid
|
||
|
|
INNER JOIN southlesson u on p.lessonid = u.lessonid
|
||
|
|
INNER JOIN southlesson l on u.parentid = l.lessonid
|
||
|
|
where rownum = 1 ORDER BY a.created desc
|
||
|
|
<if test="page != null">
|
||
|
|
LIMIT #{page.limit} OFFSET #{page.offset}
|
||
|
|
</if>
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "findSouthClassGradeCurve" parameterType="map" resultType="com._3e.dto.VUserGradeCurve" >
|
||
|
|
SELECT extract( year from b.created ) as myYear ,
|
||
|
|
extract( month from b.created ) as myMonth,
|
||
|
|
extract( day from b.created ) as myDay,
|
||
|
|
max( b.score ) as maxScore , avg( b.score ) as avgScore
|
||
|
|
FROM StudentOwnClass a
|
||
|
|
INNER JOIN southanswer b
|
||
|
|
ON a.studentid = b.uid
|
||
|
|
and a.classesId = #{classesId}
|
||
|
|
and a.areaid = #{areaId}
|
||
|
|
<if test="beginTime != null">
|
||
|
|
and created > #{beginTime}
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
and created <= #{endTime}
|
||
|
|
</if>
|
||
|
|
and a.status = 1
|
||
|
|
GROUP BY extract( year from b.created ) ,
|
||
|
|
extract( month from b.created ),
|
||
|
|
extract( day from b.created )
|
||
|
|
ORDER BY myYear , myMonth , myDay
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "findSouthClassMaxGradeCurve" parameterType="map" resultType="com._3e.dto.VUserGradeCurve" >
|
||
|
|
select myyear,mymonth,myday,max(maxscore) maxscore,avg(avgscore) avgscore from(
|
||
|
|
SELECT uid,
|
||
|
|
extract( year from b.created ) as myYear ,
|
||
|
|
extract( month from b.created ) as myMonth,
|
||
|
|
extract( day from b.created ) as myDay,
|
||
|
|
max( b.score ) as maxScore , avg( b.score ) as avgScore from
|
||
|
|
(
|
||
|
|
SELECT s.*,row_number()over(PARTITION by extract( day from created ),uid,exampaperid ORDER BY score desc,created desc) rownum from southanswer s
|
||
|
|
INNER JOIN studentownclass st on st.studentid = s.uid
|
||
|
|
and st.classesId = #{classesId}
|
||
|
|
and st.areaid = #{areaId}
|
||
|
|
and st.status = 1
|
||
|
|
<if test="beginTime != null">
|
||
|
|
and created > #{beginTime}
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
and created <= #{endTime}
|
||
|
|
</if>
|
||
|
|
) b where b.rownum = 1
|
||
|
|
GROUP BY uid,
|
||
|
|
extract( year from b.created ) ,
|
||
|
|
extract( month from b.created ),
|
||
|
|
extract( day from b.created )
|
||
|
|
ORDER BY myYear , myMonth , myDay) s
|
||
|
|
GROUP BY myYear , myMonth , myDay
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "findSouthClassGradeNum" parameterType="map" resultType="map" >
|
||
|
|
select count(a.score>=0 or null) allNum,count(a.score>=0 and a.score < 60 or null) eNumP,
|
||
|
|
count(a.score>=60 and a.score<70 or null) dNumP,count(a.score>=70 and a.score<80 or null) cNumP,
|
||
|
|
count(a.score>=80 and a.score<90 or null) bNumP,count(a.score>=90 and a.score<=100 or null) aNumP
|
||
|
|
from southanswer a
|
||
|
|
INNER JOIN studentownclass st on a.uid = st.studentid
|
||
|
|
where st.classesId = #{classesId} and st.areaid=#{areaId} and st.status = 1
|
||
|
|
<if test="beginTime != null">
|
||
|
|
and a.created > #{beginTime}
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
and a.created <= #{endTime}
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "findSouthClassMaxGradeNum" parameterType="map" resultType="map" >
|
||
|
|
select count(a.score>=0 or null) allNum,count(a.score>=0 and a.score < 60 or null) eNumP,
|
||
|
|
count(a.score>=60 and a.score<70 or null) dNumP,count(a.score>=70 and a.score<80 or null) cNumP,
|
||
|
|
count(a.score>=80 and a.score<90 or null) bNumP,count(a.score>=90 and a.score<=100 or null) aNumP
|
||
|
|
from (
|
||
|
|
SELECT s.*,row_number()over(PARTITION by uid,exampaperid ORDER BY score desc,created desc) rownum from southanswer s
|
||
|
|
INNER JOIN studentownclass st on st.studentid = s.uid
|
||
|
|
and st.classesId = #{classesId}
|
||
|
|
and st.areaid = #{areaId}
|
||
|
|
and st.status = 1
|
||
|
|
<if test="beginTime != null">
|
||
|
|
and created > #{beginTime}
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
and created <= #{endTime}
|
||
|
|
</if>
|
||
|
|
) a where a.rownum = 1
|
||
|
|
</select>
|
||
|
|
</mapper>
|