2026-03-10 16:40:19 +08:00

65 lines
2.1 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.WordsDao">
<select id= "findUnFinishAssignWordsByUnitID" parameterType="map" resultType="com._3e.entity.Words" >
WITH temp AS (
SELECT a.assignMentId,a.startTime,a.endTime
FROM assignMent a
INNER JOIN assignDetail d ON a.assignMentId = d.assignMentId
INNER JOIN assignToClass c ON a.assignMentId = c.assignMentId
INNER JOIN studentOwnClass s ON s.classesId = c.classesId
and s.areaid = #{areaid}
AND s.status = 1 AND s.studentId = #{uid}
WHERE a.assignType = 'W' AND d.unitId = #{unitId}
AND a.endTime &gt;= now() and a.status=1
ORDER BY a.created DESC LIMIT 1
),
temp2 AS (
SELECT a.wordsId,a.created
FROM wordachive a
JOIN temp t1 ON 1 = 1
WHERE
a.areaid =#{areaid}
and a.created &gt; t1.startTime AND a.created &lt; t1.endTime
AND a.uid = #{uid}
)
SELECT DISTINCT(w.wordsId),w.content
FROM words w
LEFT JOIN temp2 t2 ON w.wordsId = t2.wordsId
WHERE w.lessonId = #{unitId} AND t2.created IS NULL
ORDER BY w.wordsId ASC
</select>
<select id= "findUnivUnFinishAssignWordsByUnitID" parameterType="map" resultType="com._3e.entity.Words" >
WITH temp AS (
SELECT a.assignMentId,a.startTime,a.endTime
FROM univassignMent a
INNER JOIN univassignDetail d ON a.assignMentId = d.assignMentId
INNER JOIN univassignToClass c ON a.assignMentId = c.assignMentId
INNER JOIN univstudentOwnClass s ON s.classesId = c.classesId
AND s.status = 1 AND s.studentId = #{uid}
WHERE a.assignType = 'W' AND d.unitId = #{unitId}
AND a.endTime &gt;= now() and a.status=1
ORDER BY a.created DESC LIMIT 1
),
temp2 AS (
SELECT a.wordsId,a.created
FROM univwordachive a
JOIN temp t1 ON 1 = 1
WHERE a.created &gt; t1.startTime AND a.created &lt; t1.endTime
AND a.uid = #{uid}
)
SELECT DISTINCT(w.wordsId),w.content
FROM words w
LEFT JOIN temp2 t2 ON w.wordsId = t2.wordsId
WHERE w.lessonId = #{unitId} AND t2.created IS NULL
ORDER BY w.wordsId ASC
</select>
</mapper>