524 lines
20 KiB
XML
524 lines
20 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.AssignmentDao">
|
||
|
|
|
||
|
|
<select id= "getNextSeq" resultType="int">
|
||
|
|
SELECT NEXTVAL('seq_assignmentid')
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id= "doSave" parameterType="com._3e.entity.Assignment" >
|
||
|
|
INSERT INTO assignment(
|
||
|
|
assignmentid, teacherid, content, description, created, starttime,
|
||
|
|
endtime, status, areaid, packagename, assigntype,pointCaseTypes,assignTime)
|
||
|
|
VALUES (
|
||
|
|
<if test="assignmentid == 0">
|
||
|
|
(SELECT NEXTVAL('seq_assignmentid')),
|
||
|
|
</if>
|
||
|
|
<if test="assignmentid != 0">
|
||
|
|
#{assignmentid},
|
||
|
|
</if>
|
||
|
|
#{teacherid}, #{content}, #{description}, #{created}, #{starttime},
|
||
|
|
#{endtime}, #{status}, #{areaid}, #{packagename}, #{assigntype},#{pointCaseTypes, jdbcType=ARRAY, typeHandler=com._3e.http.wrongbook.typehandler.SmallIntArrayTypeHandler},
|
||
|
|
#{assignTime});
|
||
|
|
</insert>
|
||
|
|
<update id="doSaveUpdate" parameterType="com._3e.entity.Assignment" >
|
||
|
|
UPDATE assignment
|
||
|
|
<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>
|
||
|
|
|
||
|
|
<select id= "findIsAssignToClass" parameterType="map" resultType="boolean" >
|
||
|
|
SELECT CASE WHEN (COUNT(*) > 0) THEN true ELSE false END AS isAs
|
||
|
|
FROM assigntoclass
|
||
|
|
WHERE assignmentid = #{assignmentid} and classesid =#{classesid}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id= "doSaveAssignToClasses" parameterType="com._3e.entity.Assigntoclass">
|
||
|
|
INSERT INTO assigntoclass(
|
||
|
|
classesid, assignmentid, areaid)
|
||
|
|
VALUES (#{classesid}, #{assignmentid}, #{areaid})
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<insert id= "doSetAssignDetail" parameterType="com._3e.entity.Assigndetail">
|
||
|
|
INSERT INTO assigndetail(
|
||
|
|
assigndetailid, assignmentid, assigntype, unitid, lessonid, title,
|
||
|
|
areaid)
|
||
|
|
VALUES (
|
||
|
|
<if test="assigndetailid == 0">
|
||
|
|
(SELECT NEXTVAL('seq_assigndetailid')),
|
||
|
|
</if>
|
||
|
|
<if test="assigndetailid != 0">
|
||
|
|
#{assigndetailid},
|
||
|
|
</if>
|
||
|
|
#{assignmentid}, #{assigntype}, #{unitid}, #{lessonid}, #{title},
|
||
|
|
#{areaid})
|
||
|
|
</insert>
|
||
|
|
<insert id= "doSetAssignDetailNum" parameterType="com._3e.entity.Assigndetail">
|
||
|
|
INSERT INTO assigndetail(
|
||
|
|
assigndetailid, assignmentid, assigntype, unitid, lessonid, title,
|
||
|
|
areaid,number)
|
||
|
|
VALUES (
|
||
|
|
<if test="assigndetailid == 0">
|
||
|
|
(SELECT NEXTVAL('seq_assigndetailid')),
|
||
|
|
</if>
|
||
|
|
<if test="assigndetailid != 0">
|
||
|
|
#{assigndetailid},
|
||
|
|
</if>
|
||
|
|
#{assignmentid}, #{assigntype}, #{unitid}, #{lessonid}, #{title},
|
||
|
|
#{areaid},#{number})
|
||
|
|
</insert>
|
||
|
|
<insert id="doSetCustomizeAssignDetail">
|
||
|
|
INSERT INTO assigndetail(
|
||
|
|
assigndetailid, assignmentid, assigntype, unitid, lessonid, title,
|
||
|
|
areaid,medias)
|
||
|
|
VALUES (
|
||
|
|
<if test="assigndetailid == 0">
|
||
|
|
(SELECT NEXTVAL('seq_assigndetailid')),
|
||
|
|
</if>
|
||
|
|
<if test="assigndetailid != 0">
|
||
|
|
#{assigndetailid},
|
||
|
|
</if>
|
||
|
|
#{assignmentid}, #{assigntype}, #{unitid}, #{lessonid}, #{title},
|
||
|
|
#{areaid},
|
||
|
|
#{medias,typeHandler=com._3e.http.wrongbook.typehandler.JSONTypeHandlerPg})
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<select id= "findStuAssignmentProgress" parameterType="map" resultType="com._3e.dto.AssignmentProgressDto" >
|
||
|
|
with temp as ( select objectId , created
|
||
|
|
from Achivement
|
||
|
|
where areaid = #{areaid}
|
||
|
|
<if test="created != null">
|
||
|
|
and created > #{created}
|
||
|
|
</if>
|
||
|
|
and uid = #{uid} and pointcasetype in ( 3 , 5 , 6 , 7,8) )
|
||
|
|
SELECT a.assignDetailId , a.assignmentId , a.assignType , a.unitId ,
|
||
|
|
a.lessonId , a.title , a.areaid , count(ac.objectId) as finishCount
|
||
|
|
FROM AssignDetail a
|
||
|
|
inner join Assignment s
|
||
|
|
on a.assignmentId = s.assignmentId and s.startTime < now() and s.assignType='L'
|
||
|
|
and s.endTime > now() and s.status= 1
|
||
|
|
inner join AssignToClass t
|
||
|
|
on t.assignmentid = s.assignmentid
|
||
|
|
inner join Classes c
|
||
|
|
on c.classesid = t.classesid and c.status = 1
|
||
|
|
inner join StudentOwnClass so
|
||
|
|
on so.classesid = c.classesid and so.areaid = #{areaid} and so.status = 1
|
||
|
|
and so.studentid = #{uid}
|
||
|
|
inner join Lesson l
|
||
|
|
on ((l.lessonid = a.unitid) or (l.lessonId = a.lessonId))
|
||
|
|
<choose>
|
||
|
|
<when test="units == null or units.size() == 0">
|
||
|
|
and 1=2
|
||
|
|
</when>
|
||
|
|
<otherwise>
|
||
|
|
and l.parentid in
|
||
|
|
<foreach item="unitId" index="index" collection="units"
|
||
|
|
open="(" separator="," close=")">
|
||
|
|
#{unitId}
|
||
|
|
</foreach>
|
||
|
|
and l.status = 1
|
||
|
|
</otherwise>
|
||
|
|
</choose>
|
||
|
|
left join temp ac
|
||
|
|
on ac.objectid = a.lessonId
|
||
|
|
and ac.created <= s.endTime and ac.created > s.startTime
|
||
|
|
group by a.assignDetailId , a.assignmentId , a.assignType ,
|
||
|
|
a.unitId , a.lessonId , a.title , a.areaid
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<select id= "findStuAssignment" parameterType="map" resultType="com._3e.dto.AssignmentProgressDto" >
|
||
|
|
SELECT a.assignDetailId , a.assignmentId , a.assignType , a.unitId ,
|
||
|
|
a.lessonId , a.number,a.title , a.areaid ,s.starttime,s.endtime,s.pointCaseTypes::text
|
||
|
|
FROM AssignDetail a
|
||
|
|
inner join Assignment s
|
||
|
|
on a.assignmentId = s.assignmentId and s.startTime < now() and s.assignType='L'
|
||
|
|
and s.endTime > now() and s.status= 1
|
||
|
|
inner join AssignToClass t
|
||
|
|
on t.assignmentid = s.assignmentid
|
||
|
|
inner join Classes c
|
||
|
|
on c.classesid = t.classesid and c.status = 1
|
||
|
|
inner join StudentOwnClass so
|
||
|
|
on so.classesid = c.classesid and so.areaid = #{areaid} and so.status = 1
|
||
|
|
and so.studentid = #{uid}
|
||
|
|
inner join Lesson l
|
||
|
|
on ((l.lessonid = a.unitid) or (l.lessonId = a.lessonId))
|
||
|
|
<choose>
|
||
|
|
<when test="units == null or units.size() == 0">
|
||
|
|
and 1=2
|
||
|
|
</when>
|
||
|
|
<otherwise>
|
||
|
|
and l.parentid in
|
||
|
|
<foreach item="unitId" index="index" collection="units"
|
||
|
|
open="(" separator="," close=")">
|
||
|
|
#{unitId}
|
||
|
|
</foreach>
|
||
|
|
and l.status = 1
|
||
|
|
</otherwise>
|
||
|
|
</choose>
|
||
|
|
order by s.starttime
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "findStuAssignmentProgressOfWord" parameterType="map" resultType="com._3e.dto.AssignmentProgressDto" >
|
||
|
|
with base as (
|
||
|
|
select w.lessonid,w.wordsid
|
||
|
|
from lesson l
|
||
|
|
inner join words w on w.status = 1 and
|
||
|
|
<choose>
|
||
|
|
<when test="units == null or units.size() == 0">
|
||
|
|
1=2
|
||
|
|
</when>
|
||
|
|
<otherwise>
|
||
|
|
l.parentid in
|
||
|
|
<foreach item="unitId" index="index" collection="units"
|
||
|
|
open="(" separator="," close=")">
|
||
|
|
#{unitId}
|
||
|
|
</foreach>
|
||
|
|
</otherwise>
|
||
|
|
</choose>
|
||
|
|
and w.lessonid=l.lessonid),
|
||
|
|
temp as (
|
||
|
|
select b.lessonid ,a.wordsid ,created
|
||
|
|
from base b
|
||
|
|
left join wordachive a
|
||
|
|
on uid = #{uid} and a.areaid = #{areaid} and b.wordsid=a.wordsid ) ,
|
||
|
|
temp2 as (
|
||
|
|
select s.assignmentId , s.startTime , s.endtime
|
||
|
|
from StudentOwnClass so
|
||
|
|
inner join Classes c
|
||
|
|
on so.studentid = #{uid} and so.areaid = #{areaid} and so.classesid = c.classesid
|
||
|
|
and so.status = 1 and c.status = 1
|
||
|
|
inner join AssignToClass t
|
||
|
|
on c.classesid = t.classesid
|
||
|
|
inner join Assignment s
|
||
|
|
on t.assignmentid = s.assignmentid
|
||
|
|
and s.startTime < now() and s.endTime > now()
|
||
|
|
and s.status= 1 and s.assignType='W' )
|
||
|
|
|
||
|
|
SELECT a.assignDetailId , a.assignmentId , a.assignType , a.unitId ,
|
||
|
|
a.lessonId , a.title , a.areaid ,
|
||
|
|
case when count(distinct b.wordsid )=count(distinct ac.wordsid ) then 1
|
||
|
|
else 0 end as finishWords,
|
||
|
|
count(distinct ac.wordsid )||'/'||count(distinct b.wordsid ) as finishCount
|
||
|
|
FROM temp2 t
|
||
|
|
inner join AssignDetail a on t.assignmentId = a.assignmentId
|
||
|
|
inner join base b
|
||
|
|
on a.unitid = b.lessonid
|
||
|
|
left join temp ac
|
||
|
|
on ac.created <= t.endTime and ac.created > t.startTime and a.unitid=ac.lessonid
|
||
|
|
group by a.assignDetailId , a.assignmentId , a.assignType , a.unitId , a.lessonId , a.title , a.areaid
|
||
|
|
order by a.assignmentId desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "findUnivStuAssignmentProgress" parameterType="map" resultType="com._3e.dto.AssignmentProgressDto" >
|
||
|
|
SELECT a.assignDetailId , a.assignmentId , a.assignType , a.unitId , a.lessonId , a.title , a.areaid , count(ac.objectId) as finishCount
|
||
|
|
FROM UnivAssignDetail a inner join UnivAssignment s on a.assignmentId = s.assignmentId and s.endTime > now() and s.startTime < now() and s.status= 1
|
||
|
|
inner join UnivAssignToClass t on t.assignmentid = s.assignmentid
|
||
|
|
inner join UnivClasses c on c.classesid = t.classesid and c.status = 1
|
||
|
|
inner join UnivStudentOwnClass so on so.classesid = c.classesid and so.status = 1 and so.studentid = #{uid}
|
||
|
|
inner join Lesson l on ((l.lessonid = a.unitid) or (l.lessonId = a.lessonId))
|
||
|
|
<choose>
|
||
|
|
<when test="units == null or units.size() == 0">
|
||
|
|
and 1=2
|
||
|
|
</when>
|
||
|
|
<otherwise>
|
||
|
|
and l.parentid in
|
||
|
|
<foreach item="unitId" index="index" collection="units"
|
||
|
|
open="(" separator="," close=")">
|
||
|
|
#{unitId}
|
||
|
|
</foreach>
|
||
|
|
and l.status = 1
|
||
|
|
</otherwise>
|
||
|
|
</choose>
|
||
|
|
left join UnivAchivement ac on ac.uid = so.studentId and ac.objectid = a.lessonId and ac.created <= s.endTime and ac.created > s.startTime
|
||
|
|
group by a.assignDetailId , a.assignmentId , a.assignType , a.unitId , a.lessonId , a.title , a.areaid
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "findTeaAssignmentProgress" parameterType="map" resultType="com._3e.dto.AssignmentProgressDto" >
|
||
|
|
SELECT a.assignDetailId , a.assignmentId , a.assignType , a.unitId , a.lessonId , a.title , a.areaid , count(ac.objectId) as finishCount ,s.pointCaseTypes::text
|
||
|
|
FROM AssignDetail a inner join Assignment s on a.assignmentId = s.assignmentId and s.endTime > now() and s.assignType='L'
|
||
|
|
and s.teacherId = #{uid} and s.status= 1
|
||
|
|
inner join Lesson l on ((l.lessonid = a.unitid) or (l.lessonId = a.lessonId))
|
||
|
|
<choose>
|
||
|
|
<when test="units == null or units.size() == 0">
|
||
|
|
and 1=2
|
||
|
|
</when>
|
||
|
|
<otherwise>
|
||
|
|
and l.parentid in
|
||
|
|
<foreach item="unitId" index="index" collection="units"
|
||
|
|
open="(" separator="," close=")">
|
||
|
|
#{unitId}
|
||
|
|
</foreach>
|
||
|
|
</otherwise>
|
||
|
|
</choose>
|
||
|
|
left join Achivement ac on ac.areaid = #{areaid} and ac.uid = s.teacherId and ac.objectid = a.lessonId and ac.created <= s.endTime and ac.created > s.startTime
|
||
|
|
group by a.assignDetailId , a.assignmentId , a.assignType , a.unitId , a.lessonId , a.title , a.areaid ,s.pointCaseTypes::text
|
||
|
|
</select>
|
||
|
|
<select id= "findTeaAssignmentProgressOfWord" parameterType="map" resultType="com._3e.dto.AssignmentProgressDto" >
|
||
|
|
with base as(
|
||
|
|
select w.lessonid,wordsid from words w inner join lesson l on w.lessonid=l.lessonid
|
||
|
|
<choose>
|
||
|
|
<when test="units == null or units.size() == 0">
|
||
|
|
and 1=2
|
||
|
|
</when>
|
||
|
|
<otherwise>
|
||
|
|
and l.parentid in
|
||
|
|
<foreach item="unitId" index="index" collection="units"
|
||
|
|
open="(" separator="," close=")">
|
||
|
|
#{unitId}
|
||
|
|
</foreach>
|
||
|
|
</otherwise>
|
||
|
|
</choose>
|
||
|
|
group by w.lessonid,wordsid order by w.lessonid ),
|
||
|
|
temp as(
|
||
|
|
select b.lessonid ,a.wordsid ,created from base b
|
||
|
|
left join wordachive a
|
||
|
|
on a.areaid = #{areaid} and b.wordsid=a.wordsid and uid=#{uid})
|
||
|
|
|
||
|
|
SELECT a.assignDetailId , a.assignmentId , a.assignType , a.unitId ,
|
||
|
|
a.lessonId , a.title , a.areaid ,case when count(distinct(b.wordsid))=count(distinct(ac.wordsid)) then 1 else 0 end as finishCount
|
||
|
|
FROM AssignDetail a
|
||
|
|
inner join Assignment s
|
||
|
|
on a.assignmentId = s.assignmentId and s.startTime < now() and s.endTime > now() and s.status= 1 and s.assignType='W'
|
||
|
|
and s.teacherId=#{uid}
|
||
|
|
left join temp ac
|
||
|
|
on ac.created <= s.endTime and ac.created > s.startTime and a.unitid=ac.lessonid
|
||
|
|
inner join base b
|
||
|
|
on b.lessonid=a.unitid
|
||
|
|
group by a.assignDetailId , a.assignmentId , a.assignType , a.unitId , a.lessonId , a.title , a.areaid
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "findUnivTeaAssignmentProgress" parameterType="map" resultType="com._3e.dto.AssignmentProgressDto" >
|
||
|
|
SELECT a.assignDetailId , a.assignmentId , a.assignType , a.unitId , a.lessonId , a.title , a.areaid , count(ac.objectId) as finishCount
|
||
|
|
FROM UnivAssignDetail a inner join UnivAssignment s on a.assignmentId = s.assignmentId and s.endTime > now() and s.startTime < now() and s.teacherId = #{uid} and s.status= 1
|
||
|
|
inner join Lesson l on ((l.lessonid = a.unitid) or (l.lessonId = a.lessonId))
|
||
|
|
<choose>
|
||
|
|
<when test="units == null or units.size() == 0">
|
||
|
|
and 1=2
|
||
|
|
</when>
|
||
|
|
<otherwise>
|
||
|
|
and l.parentid in
|
||
|
|
<foreach item="unitId" index="index" collection="units"
|
||
|
|
open="(" separator="," close=")">
|
||
|
|
#{unitId}
|
||
|
|
</foreach>
|
||
|
|
</otherwise>
|
||
|
|
</choose>
|
||
|
|
left join UnivAchivement ac on ac.uid = s.teacherId and ac.objectid = a.lessonId and ac.created <= s.endTime and ac.created > s.startTime
|
||
|
|
group by a.assignDetailId , a.assignmentId , a.assignType , a.unitId , a.lessonId , a.title , a.areaid
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "findAssignmentMaxScore" parameterType="map" resultType="com._3e.dto.AssignmentMaxScore" >
|
||
|
|
WITH temp AS (
|
||
|
|
SELECT a.assignmentid , d.lessonId , a.startTime , a.endTime
|
||
|
|
FROM Assignment a
|
||
|
|
INNER JOIN assigndetail d
|
||
|
|
ON a.starttime <= now() AND a.endtime >= now()
|
||
|
|
AND d.assignmentid = a.assignmentid AND d.lessonid = #{lessonid}
|
||
|
|
),
|
||
|
|
temp2 AS ( SELECT b.objectId , b.score , b.created
|
||
|
|
FROM Achivement b
|
||
|
|
WHERE b.uid = #{uid} AND b.achivetype = 'L'
|
||
|
|
AND b.objectid = #{lessonid} and b.areaid = #{areaid}
|
||
|
|
<if test="created != null">
|
||
|
|
and created > #{created}
|
||
|
|
</if>
|
||
|
|
)
|
||
|
|
SELECT a.assignmentid , max(score) AS maxscore
|
||
|
|
FROM temp AS a
|
||
|
|
INNER JOIN temp2 AS c
|
||
|
|
ON c.objectid = a.lessonid
|
||
|
|
WHERE a.starttime <= c.created AND a.endtime >= c.created
|
||
|
|
GROUP BY a.assignmentid ;
|
||
|
|
</select>
|
||
|
|
<select id= "findAssignmentMaxScoreV2" parameterType="map" resultType="com._3e.dto.AssignmentMaxScore" >
|
||
|
|
WITH temp AS (
|
||
|
|
SELECT a.assignmentid , d.lessonId , a.startTime , a.endTime ,a.pointcasetypes
|
||
|
|
FROM Assignment a
|
||
|
|
INNER JOIN assigndetail d
|
||
|
|
ON a.starttime <= now() AND a.endtime >= now()
|
||
|
|
AND d.assignmentid = a.assignmentid AND d.lessonid = #{lessonid} and #{pointCaseType}=ANY(a.pointcasetypes)
|
||
|
|
),
|
||
|
|
temp2 AS ( SELECT b.objectId , b.score , b.created ,b.pointcasetype
|
||
|
|
FROM Achivement b
|
||
|
|
WHERE b.uid = #{uid} AND b.achivetype = 'L'
|
||
|
|
AND b.objectid = #{lessonid} and b.areaid = #{areaid}
|
||
|
|
<if test="created != null">
|
||
|
|
and created > #{created}
|
||
|
|
</if>
|
||
|
|
)
|
||
|
|
SELECT a.assignmentid , max(score) AS maxscore
|
||
|
|
FROM temp AS a
|
||
|
|
INNER JOIN temp2 AS c
|
||
|
|
ON c.objectid = a.lessonid and c.pointcasetype = ANY(a.pointcasetypes)
|
||
|
|
WHERE a.starttime <= c.created AND a.endtime >= c.created
|
||
|
|
GROUP BY a.assignmentid ;
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id= "findUnivAssignmentMaxScore" parameterType="map" resultType="com._3e.dto.AssignmentMaxScore" >
|
||
|
|
WITH temp AS (
|
||
|
|
SELECT a.assignmentid , d.lessonId , a.startTime , a.endTime
|
||
|
|
FROM univAssignment a
|
||
|
|
INNER JOIN univassigndetail d
|
||
|
|
ON a.starttime <= now() AND a.endtime >= now()
|
||
|
|
AND d.assignmentid = a.assignmentid AND d.lessonid = #{lessonid}
|
||
|
|
),
|
||
|
|
temp2 AS ( SELECT b.objectId , b.score , b.created
|
||
|
|
FROM univAchivement b
|
||
|
|
WHERE b.uid = #{uid} AND b.achivetype = 'L'
|
||
|
|
AND b.objectid = #{lessonid} )
|
||
|
|
SELECT a.assignmentid , max(score) AS maxscore
|
||
|
|
FROM temp AS a
|
||
|
|
INNER JOIN temp2 AS c
|
||
|
|
ON c.objectid = a.lessonid
|
||
|
|
WHERE a.starttime <= c.created AND a.endtime >= c.created
|
||
|
|
GROUP BY a.assignmentid ;
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<select id= "findUnivStuAssignmentProgressOfWord" parameterType="map" resultType="com._3e.dto.AssignmentProgressDto" >
|
||
|
|
with base as (
|
||
|
|
select w.lessonid,w.wordsid
|
||
|
|
from lesson l
|
||
|
|
inner join words w on
|
||
|
|
<choose>
|
||
|
|
<when test="units == null or units.size() == 0">
|
||
|
|
1=2
|
||
|
|
</when>
|
||
|
|
<otherwise>
|
||
|
|
l.parentid in
|
||
|
|
<foreach item="unitId" index="index" collection="units"
|
||
|
|
open="(" separator="," close=")">
|
||
|
|
#{unitId}
|
||
|
|
</foreach>
|
||
|
|
</otherwise>
|
||
|
|
</choose>
|
||
|
|
and w.lessonid=l.lessonid ),
|
||
|
|
temp as (
|
||
|
|
select b.lessonid ,a.wordsid ,created
|
||
|
|
from base b
|
||
|
|
left join univwordachive a
|
||
|
|
on uid = #{uid} and b.wordsid=a.wordsid ) ,
|
||
|
|
temp2 as (
|
||
|
|
select s.assignmentId , s.startTime , s.endtime
|
||
|
|
from univStudentOwnClass so
|
||
|
|
inner join univClasses c
|
||
|
|
on so.studentid = #{uid} and so.classesid = c.classesid
|
||
|
|
and so.status = 1 and c.status = 1
|
||
|
|
inner join univAssignToClass t
|
||
|
|
on c.classesid = t.classesid
|
||
|
|
inner join univAssignment s
|
||
|
|
on t.assignmentid = s.assignmentid
|
||
|
|
and s.startTime < now() and s.endTime > now()
|
||
|
|
and s.status= 1 and s.assignType='W' )
|
||
|
|
|
||
|
|
SELECT a.assignDetailId , a.assignmentId , a.assignType , a.unitId ,
|
||
|
|
a.lessonId , a.title , a.areaid ,
|
||
|
|
case when count(distinct b.wordsid )=count(distinct ac.wordsid ) then 1
|
||
|
|
else 0 end as finishWords,
|
||
|
|
count(distinct ac.wordsid )||'/'||count(distinct b.wordsid ) as finishCount
|
||
|
|
FROM temp2 t
|
||
|
|
inner join univAssignDetail a on t.assignmentId = a.assignmentId
|
||
|
|
inner join base b
|
||
|
|
on a.unitid = b.lessonid
|
||
|
|
left join temp ac
|
||
|
|
on ac.created <= t.endTime and ac.created > t.startTime and a.unitid=ac.lessonid
|
||
|
|
group by a.assignDetailId , a.assignmentId , a.assignType , a.unitId , a.lessonId , a.title , a.areaid
|
||
|
|
order by a.assignmentId desc
|
||
|
|
</select>
|
||
|
|
<select id= "findUnivTeaAssignmentProgressOfWord" parameterType="map" resultType="com._3e.dto.AssignmentProgressDto" >
|
||
|
|
with base as(
|
||
|
|
select w.lessonid,wordsid from words w inner join lesson l on w.lessonid=l.lessonid
|
||
|
|
<choose>
|
||
|
|
<when test="units == null or units.size() == 0">
|
||
|
|
and 1=2
|
||
|
|
</when>
|
||
|
|
<otherwise>
|
||
|
|
and l.parentid in
|
||
|
|
<foreach item="unitId" index="index" collection="units"
|
||
|
|
open="(" separator="," close=")">
|
||
|
|
#{unitId}
|
||
|
|
</foreach>
|
||
|
|
</otherwise>
|
||
|
|
</choose>
|
||
|
|
group by w.lessonid,wordsid order by w.lessonid ),
|
||
|
|
temp as(
|
||
|
|
select b.lessonid ,a.wordsid ,created from base b
|
||
|
|
left join univwordachive a
|
||
|
|
on b.wordsid=a.wordsid and uid=#{uid})
|
||
|
|
|
||
|
|
SELECT a.assignDetailId , a.assignmentId , a.assignType , a.unitId ,
|
||
|
|
a.lessonId , a.title , a.areaid ,case when count(distinct(b.wordsid))=count(distinct(ac.wordsid)) then 1 else 0 end as finishCount
|
||
|
|
FROM univAssignDetail a
|
||
|
|
inner join univAssignment s
|
||
|
|
on a.assignmentId = s.assignmentId and s.startTime < now() and s.endTime > now() and s.status= 1 and s.assignType='W'
|
||
|
|
and s.teacherId=#{uid}
|
||
|
|
left join temp ac
|
||
|
|
on ac.created <= s.endTime and ac.created > s.startTime and a.unitid=ac.lessonid
|
||
|
|
inner join base b
|
||
|
|
on b.lessonid=a.unitid
|
||
|
|
group by a.assignDetailId , a.assignmentId , a.assignType , a.unitId , a.lessonId , a.title , a.areaid
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<!--查询老师布置的课程作业次数和单词作业次数-->
|
||
|
|
<select id="findLessionNumAndWordNumByTeacherid" parameterType="map" resultType="com._3e.http.teachercenter.dto.management._3EResTeacherReport">
|
||
|
|
SELECT count(a.assigntype='L' or null) achivementNum,
|
||
|
|
count(a.assigntype='W' or null) wordNum
|
||
|
|
from assignment a inner join assigntoclass ac on a.assignmentid=ac.assignmentid and ac.classesid=#{classesid}
|
||
|
|
and a.teacherid = #{teacherid} and a.created between '${starttime} 00:00:00' and '${endtime} 23:59:59'
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<!--查询班级对应的学生有完成的课程作业和单词作业的次数-->
|
||
|
|
<select id="findAssignmentNum" parameterType="map" resultType="int">
|
||
|
|
WITH temp as (
|
||
|
|
select soc.studentId from StudentOwnClass soc
|
||
|
|
inner join student s on s.areaid = #{areaid} and soc.studentid=s.studentid where
|
||
|
|
soc.classesId =#{classesid} and soc.areaid = #{areaid} and s.status=1
|
||
|
|
)
|
||
|
|
SELECT count(uid) from temp as a
|
||
|
|
INNER JOIN finishassignstat b ON b.areaid = #{areaid} and a.studentid = b.uid
|
||
|
|
inner join (select b.assignmentid,b.starttime,b.endtime from assigntoclass a INNER JOIN assignment b on a.assignmentid = b.assignmentid
|
||
|
|
and classesId =#{classesid}
|
||
|
|
) d on b.assignmentid =d.assignmentid
|
||
|
|
and b.created between '${starttime} 00:00:00' and '${endtime} 23:59:59'
|
||
|
|
and b.created>d.starttime and b.created < d.endtime
|
||
|
|
and lessoncount=completecount
|
||
|
|
</select>
|
||
|
|
<select id="findLastAssignByTeacherId" resultType="com._3e.entity.Assignment">
|
||
|
|
SELECT * FROM assignment WHERE teacherid = #{teacherId} and assigntype = 'L' ORDER BY created DESC LIMIT 1
|
||
|
|
</select>
|
||
|
|
|
||
|
|
</mapper>
|