441 lines
15 KiB
XML
441 lines
15 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.univ3e.dao.UnivAssignDao">
|
|
<select id="findAssignment" parameterType="int" resultType="com.univ3e.entity.UnivAssignMent" >
|
|
SELECT * FROM UnivAssignMent
|
|
WHERE assignmentid =
|
|
#{assignmentid} and status = 1
|
|
</select>
|
|
|
|
<select id="findAssignByClassids" parameterType="list" resultType="com._3e.http.myhome.dto._3EResAssignment" >
|
|
SELECT b.*
|
|
FROM UNIVASSIGNMENT b, assigntoclass C
|
|
WHERE b.assignmentid = C .assignmentid AND b.status = 1
|
|
AND C .classesid in
|
|
<foreach item="item" index="index" collection="classesList"
|
|
open="(" separator="," close=")">
|
|
#{item.classesid}
|
|
</foreach>
|
|
and now() <= endtime
|
|
ORDER BY b.created DESC
|
|
</select>
|
|
|
|
<select id="findAssignByClassid" parameterType="map" resultType="com._3e.http.myhome.dto._3EResAssignment" >
|
|
SELECT b.assignmentid,b.content,b.description,b.starttime,
|
|
b.endtime,b.assigntype,l.classname,l.classesid
|
|
FROM UNIVASSIGNMENT b
|
|
LEFT JOIN univassigntoclass C ON b.assignmentid = C.assignmentid
|
|
LEFT JOIN univclasses l ON c.classesid = l.classesid
|
|
WHERE b.status = 1 AND C.classesid = #{classid}
|
|
<if test="status == '1'.toString()">
|
|
and now() <= b.endtime
|
|
</if>
|
|
<if test="status == '2'.toString()">
|
|
and now() > b.endtime
|
|
</if>
|
|
ORDER BY b.created DESC
|
|
<if test="page != null">
|
|
LIMIT #{page.limit} OFFSET #{page.offset}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="findAllAssignByAllClass" parameterType="map" resultType="com._3e.http.myhome.dto._3EResAssignment" >
|
|
SELECT b.assignmentid,b.content,b.description,b.starttime,
|
|
b.endtime,l.className,l.classesid
|
|
FROM UNIVASSIGNMENT b
|
|
LEFT JOIN univassigntoclass C ON b.assignmentid = C.assignmentid
|
|
LEFT JOIN univclasses l ON c.classesid = l.classesid
|
|
WHERE b.assignmentid = C.assignmentid
|
|
AND b.status = '1' AND C.classesid in
|
|
<foreach item="item" index="index" collection="classesList"
|
|
open="(" separator="," close=")">
|
|
#{item.classesid}
|
|
</foreach>
|
|
<if test="status == 1">
|
|
and now() <= b.endtime
|
|
</if>
|
|
<if test="status == 2">
|
|
and now() > b.endtime
|
|
</if>
|
|
ORDER BY b.created DESC
|
|
<if test="page != null">
|
|
LIMIT #{page.limit} OFFSET #{page.offset}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="findAllAssignByClassid" parameterType="map" resultType="com.univ3e.entity.UnivAssignMent" >
|
|
SELECT b.assignmentId , b.teacherId , b.content , b.description , b.created ,
|
|
b.startTime , b.endTime , b.status , b.areaid ,b.packageName , b.packageName ,b.assigntype
|
|
FROM UnivAssignToClass a
|
|
INNER JOIN UnivAssignment b
|
|
ON a.classesId = #{classesid}
|
|
AND a.assignmentId = b.assignmentId
|
|
AND b.status = 1
|
|
ORDER BY b.assignmentId desc
|
|
<if test="page != null">
|
|
LIMIT #{page.limit} OFFSET #{page.offset}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="findAssignDetailByAssignmentid" parameterType="int" resultType="com.univ3e.entity.UnivAssignDetail" >
|
|
SELECT * FROM UnivAssignDetail
|
|
WHERE assignmentid = #{assignmentid}
|
|
ORDER BY unitid ASC,lessonid ASC
|
|
</select>
|
|
|
|
<select id="findAssigned" parameterType="map" resultType="com.univ3e.entity.UnivAssignMent" >
|
|
SELECT distinct a.assignmentId , a.teacherId , a.content , a.description ,
|
|
a.created , a.startTime , a.endTime , a.status , a.areaid , a.packageName
|
|
FROM UnivAssignment a
|
|
INNER JOIN UnivAssignToClass b
|
|
on a.assignmentId = b.assignmentId
|
|
WHERE a.status = 1
|
|
AND a.teacherId= #{teacherid}
|
|
<if test="areaid != null and areaid != 0">
|
|
and a.areaid = #{areaid}
|
|
</if>
|
|
<if test="nowtime != null">
|
|
and a.endTime > #{nowtime}
|
|
</if>
|
|
ORDER BY a.assignmentId desc
|
|
<if test="page != null">
|
|
LIMIT #{page.limit} OFFSET #{page.offset}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="findAssignmentTaskStatus" parameterType="map" resultType="com._3e.dto.AssignmentTaskStatus" >
|
|
<!-- SELECT a.studentId , round( avg(b.score) ) as avgScore ,count( distinct b.objectId ) as howmuch ,
|
|
count(b.objectId) as total , max(b.score) as maxScore, max( b.created ) as lastTime
|
|
FROM UnivStudentOwnClass a
|
|
LEFT JOIN UnivAchivement b
|
|
ON a.studentId = b.uid
|
|
<if test="startTime != null">
|
|
and b.created >= #{startTime}
|
|
</if>
|
|
<if test="endTime != null">
|
|
and b.created < #{endTime}
|
|
</if>
|
|
AND b.achiveType in ('L','W')
|
|
AND pointCaseType in (3, 5, 6 , 7 ,8 )
|
|
AND b.objectId in
|
|
<foreach item="item" index="index" collection="lessonIds"
|
|
open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
WHERE a.classesId = #{classesId} and a.status = 1
|
|
GROUP BY a.studentId
|
|
ORDER BY maxScore desc nulls last,avgScore desc nulls last,a.studentId
|
|
<if test="page != null">
|
|
LIMIT #{page.limit} OFFSET #{page.offset}
|
|
</if> -->
|
|
|
|
|
|
|
|
|
|
with temp as(select a.studentid from univstudentownclass a
|
|
inner join univstudent c on a.studentId = c.studentId and c.status=1 and a.status=1
|
|
where a.classesid=#{classesId} and a.status=1),
|
|
temp1 as(select b.uuid,a.studentId,b.uid,b.score,b.created,objectid,
|
|
row_number() OVER (PARTITION BY a.studentId order by b.score desc , b.created asc ) as rn
|
|
from temp a left join univachivement b
|
|
ON a.studentId = b.uid
|
|
AND b.achiveType in ('L','W')
|
|
AND pointCaseType in (3, 5, 6 , 7 ,8 ) AND b.objectId in
|
|
<foreach item="item" index="index" collection="lessonIds"
|
|
open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<if test="startTime != null">
|
|
and b.created >= #{startTime}
|
|
</if>
|
|
<if test="endTime != null">
|
|
and b.created < #{endTime}
|
|
</if> ),
|
|
temp2 as(select uid,uuid from temp1 where rn=1 and length(uuid)>0 ),
|
|
temp3 as (SELECT studentId , avg(score) as avgScore ,count( distinct objectId ) as howmuch ,
|
|
count(objectId) as total , max(score) as maxScore, max( created ) as lastTime
|
|
FROM temp1 group by studentid)
|
|
select a.studentId,a.avgScore,a.howmuch,a.total,a.maxScore,a.lastTime,b.uuid goodVoice from
|
|
temp3 a left join temp2 b on a.studentid=b.uid
|
|
ORDER BY maxScore desc nulls last,avgScore desc nulls last,a.studentId
|
|
<if test="page != null">
|
|
LIMIT #{page.limit} OFFSET #{page.offset}
|
|
</if>
|
|
|
|
</select>
|
|
|
|
|
|
<select id= "findOverdueAssignment_1" parameterType="map" resultType="com._3e.http.myhome.dto._3EResAssignment_1" >
|
|
<!-- with temp1 as ( select distinct a.assignmentid , a.classesid
|
|
from univAssignToClass a
|
|
where a.classesid in
|
|
<foreach item="item" index="index" collection="classeslists"
|
|
open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
),
|
|
temp2 as ( select c.assignmentid , c.classesid , d.classname
|
|
from temp1 c
|
|
inner join univClasses d
|
|
on c.classesid = d.classesid )
|
|
SELECT b.assignmentid, b.content , b.description, b.starttime, b.endtime, b.assigntype, b.created, a.classname,
|
|
0 as examid,'' as examtype,'' as title,'' as exampapers,-1 as isnetexam,0 as teacherid,-100 as isoral,a.classesid
|
|
from temp2 a
|
|
inner join univassignment b
|
|
on a.assignmentid = b.assignmentid
|
|
where now() > b.endtime and b.assigntype in ( 'L' , 'W' ) -->
|
|
|
|
|
|
|
|
with temp1 as ( select distinct a.assignmentid , a.classesid
|
|
from univAssignToClass a
|
|
where a.classesid in
|
|
<foreach item="item" index="index" collection="classeslists"
|
|
open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
),
|
|
temp2 as ( select c.assignmentid , c.classesid , d.classname
|
|
from temp1 c
|
|
inner join univClasses d
|
|
on c.classesid = d.classesid )
|
|
SELECT b.assignmentid, b.content , b.description, b.starttime, b.endtime, b.assigntype, b.created, a.classname,
|
|
0 as examid,'' as examtype,'' as title,'' as exampapers,-1 as isnetexam,0 as teacherid,-100 as isoral,a.classesid
|
|
from temp2 a
|
|
inner join univassignment b
|
|
on a.assignmentid = b.assignmentid
|
|
where now() > b.endtime and b.assigntype in ( 'L' , 'W' )
|
|
|
|
union all
|
|
|
|
SELECT a.examid as assignmentid,'' as content , b.description, b.starttime, b.endtime,'' as assigntype, b.created, c.classname ,
|
|
b.examid,b.examtype,b.title,b.exampapers,b.isnetexam, b.teacherid, b.isoral,a.classesid
|
|
from univClassOwnExam a
|
|
inner join univClasses c on a.classesid=c.classesid and a.classesid in
|
|
<foreach item="item1" index="index" collection="classeslists"
|
|
open="(" separator="," close=")">
|
|
#{item1}
|
|
</foreach>
|
|
inner join univExam b
|
|
on a.examid = b.examid and b.examType='S'
|
|
where now() >b.endtime
|
|
|
|
|
|
union all
|
|
SELECT a.examid as assignmentid,'' as content , b.description, b.starttime, b.endtime,'' as assigntype, b.created, c.classname ,
|
|
b.examid,b.examtype,b.title,'' as exampapers,b.isnetexam, b.teacherid, -1 as isoral,a.classesid
|
|
from univClassOwnhear a
|
|
inner join univClasses c on a.classesid=c.classesid and a.classesid in
|
|
<foreach item="item2" index="index" collection="classeslists"
|
|
open="(" separator="," close=")">
|
|
#{item2}
|
|
</foreach>
|
|
inner join univhearexam b
|
|
on a.examid = b.examid and b.examType='S'
|
|
where now()>b.endtime
|
|
|
|
order by created desc,assignmentid desc
|
|
|
|
<if test="page != null">
|
|
LIMIT #{page.limit} OFFSET #{page.offset}
|
|
</if>
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getFinishAssignStatWordByUid" parameterType="java.util.Map" resultType="com._3e.entity.FinishAssignStat">
|
|
SELECT a.assignmentid ,count(distinct(w.wordsId )) as "lessoncount",max(ac.score) "maxscore",
|
|
avg(ac.score) "avgscore",max(ac.created) created,
|
|
count(ac.wordsid) as howmuch,count( distinct ac.wordsid) as "completecount"
|
|
FROM UnivAssignDetail a
|
|
inner join UnivAssignment s
|
|
on a.assignmentId = s.assignmentId
|
|
and s.status= 1 and a.assignmentId = #{assignmentid}
|
|
inner join words w
|
|
on a.unitid=w.lessonid
|
|
|
|
left join univwordachive ac
|
|
on ac.uid = #{uid} and ac.wordsid = w.wordsid
|
|
|
|
and ac.created <= s.endTime and ac.created > s.startTime
|
|
|
|
group by a.assignmentId
|
|
|
|
</select>
|
|
|
|
<select id="getFinishAssignStatLessonByUid" parameterType="java.util.Map" resultType="com._3e.entity.FinishAssignStat">
|
|
SELECT a.assignmentid ,count(distinct a.lessonId) as "lessoncount",max(ac.score) "maxscore",
|
|
avg(ac.score) "avgscore",max(ac.created) created,
|
|
count(ac.objectId) as howmuch,count( distinct ac.objectId) as "completecount"
|
|
FROM UnivAssignDetail a
|
|
inner join UnivAssignment s
|
|
on a.assignmentId = s.assignmentId
|
|
and s.status= 1 and a.assignmentId = #{assignmentid}
|
|
|
|
|
|
left join UnivAchivement ac
|
|
on ac.uid = #{uid} and ac.objectid = a.lessonId
|
|
|
|
and ac.created <= s.endTime and ac.created > s.startTime
|
|
|
|
group by a.assignmentId
|
|
</select>
|
|
|
|
|
|
<select id= "findOverdueEAssignment" parameterType="map" resultType="com._3e.http.myhome.dto._3EResAssignment_1" >
|
|
with temp1 as ( select distinct a.classesid , a.examid
|
|
from univClassOwnExam a
|
|
where a.classesid in
|
|
<foreach item="item" index="index" collection="classeslists"
|
|
open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach> ),
|
|
temp2 as ( select c.examid , c.classesid , d.classname
|
|
from temp1 c
|
|
inner join univClasses d
|
|
on c.classesid = d.classesid )
|
|
SELECT a.examid as assignmentid,'' as content , b.description, b.starttime, b.endtime,'' as assigntype, b.created, a.classname ,
|
|
b.examid,b.examtype,b.title,b.exampapers,b.isnetexam, b.teacherid, b.isoral
|
|
from temp2 a
|
|
inner join univExam b
|
|
on a.examid = b.examid
|
|
where now() > b.endtime
|
|
</select>
|
|
|
|
|
|
<select id="findAllAssignByAllClass_1" parameterType="map"
|
|
resultType="com._3e.http.myhome.dto._3EResAssignment">
|
|
SELECT b.assignmentid,b.content,b.description,b.starttime,b.created,
|
|
b.endtime,b.assigntype,l.className,l.classesid
|
|
FROM UNIVASSIGNMENT b
|
|
inner JOIN univassigntoclass C ON b.assignmentid = C.assignmentid
|
|
LEFT JOIN univclasses l ON c.classesid = l.classesid
|
|
WHERE b.assignmentid = C.assignmentid
|
|
AND b.status = '1' AND C.classesid in
|
|
<foreach item="classes" index="index" collection="classesList"
|
|
open="(" separator="," close=")">
|
|
#{classes.classesid}
|
|
</foreach>
|
|
<if test="status == 1">
|
|
and now() <= b.endtime
|
|
</if>
|
|
<if test="status == 2">
|
|
and now() > b.endtime
|
|
</if>
|
|
<if test="assigntype!=null">
|
|
and b.assigntype=#{assigntype}
|
|
</if>
|
|
ORDER BY b.created DESC
|
|
<if test="page != null">
|
|
LIMIT #{page.limit} OFFSET #{page.offset}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="findAssignByClassid_2" parameterType="map"
|
|
resultType="com._3e.http.myhome.dto._3EResAssignment">
|
|
with temp1 as(
|
|
SELECT classesid,assignmentid,areaid from univassigntoclass
|
|
where classesid=#{classid}
|
|
)
|
|
SELECT b.assignmentid,b.content,b.description,b.starttime,b.created,b.endtime,b.assigntype,l.classname,a.classesid
|
|
from temp1 a
|
|
inner join univassignment b
|
|
on a.assignmentid=b.assignmentid
|
|
and b.status=1
|
|
<if test="status == '1'.toString()">
|
|
and now() <= b.endtime
|
|
</if>
|
|
<if test="assigntype!=null">
|
|
and b.assigntype=#{assigntype}
|
|
</if>
|
|
inner join univclasses l
|
|
on a.classesid=l.classesid
|
|
ORDER BY b.created desc
|
|
<if test="page != null">
|
|
LIMIT #{page.limit} OFFSET #{page.offset}
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<select id="findAssignmentTaskStatusOfWord" parameterType="map"
|
|
resultType="com._3e.dto.AssignmentTaskStatus">
|
|
with temp as (
|
|
select wordsid from words where lessonid in
|
|
<foreach item="lessonId" index="index" collection="lessonIds"
|
|
open="(" separator="," close=")">
|
|
#{lessonId}
|
|
</foreach> ),
|
|
temp1 as (select count(wordsid) howmuch from temp)
|
|
SELECT a.studentId , round( avg(b.score) ) as avgScore ,
|
|
count( distinct b.wordsid ) as howmuch ,
|
|
count(b.wordsid) as total ,
|
|
max(b.score) as maxScore,
|
|
max( b.created ) as lastTime ,count( distinct b.wordsid )||'/'||(select * from temp1) as finishWords
|
|
FROM UnivStudentOwnClass a
|
|
inner join univstudent c on a.studentId = c.studentId and c.status=1 and a.status=1
|
|
left JOIN univwordAchive b
|
|
ON a.studentId = b.uid
|
|
|
|
<if test="startTime!=null">
|
|
<![CDATA[
|
|
and b.created >= #{startTime}
|
|
]]>
|
|
</if>
|
|
<if test="endTime!=null">
|
|
<![CDATA[
|
|
and b.created < #{endTime}
|
|
]]>
|
|
</if>
|
|
AND b.wordsid in
|
|
(select wordsid from temp)
|
|
WHERE a.classesId = #{classesId} and a.status = 1
|
|
GROUP BY a.studentId
|
|
order by maxScore desc nulls last,avgScore desc nulls last,studentId
|
|
<if test="page != null">
|
|
LIMIT #{page.limit} OFFSET #{page.offset}
|
|
</if>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<update id="doUpdateAssignment" parameterType="com.univ3e.entity.UnivAssignMent">
|
|
UPDATE univassignment
|
|
<set>
|
|
<if test="teacherid != null">
|
|
teacherid = #{teacherid},
|
|
</if>
|
|
<if test="content != null">
|
|
content = #{content},
|
|
</if>
|
|
<if test="description != null">
|
|
description = #{description},
|
|
</if>
|
|
<if test="created != null">
|
|
created = #{created},
|
|
</if>
|
|
<if test="starttime != null">
|
|
starttime = #{starttime},
|
|
</if>
|
|
<if test="endtime != null">
|
|
endtime = #{endtime},
|
|
</if>
|
|
<if test="status != null">
|
|
status = #{status},
|
|
</if>
|
|
<if test="areaid != null">
|
|
areaid = #{areaid},
|
|
</if>
|
|
<if test="packagename != null">
|
|
packagename = #{packagename},
|
|
</if>
|
|
<if test="assigntype != null">
|
|
assigntype = #{assigntype}
|
|
</if>
|
|
</set>
|
|
WHERE assignmentid = #{assignmentid}
|
|
</update>
|
|
</mapper>
|