124 lines
5.3 KiB
XML
124 lines
5.3 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.EssayAnswerDao">
|
||
|
|
<insert id="doSaveEssayAnswer">
|
||
|
|
INSERT INTO essayanswer (essayanswerid, uid, answertype, assignmentid,raceId, essaybaseid, score,origiScore,humanScore,trueScore, areaid, created, content, language, structure, overall, correct,stepOneCorrect, picture,picText,useWords,isExpire)
|
||
|
|
VALUES (#{essayAnswerId},#{uid}, #{answerType}, #{assignmentId},#{raceId}, #{essayBaseId}, #{score},#{origiScore},#{humanScore},#{trueScore}, #{areaId}, #{created}, #{content}, #{language}, #{structure}, #{overall},#{correct},#{stepOneCorrect},#{picture},#{picText},#{useWords},#{isExpire})
|
||
|
|
</insert>
|
||
|
|
<update id="doUpdateEssayAnswerScoreAndHumanScore">
|
||
|
|
UPDATE essayanswer
|
||
|
|
SET score=#{score},humanScore=#{humanScore}
|
||
|
|
WHERE essayanswerid=#{essayAnswerId}
|
||
|
|
</update>
|
||
|
|
<update id="doUpdateEssayAnswer">
|
||
|
|
UPDATE essayanswer
|
||
|
|
<set>
|
||
|
|
<if test="uid != null">
|
||
|
|
uid = #{uid},
|
||
|
|
</if>
|
||
|
|
<if test="answerType != null">
|
||
|
|
answerType = #{answerType},
|
||
|
|
</if>
|
||
|
|
<if test="assignmentId != null">
|
||
|
|
assignmentId = #{assignmentId},
|
||
|
|
</if>
|
||
|
|
<if test="raceId != null">
|
||
|
|
raceId = #{raceId},
|
||
|
|
</if>
|
||
|
|
<if test="essayBaseId != null">
|
||
|
|
essayBaseId = #{essayBaseId},
|
||
|
|
</if>
|
||
|
|
<if test="score != null">
|
||
|
|
score = #{score},
|
||
|
|
</if>
|
||
|
|
<if test="origiScore != null">
|
||
|
|
origiScore = #{origiScore},
|
||
|
|
</if>
|
||
|
|
<if test="humanScore != null">
|
||
|
|
humanScore = #{humanScore},
|
||
|
|
</if>
|
||
|
|
<if test="trueScore != null">
|
||
|
|
trueScore = #{trueScore},
|
||
|
|
</if>
|
||
|
|
<if test="areaId != null">
|
||
|
|
areaId = #{areaId},
|
||
|
|
</if>
|
||
|
|
<if test="created != null">
|
||
|
|
created = #{created},
|
||
|
|
</if>
|
||
|
|
<if test="content != null">
|
||
|
|
content = #{content},
|
||
|
|
</if>
|
||
|
|
<if test="language != null">
|
||
|
|
language = #{language},
|
||
|
|
</if>
|
||
|
|
<if test="structure != null">
|
||
|
|
structure = #{structure},
|
||
|
|
</if>
|
||
|
|
<if test="overall != null">
|
||
|
|
overall = #{overall},
|
||
|
|
</if>
|
||
|
|
<if test="correct != null">
|
||
|
|
correct = #{correct},
|
||
|
|
</if>
|
||
|
|
<if test="stepOneCorrect != null">
|
||
|
|
stepOneCorrect = #{stepOneCorrect},
|
||
|
|
</if>
|
||
|
|
<if test="picture != null">
|
||
|
|
picture = #{picture},
|
||
|
|
</if>
|
||
|
|
<if test="picText != null">
|
||
|
|
picText = #{picText},
|
||
|
|
</if>
|
||
|
|
<if test="useWords != null">
|
||
|
|
useWords = #{useWords},
|
||
|
|
</if>
|
||
|
|
<if test="isExpire != null">
|
||
|
|
isExpire = #{isExpire},
|
||
|
|
</if>
|
||
|
|
</set>
|
||
|
|
WHERE essayAnswerId = #{essayAnswerId}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<select id="getSeqEssayAnswer" resultType="int">
|
||
|
|
SELECT NEXTVAL('seq_essayanswerid')
|
||
|
|
</select>
|
||
|
|
<select id="getEssayAnswerByUidAndAssignmentId" resultType="com._3e.entity.EssayAnswer">
|
||
|
|
select * from essayanswer where uid=#{uid} and assignmentid=#{assignmentId} and areaid = #{areaId} order by score desc limit 1;
|
||
|
|
</select>
|
||
|
|
<select id="getEssayAnswerById" resultType="com._3e.entity.EssayAnswer">
|
||
|
|
select * from essayanswer where essayanswerid=#{essayAnswerId}
|
||
|
|
</select>
|
||
|
|
<select id="getUserAnswerDayCount" resultType="java.lang.Integer">
|
||
|
|
SELECT COUNT(1)
|
||
|
|
FROM essayanswer
|
||
|
|
WHERE uid = #{uid}
|
||
|
|
AND created >= #{startTime}
|
||
|
|
AND created <= #{endTime}
|
||
|
|
AND CASE
|
||
|
|
WHEN answerType = 1 AND assignmentId != 0 THEN FALSE
|
||
|
|
ELSE TRUE
|
||
|
|
END
|
||
|
|
</select>
|
||
|
|
<select id="getEssayAnswerCountByUidAndRaceId" resultType="java.lang.Integer">
|
||
|
|
select count(1) from essayanswer where uid = #{uid} and raceId= #{raceId}
|
||
|
|
</select>
|
||
|
|
<select id="getAllCountByRaceId" resultType="java.lang.Integer">
|
||
|
|
select COUNT(DISTINCT uid) from essayanswer where raceId= #{raceId}
|
||
|
|
</select>
|
||
|
|
<select id="findEssayAnswerClassAssign" resultType="com._3e.entity.EssayAnswer">
|
||
|
|
WITH temp as (
|
||
|
|
select soc.studentId from StudentOwnClass soc
|
||
|
|
inner join student s on soc.studentid=s.studentid and s.areaid = #{areaId} and s.status = 1
|
||
|
|
where soc.classesId =#{classesId} and soc.areaid = #{areaId} and soc.status=1
|
||
|
|
)
|
||
|
|
SELECT * FROM (SELECT e.*, ROW_NUMBER() OVER (PARTITION BY e.uid ORDER BY e.score DESC) as rn
|
||
|
|
FROM essayanswer e INNER JOIN temp t ON e.uid = t.studentId
|
||
|
|
WHERE e.assignmentId = #{assignmentId}
|
||
|
|
) ranked
|
||
|
|
WHERE rn = 1
|
||
|
|
</select>
|
||
|
|
</mapper>
|