298 lines
11 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.mysqldao.VocavularyDao">
<!-- 通用查询映射结果 -->
<resultMap id="WordsResultMap" type="com._3e.entity.VocavularyWords">
<id column="word_id" property="wordId"/>
<result column="course_code" property="courseCode"/>
<result column="content" property="content"/>
<result column="phonetic" property="phonetic"/>
<result column="picture" property="picture"/>
<result column="translate" property="translate"/>
<result column="example1" property="example1"/>
<result column="example2" property="example2"/>
<result column="example3" property="example3"/>
<result column="is_major" property="isMajor"/>
<result column="phonics" property="phonics"/>
<result column="phonics_voice" property="phonicsVoice"/>
<result column="phonics_part_voice" property="phonicsPartVoice"/>
<result column="example_voice" property="exampleVoice"/>
</resultMap>
<!-- 单词通用查询结果列 -->
<sql id="WordsBase_Column_List">
word_id, course_code, content, phonetic, picture, translate, example1, example2, example3, is_major, phonics, phonics_voice, phonics_part_voice, example_voice
</sql>
<!-- 通用查询映射结果 -->
<resultMap id="WordsHomeworkResultMap" type="com._3e.entity.WordsHomework">
<id column="words_homework_id" property="wordsHomeworkId"/>
<result column="creator_id" property="creatorId"/>
<result column="classes_id" property="classesId"/>
<result column="homework_description" property="homeworkDescription"/>
<result column="homework_content" property="homeworkContent"/>
<result column="homework_type" property="homeworkType"/>
<result column="study_type" property="studyType"/>
<result column="homework_words" property="homeworkWords"/>
<result column="homework_words_brief" property="homeworkWordsBrief"/>
<result column="words_count" property="wordsCount"/>
<result column="exercise_count" property="exerciseCount"/>
<result column="homework_start_time" property="homeworkStartTime"/>
<result column="homework_end_time" property="homeworkEndTime"/>
<result column="delay_time" property="delayTime"/>
<result column="homework_platform_type" property="homeworkPlatformType"/>
<result column="words_homework_status" property="wordsHomeworkStatus"/>
<result column="creat_time" property="creatTime"/>
<result column="update_time" property="updateTime"/>
<result column="is_aborted" property="isAborted"/>
<result column="assign_time" property="assignTime"/>
<result column="number" property="number"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="WordsHomeworkBase_Column_List">
words_homework_id, creator_id, classes_id, homework_description, homework_content, homework_type, study_type, homework_words, homework_words_brief, words_count, exercise_count, homework_start_time, homework_end_time, delay_time, homework_platform_type, words_homework_status, creat_time, update_time, is_aborted,assign_time,number
</sql>
<insert id="doSaveWordsHomework">
insert into ct_wordshomework_vocabulary <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creatorId != null">
creator_id,
</if>
<if test="classesId != null">
classes_id,
</if>
<if test="homeworkDescription != null">
homework_description,
</if>
<if test="homeworkContent != null">
homework_content,
</if>
<if test="homeworkType != null">
homework_type,
</if>
<if test="studyType != null">
study_type,
</if>
<if test="homeworkWords != null">
homework_words,
</if>
<if test="homeworkWordsBrief != null">
homework_words_brief,
</if>
<if test="wordsCount != null">
words_count,
</if>
<if test="exerciseCount != null">
exercise_count,
</if>
<if test="homeworkStartTime != null">
homework_start_time,
</if>
<if test="homeworkEndTime != null">
homework_end_time,
</if>
<if test="delayTime != null">
delay_time,
</if>
<if test="homeworkPlatformType != null">
homework_platform_type,
</if>
<if test="wordsHomeworkStatus != null">
words_homework_status,
</if>
<if test="creatTime != null">
creat_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="isAborted != null">
is_aborted,
</if>
<if test="assignTime != null">
assign_time,
</if>
<if test="number != null">
number
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="creatorId != null">
#{creatorId,jdbcType=BIGINT},
</if>
<if test="classesId != null">
#{classesId,jdbcType=BIGINT},
</if>
<if test="homeworkDescription != null">
#{homeworkDescription},
</if>
<if test="homeworkContent != null">
#{homeworkContent},
</if>
<if test="homeworkType != null">
#{homeworkType},
</if>
<if test="studyType != null">
#{studyType},
</if>
<if test="homeworkWords != null">
#{homeworkWords},
</if>
<if test="homeworkWordsBrief != null">
#{homeworkWordsBrief},
</if>
<if test="wordsCount != null">
#{wordsCount},
</if>
<if test="exerciseCount != null">
#{exerciseCount},
</if>
<if test="homeworkStartTime != null">
#{homeworkStartTime},
</if>
<if test="homeworkEndTime != null">
#{homeworkEndTime},
</if>
<if test="delayTime != null">
#{delayTime},
</if>
<if test="homeworkPlatformType != null">
#{homeworkPlatformType},
</if>
<if test="wordsHomeworkStatus != null">
#{wordsHomeworkStatus},
</if>
<if test="creatTime != null">
#{creatTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="isAborted != null">
#{isAborted},
</if>
<if test="assignTime != null">
#{assignTime},
</if>
<if test="number != null">
#{number}
</if>
</trim>
</insert>
<insert id="doSaveWordAchive" useGeneratedKeys="true" keyProperty="wordAchiveId">
INSERT INTO wordachive(uid,pointCaseType,wordsId,score,accuracy,fluent,integrity,content,created,areaId)
VALUES (#{uid},#{pointCaseType},#{wordsId},#{score},#{accuracy},#{fluent},#{integrity},#{content},#{created},#{areaId})
</insert>
<insert id="doSaveFinishAssignStat">
insert into finishassignstat
(uid,assignmentId,content,lessonCount ,completeCount,created,howmuch ,maxScore,avgScore,areaId,uuid,avgAccuracy,avgFluent,avgIntegrity) values
(#{uid},#{assignmentId},#{content},#{lessonCount},#{completeCount},#{created},#{howMuch},#{maxScore},#{avgScore},#{areaId},#{uuid},#{avgAccuracy},#{avgFluent},#{avgIntegrity})
ON DUPLICATE KEY UPDATE
created=VALUES(created),
completeCount=VALUES(completeCount),
howMuch=VALUES(howMuch),
maxScore=VALUES(maxScore),
avgScore=VALUES(avgScore)
</insert>
<update id="doUpdateFinishAssignStat">
update finishassignstat set content=#{content},lessonCount=#{lessonCount},
completeCount=#{completeCount},created=#{created},
howMuch=#{howMuch},maxScore=#{maxScore},avgScore=#{avgScore},
avgAccuracy=#{avgAccuracy},avgFluent=#{avgFluent}, avgIntegrity=#{avgIntegrity}
where uid=#{uid} and assignmentId=#{assignmentId} and areaId=#{areaId}
</update>
<update id="updateWordAchive">
UPDATE WordAchive SET uid = #{uid}, pointCaseType = #{pointCaseType}, wordsId = #{wordsId},
score = #{score}, accuracy = #{accuracy}, fluent = #{fluent}, integrity = #{integrity},
content = #{content}, created = #{created} , areaId = #{areaId}
where wordAchiveId=#{wordAchiveId}
</update>
<select id="getExerciseCountByWordIds" resultType="java.lang.Integer">
SELECT
count( id )
FROM
ct_exercise_word_vocabulary
WHERE
status = 1 and
word_id IN
<foreach collection="wordIds" item="item" separator="," open="(" close=")" index="index">
#{item}
</foreach>
</select>
<select id="getWordsDetails" resultType="com._3e.http.wordmysql.dto.ResReadAloudWords">
select word_id wordId,content,phonetic,picture,translate,example1,phonics_voice phonicsVoice,example_voice exampleVoice from ct_words_vocabulary where word_id in
<foreach collection="wordIds" item="item" separator="," open="(" close=")" index="index">
#{item}
</foreach>
</select>
<select id="getAssignmentByAssignmentId" resultMap="WordsHomeworkResultMap">
select <include refid="WordsHomeworkBase_Column_List" />
from ct_wordshomework_vocabulary where words_homework_id = #{assignmentId}
</select>
<select id="getFinishWords" resultType="java.lang.Integer">
select DISTINCT(wordsid) from wordachive where uid = #{uid} and created > #{startTime} and created &lt; #{endTime} and
wordsid in
<foreach collection="wordIds" item="item" separator="," open="(" close=")" index="index">
#{item}
</foreach>
</select>
<select id="getHomeworksByWordId" resultMap="WordsHomeworkResultMap">
SELECT <include refid="WordsHomeworkBase_Column_List" />
FROM ct_wordshomework_vocabulary
WHERE words_homework_status = 1 and is_aborted = 0 and homework_type = 3 and
homework_start_time &lt; #{created} and homework_end_time > #{created}
and FIND_IN_SET(#{wordId}, homework_words_brief) > 0
AND classes_id IN
<foreach collection="classesIds" index="index" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</select>
<select id="getFinishAssignStatByAssignmentIdAndUid" resultType="com._3e.entity.VocavularyFinishAssignStat">
select uid,assignmentId,content,lessonCount ,completeCount,created,howMuch ,maxScore,avgScore,areaId,uuid from finishassignstat
where assignmentId=#{assignmentId} and uid=#{uid}
</select>
<select id="getFinishAssignStatsByAssignmentIdOfWordTwo" resultType="com._3e.entity.VocavularyFinishAssignStat">
select count( distinct wordsid ) as completeCount ,
count(wordsid) as howMuch , max( score ) as maxScore , avg( score ) as avgScore from wordachive where uid = #{uid} and created > #{startTime} and created &lt; #{endTime} and
wordsid in
<foreach collection="wordIds" item="item" separator="," open="(" close=")" index="index">
#{item}
</foreach>
</select>
<resultMap id="UnitUrlMap" type="com._3e.http.achivement.dto._3EResUnitUrlV2">
<result column="unitId" property="unitId"></result>
<result column="unitName" property="unitName"></result>
<result column="orderId" property="orderId"></result>
<collection property="words" ofType="com._3e.http.achivement.dto.WordsUrlV2">
<result column="wordsId" property="wordsId"></result>
<result column="content" property="content"></result>
<result column="translate" property="translate"></result>
<result column="picture" property="picture"></result>
<result column="voice" property="voice"></result>
<result column="orderId" property="orderId"></result>
</collection>
</resultMap>
<select id="findUnitWordUrlByLessonIdV2" resultMap="UnitUrlMap">
select
bl.id unitId,
bl.name unitName,
bl.order_id orderId,
w.word_id wordsId,
w.content,w.translate,
w.picture,w.phonics_voice voice,w.orderId
from ct_book_lesson_vocabulary bl left join ct_words_vocabulary w on bl.id = w.course_code and w.status = 1
where bl.parent_id = #{lessonId} and bl.status = 1
order by bl.order_id,w.orderId
</select>
<select id="getDoneWordsNumJcontent" resultType="com._3e.http.wordmysql.dto.WordNumberVO">
select wordsid wordId,count(wordsid) studentNum from wordachive where uid = #{uid} and created > #{startTime} and created &lt; #{endTime} and
wordsid in
<foreach collection="wordIds" item="item" separator="," open="(" close=")" index="index">
#{item}
</foreach>
group by wordsid
</select>
</mapper>