46 lines
1.5 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.WordAchiveDao">
<select id= "getNextSeq" resultType="long">
SELECT NEXTVAL('seq_wordachiveid')
</select>
<insert id= "doSave" parameterType="com._3e.entity.WordAchive">
INSERT INTO wordachive(wordachiveid,uid,pointcasetype,wordsid,score,accuracy,fluent,integrity,content,created,areaid)
VALUES (
<if test="wordachiveid == 0">
(SELECT NEXTVAL('seq_wordachiveid')),
</if>
<if test="wordachiveid != 0">
#{wordachiveid},
</if>
#{uid},#{pointcasetype},#{wordsid},#{score},#{accuracy},#{fluent},#{integrity},#{content},#{created},#{areaid})
</insert>
<select id= "findMyWordAchiveGradesByLessionids" parameterType="map" resultType="map" >
WITH temp AS (
SELECT wordsid,lessonid
FROM words
WHERE status = 1
and lessonId IN
<foreach item="item" index="index" collection="lessionidList"
open="(" separator="," close=")">
#{item}
</foreach>
),
temp2 AS (
SELECT wa.wordsid
FROM wordAchive wa
RIGHT JOIN temp w ON wa.wordsId = w.wordsId AND wa.uid = #{uid}
and wa.areaid = #{areaid}
WHERE wa.created &gt;= #{startTime}
AND wa.created &lt; #{endTime}
)
SELECT COUNT(DISTINCT(t2.wordsid))||'/'||COUNT(DISTINCT(t.wordsid)) AS finishCount
FROM temp t
LEFT JOIN temp2 t2 ON t.wordsId = t2.wordsId
</select>
</mapper>