837 lines
34 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.AchivementDao">
<select id= "getNextSeq" resultType="long">
SELECT NEXTVAL('seq_achivementid')
</select>
<!--<select id= "getNextSeq" resultType="long">-->
<!--SELECT NEXTVAL('seq_achivementid')-->
<!--</select>-->
<insert id= "doSave" parameterType="com._3e.entity.Achivement">
INSERT INTO achivement(
achivementid, uid, achivetype, pointcasetype, objectid, score,
accuracy, fluent, integrity, content, created, uuid, areaid)
VALUES (
<if test="achivementid == 0">
(SELECT NEXTVAL('seq_achivementid')),
</if>
<if test="achivementid != 0">
#{achivementid},
</if>
#{uid}, #{achivetype}, #{pointcasetype}, #{objectid}, #{score},
#{accuracy}, #{fluent}, #{integrity}, #{content}, #{created}, #{uuid}, #{areaid})
</insert>
<insert id= "doSave_1" parameterType="com._3e.http.achivement.dto.AchivementDto">
INSERT INTO achivement(
achivementid, uid, achivetype, pointcasetype, objectid, score,
accuracy, fluent, integrity, content, created, uuid, areaid,jContent)
VALUES (
<if test="achivementid == 0">
(SELECT NEXTVAL('seq_achivementid')),
</if>
<if test="achivementid != 0">
#{achivementid},
</if>
#{uid}, #{achivetype}, #{pointcasetype}, #{objectid}, #{score},
#{accuracy}, #{fluent}, #{integrity}, #{content}, #{created}, #{uuid}, #{areaid},
#{jContent,typeHandler=com._3e.http.wrongbook.typehandler.JSONTypeHandlerPg}
)
</insert>
<insert id="doSaveMore" parameterType="com._3e.entity.AchivementMore">
INSERT INTO achivement_more(
achivementId,areaId,created,content,content_url )
VALUES (
#{achivementId},
#{areaId},
#{created},
#{content},
#{contentUrl}
)
</insert>
<update id="doUpdateVoiceKey" parameterType="map" >
UPDATE achivement SET uuid = #{uuid} WHERE achivementid = #{achivementid}
and areaid=#{areaid} and uid=#{uid}
</update>
<select id= "findClassGoodVoice" parameterType="map" resultType="com._3e.http.myspace.dto._3EResClassGoodVoice" >
WITH temp AS ( SELECT uid , score , uuid , objectId , created
FROM mv_ClassVoice
WHERE classesId = #{classesid}
<if test="begintime == null">
AND created &gt; ( CURRENT_DATE + INTERVAL '-1 month')
</if>
<if test="begintime != null">
AND created &gt; #{begintime}
</if>
<if test="endtime != null">
AND created &lt; #{endtime}
</if>
ORDER BY created DESC,score DESC
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>
)
SELECT a.uid , 0 AS schoolId , '' AS schoolName , a.uuid , a.created ,
0 AS isFollowed , a.score ,
d.lessonId AS bookId , d.lessonName AS bookName ,
c.lessonId AS unitId , c.lessonName AS unitName ,
b.lessonId AS lessonid, b.lessonName AS lessonname
FROM temp a
INNER JOIN Lesson b
ON a.objectId = b.lessonId
INNER JOIN Lesson c
ON b.parentId = c.lessonId
INNER JOIN Lesson d
ON c.parentId = d.lessonId
ORDER BY a.created DESC,a.score DESC
</select>
<select id="findMyAchGoodVoice" parameterType="long" resultType="com._3e.entity.Achivement" >
select * from achivement where exists
(select * from (
select b.* from studentownclass b where exists (
select c.* from studentownclass c where b.classesid = c.classesid and c.studentid = #{uid}
)
)
d where uid = d.studentid)
and uuid <![CDATA[ <> ]]> '' and achivetype <![CDATA[ <> ]]> 'S'
</select>
<!--这个方法在代码中没被使用-->
<select id= "findMyAchiveGoodVoice" parameterType="map" resultType="com._3e.entity.Achivement" >
select * from achivement where
uid = #{uid} and uuid <![CDATA[ <> ]]> '' and achivetype <![CDATA[ <> ]]> 'S'
and to_char(created, 'yyyy-MM-dd') &gt;= #{begintime} and to_char(created, 'yyyy-MM-dd') &lt;= #{endtime}
order by score desc
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>
</select>
<select id= "findMyGoodVoice" parameterType="map" resultType="com._3e.http.myspace.dto._3EResMyAchiveGoodVoice" >
SELECT a.uid ,'' as truename , 0 as schoolId , '' as schoolName ,
a.uuid , 0 as isFollowed , a.score , a.created ,a.pointCaseType,a.achivetype,
d.lessonId as bookId , d.lessonName as bookName ,
c.lessonId as unitId , c.lessonName as unitName ,
b.lessonId , b.lessonName
FROM ( (SELECT p.uid , p.score , p.uuid , p.objectId , p.created, p.achivementId,p.pointCaseType,p.achivetype
FROM Achivement p
WHERE p.areaid=#{areaid}
AND p.created &gt; '${begintime} 00:00:00' AND p.created &lt;= '${endtime} 23:59:59'
and length( p.uuid ) > 0
<!--AND p.achivetype = 'L'-->
AND p.achivetype ='L'
AND p.pointCaseType = 5
AND p.uid = #{uid}
)
UNION ALL
(SELECT p.uid , p.score , p.uuid , p.objectId , p.created, p.achivementId,p.pointCaseType,p.achivetype
FROM Achivement p
WHERE p.areaid=#{areaid}
AND p.created &gt; '${begintime} 00:00:00' AND p.created &lt;= '${endtime} 23:59:59'
and length( p.uuid ) > 0
AND p.pointCaseType = 7
AND p.uid = #{uid} )
) a
INNER JOIN Lesson b ON a.objectId = b.lessonId
INNER JOIN Lesson c ON b.parentId = c.lessonId
INNER JOIN Lesson d ON c.parentId = d.lessonId
ORDER BY a.score DESC , a.achivementId DESC
<!--<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>-->
</select>
<select id="findMySelfGoodvoice" parameterType="map" resultType="com._3e.http.myspace.dto._3EResMyAchiveGoodVoice">
SELECT p.uid , m.title bookname,m.isnetmate as isnetmate,p.score ,
'' as truename , 0 as schoolId , '' as schoolName,0 as isFollowed,
0 as bookId,0 as unitId,0 as lessonId,'' as unitName,'' as lessonName,
p.uuid , p.objectId , p.created, p.achivementId,p.pointCaseType,p.achivetype
FROM Achivement p
inner join v_teacherownmaterial m
on p.objectid = m.materialid
WHERE p.areaid=#{areaid}
AND p.created &gt; '${begintime} 00:00:00' AND p.created &lt;= '${endtime} 23:59:59'
and length( p.uuid ) > 0
<!--AND p.achivetype = 'L'-->
AND p.achivetype ='S'
AND p.pointCaseType = 5
AND p.uid = #{uid}
</select>
<select id="findAchivementCountByContent" parameterType="map" resultType="com._3e.entity.Achivement">
SELECT * from Achivement where uid = #{uid} and content = #{content} and areaid = #{areaId}
and created > #{startTime} and created &lt; #{endTime} order by created limit 5
</select>
<select id="findMySelfGoodvoiceName" parameterType="map" resultType="com._3e.http.myspace.dto._3EResMyAchiveGoodVoice">
SELECT m.title bookname,m.isnetmate as classrank,
'' as truename , 0 as schoolId , '' as schoolName,0 as isFollowed,
0 as bookId,0 as unitId,0 as lessonId,'' as unitName,'' as lessonName
FROM v_teacherownmaterial m
where m.materialid = #{objectid};
</select>
<select id="findClassGradeCurve" parameterType="map" resultType="com._3e.dto.ClassGradeCurve" >
SELECT extract( year from b.created ) as myYear ,
extract( month from b.created ) as myMonth,
max( b.score ) as maxScore , avg( b.score ) as avgScore
FROM StudentOwnClass a
INNER JOIN Achivement b
ON a.classesId = #{classesid}
and a.areaid=#{areaid}
and b.areaid = #{areaid}
<if test="begintime != null">
and b.created &gt; #{begintime}
</if>
<if test="endtime != null">
and b.created &lt;= #{endtime}
</if>
and a.status = 1
AND a.studentId = b.uid
AND b.achiveType in ('L','W')
AND b.pointCaseType in (3, 5, 6 , 7 , 8 )
GROUP BY extract( year from b.created ) ,
extract( month from b.created )
ORDER BY myYear , myMonth
</select>
<select id="findClassGradeCurve_day" parameterType="map" resultType="com._3e.dto.ClassGradeCurve" >
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 Achivement b
ON a.classesId = #{classesid}
and a.areaid=#{areaid}
and b.areaid = #{areaid}
<if test="begintime != null">
and b.created &gt; #{begintime}
</if>
<if test="endtime != null">
and b.created &lt;= #{endtime}
</if>
and a.status = 1
AND a.studentId = b.uid
AND b.achiveType in ('L','W')
AND b.pointCaseType in (3, 5, 6 , 7 , 8 )
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="findClassGradeCurve_1" parameterType="map" resultType="com._3e.dto.ClassGradeCurve" >
select myyear,mymonth,maxscore,avgscore
from (
select myyear,mymonth,COALESCE(max(c.studymaxscore),0) as maxscore,
COALESCE(round(sum(c.studytotal)::numeric/sum(c.studycount)::numeric,6),0) as avgscore
from StudentOwnClass d INNER JOIN privatestat c on d.classesid=#{classesid} and d.areaid = #{areaid}
and c.areaid = #{areaid}
and d.status = 1
AND d.studentId = c.uid
and myyear > #{beginyear} and myyear &lt; #{endyear}
GROUP BY myyear ,mymonth
union all
select myyear,mymonth,COALESCE(max(c.studymaxscore),0) as maxscore,
COALESCE(round(sum(c.studytotal)::numeric/sum(c.studycount)::numeric,6),0) as avgscore
from StudentOwnClass d INNER JOIN privatestat c on d.classesid=#{classesid} and d.areaid = #{areaid}
and c.areaid = #{areaid}
and d.status = 1
AND d.studentId = c.uid
and myyear = #{beginyear} and myyear &lt; #{endyear}
and mymonth >=#{beginmonth}
GROUP BY myyear ,mymonth
union all
select myyear,mymonth,COALESCE(max(c.studymaxscore),0) as maxscore,
COALESCE(round(sum(c.studytotal)::numeric/sum(c.studycount)::numeric,6),0) as avgscore
from StudentOwnClass d INNER JOIN privatestat c on d.classesid=#{classesid} and d.areaid = #{areaid}
and c.areaid = #{areaid}
and d.status = 1
AND d.studentId = c.uid
and myyear = #{endyear} and myyear > #{beginyear}
and mymonth &lt;=#{endmonth}
GROUP BY myyear ,mymonth
union all
select myyear,mymonth,COALESCE(max(c.studymaxscore),0) as maxscore,
COALESCE(round(sum(c.studytotal)::numeric/sum(c.studycount)::numeric,6),0) as avgscore
from StudentOwnClass d INNER JOIN privatestat c on d.classesid=#{classesid} and d.areaid = #{areaid}
and c.areaid = #{areaid}
and d.status = 1
AND d.studentId = c.uid
and myyear = #{endyear} and myyear = #{beginyear}
and mymonth between #{beginmonth} and #{endmonth}
GROUP BY myyear ,mymonth
union all
SELECT extract( year from b.created ) as myYear ,
extract( month from b.created ) as myMonth,
max( b.score ) as maxScore , avg( b.score ) as avgScore
FROM StudentOwnClass a
INNER JOIN Achivement b
ON a.classesId = #{classesid}
and a.areaid=#{areaid}
and b.areaid = #{areaid}
<if test="begintime1 != null">
and b.created &gt; #{begintime1}
</if>
<if test="endtime != null">
and b.created &lt;= #{endtime}
</if>
and a.status = 1
AND a.studentId = b.uid
AND b.achiveType in ('L','W')
AND b.pointCaseType in (3, 5, 6 , 7 , 8 )
GROUP BY extract( year from b.created ) ,
extract( month from b.created )
) s
ORDER BY myYear , myMonth
</select>
<select id="findClassGradeCurve_2" parameterType="map" resultType="com._3e.dto.ClassGradeCurve" >
select myyear,mymonth,maxscore,avgscore
from (
select myyear,mymonth,COALESCE(max(c.studymaxscore),0) as maxscore,
COALESCE(round(sum(c.studytotal)::numeric/sum(c.studycount)::numeric,6),0) as avgscore
from StudentOwnClass d INNER JOIN privatestat c on d.classesid=#{classesid} and d.areaid = #{areaid}
and c.areaid = #{areaid}
and d.status = 1
AND d.studentId = c.uid
and myyear > #{beginyear} and myyear &lt; #{endyear}
GROUP BY myyear ,mymonth
union all
select myyear,mymonth,COALESCE(max(c.studymaxscore),0) as maxscore,
COALESCE(round(sum(c.studytotal)::numeric/sum(c.studycount)::numeric,6),0) as avgscore
from StudentOwnClass d INNER JOIN privatestat c on d.classesid=#{classesid} and d.areaid = #{areaid}
and c.areaid = #{areaid}
and d.status = 1
AND d.studentId = c.uid
and myyear = #{beginyear} and myyear &lt; #{endyear}
and mymonth >=#{beginmonth}
GROUP BY myyear ,mymonth
union all
select myyear,mymonth,COALESCE(max(c.studymaxscore),0) as maxscore,
COALESCE(round(sum(c.studytotal)::numeric/sum(c.studycount)::numeric,6),0) as avgscore
from StudentOwnClass d INNER JOIN privatestat c on d.classesid=#{classesid} and d.areaid = #{areaid}
and c.areaid = #{areaid}
and d.status = 1
AND d.studentId = c.uid
and myyear = #{endyear} and myyear>#{beginyear}
and mymonth &lt;=#{endmonth}
GROUP BY myyear ,mymonth
union all
select myyear,mymonth,COALESCE(max(c.studymaxscore),0) as maxscore,
COALESCE(round(sum(c.studytotal)::numeric/sum(c.studycount)::numeric,6),0) as avgscore
from StudentOwnClass d INNER JOIN privatestat c on d.classesid=#{classesid} and d.areaid = #{areaid}
and c.areaid = #{areaid}
and d.status = 1
AND d.studentId = c.uid
and myyear = #{endyear} and myyear=#{beginyear}
and mymonth between #{beginmonth} and #{endmonth}
GROUP BY myyear ,mymonth
) s
ORDER BY myYear , myMonth
</select>
<select id= "findVUserGradeCurve" parameterType="map" resultType="com._3e.dto.VUserGradeCurve" >
SELECT extract( year from created ) as myYear ,
extract( month from created ) as myMonth,
max( score ) as maxScore , avg( score ) as avgScore
FROM Achivement
WHERE areaid = #{areaid}
<if test="begintime != null">
and created &gt; #{begintime}
</if>
<if test="endtime != null">
and created &lt;= #{endtime}
</if>
and uid = #{uid} AND achiveType in ('L','W')
AND pointCaseType in (3, 5, 6 , 7 , 8 )
GROUP BY extract( year from created ) ,
extract( month from created )
ORDER BY myYear , myMonth
</select>
<select id= "findVUserGradeCurve_day" 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 Achivement
WHERE areaid = #{areaid}
<if test="begintime != null">
and created &gt; #{begintime}
</if>
<if test="endtime != null">
and created &lt;= #{endtime}
</if>
and uid = #{uid} AND achiveType in ('L','W')
AND pointCaseType in (3, 5, 6 , 7 , 8 )
GROUP BY extract( year from created ) ,
extract( month from created ),
extract( day from created )
ORDER BY myYear , myMonth ,myDay
</select>
<select id="findVUserGradeCurve_1" parameterType="map" resultType="com._3e.dto.VUserGradeCurve">
select myyear,mymonth,maxscore,avgscore
from (
select myyear,mymonth,COALESCE(max(studymaxscore),0) as maxscore,
COALESCE(round(sum(studytotal)::numeric/sum(studycount)::numeric,6),0) as avgscore
from privatestat where areaid = #{areaid}
and uid = #{uid}
and myyear > #{beginyear} and myyear &lt; #{endyear}
GROUP BY myyear ,mymonth
union all
select myyear,mymonth,COALESCE(max(studymaxscore),0) as maxscore,
COALESCE(round(sum(studytotal)::numeric/sum(studycount)::numeric,6),0) as avgscore
from privatestat where areaid = #{areaid}
and uid = #{uid}
and myyear = #{beginyear}
and mymonth >=#{beginmonth}
GROUP BY myyear ,mymonth
union all
select myyear,mymonth,COALESCE(max(studymaxscore),0) as maxscore,
COALESCE(round(sum(studytotal)::numeric/sum(studycount)::numeric,6),0) as avgscore
from privatestat where areaid = #{areaid}
and uid = #{uid}
and myyear = #{endyear}
and mymonth &lt;=#{endmonth}
GROUP BY myyear ,mymonth
union all
SELECT extract( year from created ) as myYear ,
extract( month from created ) as myMonth,
max( score ) as maxScore , avg( score ) as avgScore
FROM Achivement
WHERE areaid = #{areaid}
and created > #{begintime1}
and created &lt;= #{endtime}
and uid =#{uid} AND achiveType in ('L','W')
AND pointCaseType in (3, 5, 6 , 7 , 8 )
GROUP BY extract( year from created ) ,
extract( month from created )
) s
ORDER BY myYear , myMonth
</select>
<select id="findMyAllAchiveGrades" parameterType="map" resultType="com._3e.entity.Achivement" >
SELECT * FROM Achivement
WHERE areaid = #{areaid}
and created &gt; '${begintime} 00:00:00'
and created &lt;= '${endtime} 23:59:59'
and uid = #{uid} AND achiveType in ('L','W')
AND pointCaseType in (3, 5, 6 , 7 , 8 )
<if test="pointCaseType != 0">
and pointCaseType = #{pointCaseType}
</if>
ORDER BY created DESC
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>
</select>
<select id= "findMyMaxAchiveGrades" parameterType="map" resultType="com._3e.entity.Achivement" >
SELECT a.objectId ,a.pointCaseType , max( a.score ) as score , max( a.created ) as created,a.achivetype FROM Achivement a
WHERE a.areaid = #{areaid}
AND a.created &gt;= '${begintime} 00:00:00'
AND a.created &lt;= '${endtime} 23:59:59'
and a.uid = #{uid} AND a.achiveType in ('L','W')
<if test="pointCaseType != 0">
and pointCaseType = #{pointCaseType}
</if>
AND pointCaseType in (3, 5, 6 , 7 , 8 )
GROUP BY a.objectId , a.pointCaseType,a.achivetype
ORDER BY created desc
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>
</select>
<select id= "findMyAllAchiveGrades_2" parameterType="map" resultType="com._3e.entity.Achivement" >
<!--SELECT a.objectId ,a.pointCaseType , max( a.score ) as score , max( a.created ) as created,a.achivetype FROM Achivement a
WHERE a.areaid = #{areaid}
AND a.created &gt;= '${begintime} 00:00:00'
AND a.created &lt;= '${endtime} 23:59:59'
and a.uid = #{uid} AND a.achiveType in ('L','W','S')
<if test="pointCaseType != 0">
and pointCaseType = #{pointCaseType}
</if>
AND pointCaseType in (3, 5, 6 , 7 , 8 )
GROUP BY a.objectId , a.pointCaseType,a.achivetype
ORDER BY created desc
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>-->
SELECT * FROM Achivement
WHERE areaid = #{areaid}
and created &gt; '${begintime} 00:00:00'
and created &lt;= '${endtime} 23:59:59'
and uid = #{uid} AND achiveType in ('L','W','S')
AND pointCaseType in (3,4,5, 6 , 7 , 8 )
<if test="pointCaseType != 0">
and pointCaseType = #{pointCaseType}
</if>
ORDER BY created DESC
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>
</select>
<select id= "findMyMaxAchiveGrades_1" parameterType="map" resultType="com._3e.entity.Achivement" >
<!--SELECT a.objectId ,a.pointCaseType , max( a.score ) as score , max( a.created ) as created,a.achivetype FROM Achivement a-->
<!--WHERE a.uid = #{uid} AND a.achiveType in ('L','W')-->
<!--AND a.created &gt;= '${begintime} 00:00:00' AND a.created &lt;= '${endtime} 23:59:59'-->
<!--<if test="pointCaseType != 0">-->
<!--and pointCaseType = #{pointCaseType}-->
<!--</if>-->
<!--AND pointCaseType in (3, 5, 6 , 7 , 8 )-->
<!--GROUP BY a.objectId , a.pointCaseType,a.achivetype-->
<!--ORDER BY created desc-->
SELECT * from (
SELECT *,row_number()over(PARTITION by objectid,pointCaseType ORDER BY score desc,created desc) rownum from Achivement
where areaid = #{areaid}
and created &gt;= '${begintime} 00:00:00'
AND created &lt;= '${endtime} 23:59:59'
and uid = #{uid} AND achiveType in ('L','W')
<if test="pointCaseType != 0">
and pointCaseType = #{pointCaseType}
</if>
AND pointCaseType in (3, 5, 6 , 7 , 8 ) ) as t1 where rownum=1
ORDER BY created desc
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>
</select>
<select id= "findMyMaxAchiveGrades_2_1" parameterType="map" resultType="com._3e.entity.Achivement" >
<!--SELECT a.objectId ,a.pointCaseType , max( a.score ) as score , max( a.created ) as created,a.achivetype FROM Achivement a-->
<!--WHERE a.uid = #{uid} AND a.achiveType in ('L','W')-->
<!--AND a.created &gt;= '${begintime} 00:00:00' AND a.created &lt;= '${endtime} 23:59:59'-->
<!--<if test="pointCaseType != 0">-->
<!--and pointCaseType = #{pointCaseType}-->
<!--</if>-->
<!--AND pointCaseType in (3, 5, 6 , 7 , 8 )-->
<!--GROUP BY a.objectId , a.pointCaseType,a.achivetype-->
<!--ORDER BY created desc-->
SELECT * from (
SELECT *,row_number()over(PARTITION by objectid,pointCaseType ORDER BY score desc,created desc) rownum from Achivement
where areaid = #{areaid}
and created &gt;= '${begintime} 00:00:00'
AND created &lt;= '${endtime} 23:59:59'
and uid = #{uid} AND achiveType in ('L','W','S')
<if test="pointCaseType != 0">
and pointCaseType = #{pointCaseType}
</if>
AND pointCaseType in (3, 4, 5, 6 , 7 , 8 ) ) as t1 where rownum=1
ORDER BY created desc
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>
</select>
<select id= "findAchivementByHsyb" parameterType="com.mobile.common.page.Page" resultType="com._3e.http.myhome.dto._3EResRankingList" >
select a.uid , a.truename , a.schoolId , a.schoolName , a.voice AS uuid , a.created ,
0 as isFollowed ,a.score AS value, 0 as bookId , '' as bookName , 0 as unitId ,
'' as unitName , 0 as lessonId , '' as lessonName
from mv_supervoice a
<where>
<if test="begintime == null">
created &gt; ( CURRENT_DATE + INTERVAL '-1 month')
</if>
<!--<if test="begintime != null">-->
<!--AND created &gt; #{begintime}-->
<!--</if>-->
<if test="endtime != null">
AND created &lt; #{endtime}
</if>
</where>
order by a.score desc , a.created desc
LIMIT #{limit} OFFSET #{offset}
</select>
<!--金牌榜-->
<select id= "findAchivementByGoldMedalChart" parameterType="com.mobile.common.page.Page" resultType="com._3e.http.myhome.dto._3EResRankingList" >
select m.howmuch as goldmedalcount,m.uid,s.truename,sl.schoolName
from mv_monthgoldmedal m inner join student s on m.uid=s.studentid
inner join classes c on m.classesid=c.classesid inner join school sl
on sl.schoolid=c.schoolid
order by goldmedalcount desc,m.uid desc
LIMIT #{limit} OFFSET #{offset}
</select>
<select id= "findUserByQxb" parameterType="com.mobile.common.page.Page" resultType="com._3e.http.myhome.dto._3EResRankingList" >
select s.uid , s.truename , s.schoolId , s.schoolName,s.avgScore
,'' as userLevel , '' as levelName , 0 as isFollowed ,s.totalscore, s.numCount as VALUE
from mv_superhero s
order by s.numCount desc, s.avgScore desc , s.totalscore desc ,s.uid desc
LIMIT #{limit} OFFSET #{offset}
</select>
<select id= "findMyAchiveGradesByLessionids" parameterType="map" resultType="com._3e.entity.Achivement" >
<!--SELECT * FROM achivement-->
SELECT objectid,created FROM achivement
WHERE areaid = #{areaid} and created &lt; current_timestamp
and pointcasetype in
<foreach collection="pointCaseTypes" item="pointCaseType" open="(" close=")" index="index" separator=",">
#{pointCaseType}
</foreach>
<if test="created != null">
and created > #{created}
</if>
and uid = #{uid}
<if test="lessionidList.size > 0">
AND objectid in
<foreach item="lessionid" index="index" collection="lessionidList"
open="(" separator="," close=")">
#{lessionid}
</foreach>
</if>
</select>
<select id= "findClassTeacherGoodVoice" parameterType="map" resultType="com._3e.entity.Achivement" >
SELECT * FROM achivement WHERE EXISTS ( SELECT * FROM ( SELECT b.* FROM teacher b WHERE EXISTS ( SELECT C.* FROM classes C WHERE C.teacherid = b.teacherid AND C.teacherid = #{uid} )) d WHERE uid = d.teacherid )
and uuid <![CDATA[<>]]> ''
<if test="begintime != null">
and to_char(created, 'yyyy-MM-dd') &gt;= #{begintime}
</if>
<if test="endtime != null">
and to_char(created, 'yyyy-MM-dd') &lt; #{endtime}
</if>
</select>
<select id= "findAlreayLearnLessionNumByUnitId" parameterType="map" resultType="int" >
select count(DISTINCT objectid) from achivement where uid = #{uid} and objectid in (select lessonid from lesson where parentid = #{unitid})
</select>
<select id= "findAvgScoreByUnitidAndUid" parameterType="map" resultType="double" >
select avg(score) from achivement where uid = #{uid} and objectid in (select lessonid from lesson where parentid = #{unitid})
</select>
<select id= "findTeacherSelfUploadCourse" parameterType="map" resultType="com._3e.entity.VUserOwnMaterial" >
SELECT a.* from (
SELECT distinct uid , materialId ,title , teacherId , origiVoice , isNetMate , picture FROM V_TeacherOwnMaterial
WHERE isnetmate = 0 and uid = #{uid}
UNION ALL
SELECT distinct uid , materialId , title , teacherId , origiVoice , isNetMate , picture FROM V_TeacherOwnMaterial where isnetmate = 1
) a
<if test="title != null">
where a.title like '%'||#{title}||'%'
</if>
ORDER BY a.materialId DESC
</select>
<select id= "findTeacherSelfUploadCourse_1" parameterType="map" resultType="com._3e.entity.VUserOwnMaterial" >
SELECT distinct uid , materialId ,title , teacherId , origiVoice , isNetMate , picture FROM V_TeacherOwnMaterial
WHERE isnetmate = 0 and uid = #{uid}
<if test="title != null">
and title like '%'||#{title}||'%'
</if>
ORDER BY materialId DESC,title desc
</select>
<select id= "find3eSelfUploadCourse" parameterType="map" resultType="com._3e.entity.VUserOwnMaterial" >
SELECT uid , materialId , title ,
teacherId , origiVoice , isNetMate , picture
FROM V_TeacherOwnMaterial
where isnetmate = 1
<if test="title != null">
and title like '%'||#{title}||'%'
</if>
ORDER BY materialId DESC,title desc
</select>
<select id= "findStudentSelfUploadCourse" parameterType="map" resultType="com._3e.entity.VUserOwnMaterial" >
SELECT a.* from (
SELECT distinct uid , materialId ,title , teacherId , origiVoice , isNetMate , picture FROM V_UserOwnMaterial
WHERE isnetmate = 0 and uid = #{uid}
UNION ALL
SELECT distinct uid , materialId , title , teacherId , origiVoice , isNetMate , picture FROM V_TeacherOwnMaterial where isnetmate = 1
) a
<if test="title != null">
where a.title like '%'||#{title}||'%'
</if>
ORDER BY a.materialId DESC
</select>
<select id= "findStudentSelfUploadCourse_1" parameterType="map" resultType="com._3e.entity.VUserOwnMaterial" >
SELECT uid , materialId , title ,
teacherId , origiVoice , isNetMate , picture
FROM V_UserOwnMaterial
where isnetmate = 0 and uid = #{uid}
<if test="title != null">
and title like '%'||#{title}||'%'
</if>
ORDER BY materialId DESC,title desc
</select>
<select id= "findRecommendedCourse" parameterType="map" resultType="com._3e.entity.Goods" >
SELECT * FROM goods
WHERE isRecomm = 1
<if test="goodsname != null">
and goodsname like '%'||#{goodsname}||'%'
</if>
ORDER BY goodsId,goodsname desc
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>
</select>
<select id= "find_3ETimeDto" parameterType="map" resultType="com._3e.dto._3ETimeDto" >
select distinct(s.uid) as uid , sum(s.race) as raceCount , sum(s.achivement) as achivementCount ,
sum(s.read) as hearSpokenCount, sum(s.exam) as examCount , sum(s.hearCount) as hearCount ,
sum(s.compExamCount) AS compExamCount, s.month as month , s.year as year
from ( select uid, count(racescoreid) as race , 0 as achivement , 0 as read, 0 as exam , 0 as hearCount ,
0 AS compExamCount, extract(month from created) as month , extract(year from created) as year
from racescore
where areaid = #{areaid}
and created &gt; #{startTime} and created &lt; #{endTime}
group by uid ,extract(month from created) , extract(year from created)
union all
select distinct(uid), 0 as race, count(achivementid) as achivement, 0 as read, 0 as exam , 0 as hearCount,
0 AS compExamCount,extract(month from created) as month , extract(year from created) as year
from achivement
where areaid = #{areaid}
and created &gt; #{startTime} and created &lt; #{endTime} and achivetype in ( 'L' , 'W' )
and pointCaseType in ( 3 , 5 , 6 , 7 , 8 )
group by uid ,extract(month from created) , extract(year from created)
union all
select distinct(a.userid) as uid ,0 as race , 0 as achivement , count(a.examanswerid) as read,0 as exam ,
0 as hearCount, 0 AS compExamCount, extract(month from a.created) as month , extract(year from a.created) as year
from examanswer a
INNER JOIN exam e ON e.examId = a.examId
and e.isOral = 0
where a.areaid=#{areaid} and a.created &gt; #{startTime} and a.created &lt; #{endTime}
group by a.userid ,extract(month from a.created) , extract(year from a.created)
union all
select distinct(a.userid) as uid ,0 as race , 0 as achivement , 0 as read, count(a.examanswerid) as exam ,
0 as hearCount, 0 AS compExamCount, extract(month from a.created) as month , extract(year from a.created) as year
from examanswer a
INNER JOIN exam e ON e.examId = a.examId and e.isOral = 1
where a.areaid=#{areaid} and a.created &gt; #{startTime} and a.created &lt; #{endTime}
group by a.userid ,extract(month from a.created) , extract(year from a.created)
union all
select distinct(a.userid) as uid ,0 as race , 0 as achivement , 0 as read, 0 as exam ,count(a.examanswerid) as hearCount , 0 AS compExamCount,
extract(month from a.created) as month , extract(year from a.created) as year
from examanswer a
INNER JOIN exam e ON e.examId = a.examId and e.isOral = 2
where a.areaid=#{areaid} and a.created &gt; #{startTime} and a.created &lt; #{endTime}
group by a.userid ,extract(month from a.created) , extract(year from a.created)
union all
select distinct(a.userid) as uid ,0 as race , 0 as achivement , 0 as read, 0 as exam ,0 as hearCount , count(a.examanswerid) AS compExamCount,
extract(month from a.created) as month , extract(year from a.created) as year
from examanswer a
INNER JOIN exam e ON e.examId = a.examId and e.isOral = 3
where a.areaid=#{areaid} and a.created &gt; #{startTime} and a.created &lt; #{endTime}
group by a.userid ,extract(month from a.created) , extract(year from a.created)
union all
select distinct(userid) as uid ,0 as race , 0 as achivement , 0 as read, 0 as exam ,
count(examanswerid) as hearCount , 0 AS compExamCount, extract(month from created) as month , extract(year from created) as year
from hearanswer
where areaid=#{areaid} and created &gt; #{startTime} and created &lt; #{endTime}
group by userid ,extract(month from created) , extract(year from created) ) s
where uid = #{uid}
group by uid,month , year
</select>
<select id= "findCourseBelongHeNan" parameterType="map" resultType="com._3e.entity.Goods" >
SELECT * FROM goods
WHERE isRecomm = 1
ORDER BY goodsId,goodsname desc
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>
</select>
<select id= "findCourseOfAreaByAreaId" parameterType="int" resultType="com._3e.entity.Goods" >
SELECT * FROM goods
WHERE isRecomm = 0
and goodsId in (select valueint from parameter where paratype=7 and paraint = #{areaId})
and ((isrecomm > 0 AND price = 0) OR isrecomm = 0)
ORDER BY goodsId
</select>
<select id= "findCourseOfAreaByAreaId_xinhua" parameterType="map" resultType="com._3e.entity.Goods" >
SELECT * FROM goods
WHERE isRecomm = 0
and goodsId in (select valueint from parameter where paratype=26 and paraint = #{areaId} and valuestr = #{passCode} and status =1)
and ((isrecomm > 0 AND price = 0) OR isrecomm = 0)
ORDER BY goodsId
</select>
<select id= "findMyCourse" parameterType="long" resultType="com._3e.dto.UserOwnLessonDto" >
SELECT uid,g.goodsname, g.goodsid , g.price , startTime,
endTime, u.status, areaid
FROM UserOwnLesson u
INNER JOIN goods g
ON g.goodsid = u.goodsid
WHERE uid = #{uid}
AND g.isrecomm = 0
</select>
<select id="findAchivementDayNum" parameterType="map" resultType="java.util.Date">
select distinct date(created) created1 from achivement
where uid = #{uid} and created &gt; '2020-03-01 00:00:00'
and created &lt; '2020-03-29 23:59:59'
and areaid = #{areaid} ORDER BY created1
</select>
<select id="findStuLessonProgress" parameterType="map" resultType="Integer">
select count(objectid) from Achivement where areaid = #{areaid} and uid = #{uid}
and created > #{starttime} and created &lt; #{endtime}
and objectid = #{objectid}
</select>
<select id="findStuLessonProgressAll" parameterType="map" resultType="com._3e.entity.Achivement">
select achivementid,objectid,created from Achivement where areaid = #{areaid} and uid = #{uid}
and pointcasetype in
<foreach collection="pointCaseTypes" item="pointCaseType" open="(" close=")" index="index" separator=",">
#{pointCaseType}
</foreach>
and created > #{starttime} and created &lt; current_timestamp
and objectid in
<foreach item="lessonid" index="index" collection="lessonids"
open="(" separator="," close=")">
#{lessonid}
</foreach>
</select>
<select id="getdailySentenceV1" resultType="com._3e.http.achivement.dto.DailySentenceVO">
select sentence_english original,sentence_chinese translation from daysentence where month_id = #{month} and day_id = #{day} limit 1
</select>
<select id="findMyAllAchiveGradesType11" resultType="com._3e.entity.Achivement">
SELECT * from Achivement where areaid = #{areaid}
and created &gt;= #{begintime}
AND created &lt;= #{endtime}
and uid = #{uid} AND achiveType in ('W')
and pointCaseType = #{pointCaseType}
ORDER BY created desc
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>
</select>
<select id="getMaxScoreJcontentByAchivementId" resultType="java.lang.String">
select jContent from achivement where achivementid = #{achivementId}
</select>
<select id="findAchivementMoreById" resultType="com._3e.entity.AchivementMore">
select * from achivement_more where achivementid = #{achivementId}
</select>
</mapper>