115 lines
4.6 KiB
XML
115 lines
4.6 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="Achivement">
|
|||
|
|
|
|||
|
|
<insert id="insertAchivement" parameterType="Achivement">
|
|||
|
|
INSERT INTO Achivement ( achivementId, uid, achiveType,
|
|||
|
|
pointCaseType, objectId, score, accuracy, fluent, integrity,
|
|||
|
|
content, created, uuid ,areaid
|
|||
|
|
<if test="jcontent != null and jcontent != ''">
|
|||
|
|
,jcontent
|
|||
|
|
</if> )
|
|||
|
|
Values ( #{achivementId}, #{uid}, #{achiveType}, #{pointCaseType},
|
|||
|
|
#{objectId}, #{score}, #{accuracy}, #{fluent}, #{integrity},
|
|||
|
|
#{content},#{created}, #{uuid} ,#{areaid}
|
|||
|
|
<if test="jcontent != null and jcontent != ''">
|
|||
|
|
,#{jcontent,typeHandler=com.spoken.api.handlers.JSONTypeHandlerPg1}
|
|||
|
|
</if>
|
|||
|
|
)
|
|||
|
|
</insert>
|
|||
|
|
|
|||
|
|
<update id="updateAchivement" parameterType="Achivement">
|
|||
|
|
UPDATE Achivement
|
|||
|
|
SET achivementId = #{achivementId}, uid = #{uid},
|
|||
|
|
achiveType = #{achiveType}, pointCaseType = #{pointCaseType},
|
|||
|
|
objectId = #{objectId}, score = #{score}, accuracy = #{accuracy},
|
|||
|
|
fluent = #{fluent}, integrity = #{integrity},
|
|||
|
|
content = #{content}, created = #{created}, uuid = #{uuid} ,
|
|||
|
|
areaid = #{areaid}
|
|||
|
|
where achivementId=#{achivementId}
|
|||
|
|
</update>
|
|||
|
|
|
|||
|
|
<select id="getAchivementByKey" parameterType="java.lang.Integer" resultType="Achivement">
|
|||
|
|
SELECT achivementId , uid , achiveType , pointCaseType , objectId ,
|
|||
|
|
score , accuracy , fluent , integrity , content , created ,
|
|||
|
|
uuid , areaid,jcontent
|
|||
|
|
FROM Achivement
|
|||
|
|
WHERE achivementId=#{achivementId}
|
|||
|
|
</select>
|
|||
|
|
|
|||
|
|
<select id="getSeqAchivement" resultType="Long" useCache="false" flushCache="true">
|
|||
|
|
SELECT nextval('seq_achivementId') ;
|
|||
|
|
</select>
|
|||
|
|
|
|||
|
|
<select id="getAchivementsCountByUid" parameterType="java.util.Map" resultType="Integer">
|
|||
|
|
SELECT count(*) as howmuch
|
|||
|
|
from Achivement
|
|||
|
|
WHERE uid=#{uid} and areaid = #{areaid}
|
|||
|
|
</select>
|
|||
|
|
|
|||
|
|
<select id="getAchivementsByUid" parameterType="java.util.Map" resultType="Achivement">
|
|||
|
|
SELECT achivementId , uid , achiveType , pointCaseType , objectId ,
|
|||
|
|
score , accuracy , fluent , integrity , content , created ,
|
|||
|
|
uuid , areaid
|
|||
|
|
FROM Achivement
|
|||
|
|
WHERE uid=#{uid} and areaid = #{areaid}
|
|||
|
|
ORDER BY achivementId desc
|
|||
|
|
LIMIT #{pageSize} OFFSET #{offset}
|
|||
|
|
</select>
|
|||
|
|
|
|||
|
|
<update id="updateUUID" parameterType="java.util.Map">
|
|||
|
|
update Achivement
|
|||
|
|
set uuid = #{uuid}
|
|||
|
|
where achivementId= #{achivementId} and areaId=#{areaId} and uid=#{uid} ;
|
|||
|
|
</update>
|
|||
|
|
|
|||
|
|
<select id="getAchivementByUidAndAssignmentIdV2" parameterType="java.util.Map" resultType="AssignmentCompleteParam">
|
|||
|
|
select uid ,number,lessonid as lessonId,score as studentScore ,uuid as audioUrl,studentNum as studentNum from ( select uid,a.number , a.lessonid ,b.score ,b.uuid ,ROW_NUMBER() over ( PARTITION BY b.uid,b.objectid order by b.score desc ) AS rn ,count(1) over ( PARTITION BY b.uid,b.objectid ) as studentNum from assigndetail as a left join achivement as b on a.lessonid = b.objectid and b.areaId = #{areaId} and b.achivetype = 'L' where a.assignmentid = #{assignmentId} ) as c where c.rn =1
|
|||
|
|
</select>
|
|||
|
|
|
|||
|
|
<!-- 查询七天前的引擎分析结果,准备在定时任务写到OSS -->
|
|||
|
|
<select id="getAchiveEngineResult" resultType="java.util.HashMap">
|
|||
|
|
SELECT uid , achivementId , content
|
|||
|
|
FROM Achivement
|
|||
|
|
|
|||
|
|
WHERE length( content ) > 100
|
|||
|
|
AND created < current_date - interval '7 days'
|
|||
|
|
|
|||
|
|
ORDER BY achivementId asc
|
|||
|
|
LIMIT 100
|
|||
|
|
</select>
|
|||
|
|
|
|||
|
|
<!-- 统计学习的总分数,次数 -->
|
|||
|
|
<select id="statReadAloudByUid" parameterType="java.util.Map" resultType="TempStudyStatDto">
|
|||
|
|
SELECT uid , count(achivementid) as howmuch ,
|
|||
|
|
sum( CASE WHEN score isnull THEN 0
|
|||
|
|
ELSE score
|
|||
|
|
END ) as totalscore
|
|||
|
|
FROM Achivement
|
|||
|
|
WHERE uid=#{uid} and areaId = #{areaid}
|
|||
|
|
AND achiveType in ( 'L' , 'W' )
|
|||
|
|
AND pointCaseType in ( 3, 5, 6 , 7 , 8 )
|
|||
|
|
GROUP BY uid
|
|||
|
|
LIMIT 1
|
|||
|
|
</select>
|
|||
|
|
|
|||
|
|
<select id="maxAssignmentAchive" parameterType="java.util.HashMap" resultType="java.lang.Double">
|
|||
|
|
|
|||
|
|
SELECT n.score
|
|||
|
|
FROM
|
|||
|
|
( SELECT distinct a.lessonId , b.startTime , b.endTime
|
|||
|
|
FROM AssignDetail a
|
|||
|
|
INNER JOIN Assignment b
|
|||
|
|
on a.assignmentId = #{assignmentId} and a.lessonId = #{lessonId}
|
|||
|
|
and a.assignmentId = b.assignmentId ) m
|
|||
|
|
INNER JOIN Achivement n
|
|||
|
|
on n.uid = #{uid} and m.lessonId = n.objectId and n.areaId=#{areaId}
|
|||
|
|
and n.achivetype = 'L' and pointcasetype in (4, 5 , 6 , 7 , 8 )
|
|||
|
|
and n.created > #{startTime} and n.created < #{endTime}
|
|||
|
|
order by n.score desc , n.created asc
|
|||
|
|
limit 1
|
|||
|
|
|
|||
|
|
|
|||
|
|
</select>
|
|||
|
|
</mapper>
|