From 47cd9ecc0eff38ffe6b3b794b2bf197e958f4403 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期三, 14 五月 2025 15:50:57 +0800
Subject: [PATCH] bug:学员有状态不能修改问题
---
src/main/resources/mapper/QuestionMapper.xml | 112 +++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 99 insertions(+), 13 deletions(-)
diff --git a/src/main/resources/mapper/QuestionMapper.xml b/src/main/resources/mapper/QuestionMapper.xml
index b5d066c..3b4d506 100644
--- a/src/main/resources/mapper/QuestionMapper.xml
+++ b/src/main/resources/mapper/QuestionMapper.xml
@@ -186,13 +186,16 @@
LEFT JOIN t_text_content t on q.info_text_content_id = t.id
<where>
and q.deleted=0 and qs.deleted = 0
+ <if test="titleContent != null and titleContent != ''">
+ and JSON_VALUE(t.content, '$.titleContent') like concat('%', #{titleContent}, '%')
+ </if>
<if test="id != null ">
and q.id= #{id}
</if>
<if test="level != null ">
and q.grade_level= #{level}
</if>
- <if test="subjectId != null ">
+ <if test="subjectId != null and subjectId.length > 0">
and qs.subject_id in
<foreach item="subjectId" collection="subjectId" open="(" separator=","
close=")">
@@ -249,19 +252,55 @@
<select id="export" resultMap="exportMap">
SELECT
+ DISTINCT
q.*, ttc.content
FROM
t_question q
INNER JOIN t_text_content ttc on q.info_text_content_id = ttc.id AND q.deleted = 0
+ INNER JOIN t_question_subject tqs on q.id = tqs.question_id
<where>
- <if test="query.questionType != null">
- q.question_type = #{query.questionType}
- </if>
- <if test="query.start != null and query.end != null">
- q.create_time between #{query.start} and #{query.end}
+ <if test="query.subjectIds != null and query.subjectIds.size > 0">
+ AND tqs.subject_id IN
+ <foreach collection="query.subjectIds" open="(" separator="," close=")" item="subjectId">
+ #{subjectId}
+ </foreach>
</if>
</where>
</select>
+
+ <select id="exportData" resultMap="exportDataMap">
+ SELECT
+ DISTINCT
+ q.id,
+ q.question_type,
+ q.score,
+ q.difficult,
+ q.correct,
+ ttc.content
+ FROM
+ t_question q
+ INNER JOIN t_text_content ttc on q.info_text_content_id = ttc.id AND q.deleted = 0
+ INNER JOIN t_question_subject tqs on q.id = tqs.question_id
+ <where>
+ <if test="query.subjectIds != null and query.subjectIds.size > 0">
+ AND tqs.subject_id IN
+ <foreach collection="query.subjectIds" open="(" separator="," close=")" item="subjectId">
+ #{subjectId}
+ </foreach>
+ </if>
+ </where>
+ </select>
+
+ <resultMap id="exportDataMap" type="com.mindskip.xzs.vo.QuestionImportVO">
+ <result column="question_type" property="questionType"/>
+ <result column="title" property="title"/>
+ <result column="analyze" property="analyze"/>
+ <result column="content" property="questionContent"/>
+ <result column="correct" property="correct"/>
+ <result column="score" property="score"/>
+ <result column="difficult" property="difficult"/>
+ <collection property="subjectList" column="id" ofType="string" select="selectSubjects"/>
+ </resultMap>
<resultMap id="exportMap" type="com.mindskip.xzs.vo.QuestionImportVO">
<result column="question_type" property="questionType"/>
@@ -282,22 +321,30 @@
ON tqs.subject_id = ts.id AND tqs.question_id = #{id} AND tqs.deleted = 0 AND ts.deleted = 0
</select>
+ <select id="getQuestionSubjects" resultType="string">
+ SELECT ts.name
+ FROM t_question_subject tqs
+ INNER JOIN t_subject ts
+ ON tqs.subject_id = ts.id AND tqs.question_id = #{questionId} AND tqs.deleted = 0 AND ts.deleted = 0
+ </select>
+
<select id="getVoByIds" resultType="com.mindskip.xzs.domain.vo.QuestionVO">
SELECT
- tq.id,
- tq.question_type as questionType,
- tq.difficult,
- ttc.content as contentJson
+ tq.id,
+ tq.question_type as questionType,
+ tq.difficult,
+ ttc.content as contentJson
FROM
- t_question tq
- INNER JOIN t_text_content ttc ON tq.info_text_content_id = ttc.id AND tq.deleted = 0 AND tq.id IN
+ t_question tq
+ INNER JOIN t_text_content ttc ON tq.info_text_content_id = ttc.id AND tq.deleted = 0 AND tq.id IN
<foreach
collection="ids" open="(" separator="," close=")" item="id">
#{id}
</foreach>
</select>
- <select id="selectQuestion" resultType="com.mindskip.xzs.viewmodel.student.question.answer.QuestionPageStudentResponseVM">
+ <select id="selectQuestion"
+ resultType="com.mindskip.xzs.viewmodel.student.question.answer.QuestionPageStudentResponseVM">
select a.id,
a.question_type,
JSON_VALUE(d.content, '$.titleContent') as shortTitle,
@@ -307,9 +354,48 @@
inner join t_subject c on b.subject_id = c.id and c.deleted = 0
inner join t_text_content d on a.info_text_content_id = d.id
where a.deleted = 0
+ AND JSON_VALUE(d.content, '$.titleContent') like concat('%', #{shortTitle}, '%')
group by a.id, question_type, a.create_time
HAVING GROUP_CONCAT(c.name) like concat('%', #{subjectName}, '%')
order by a.create_time
</select>
+ <select id="selectContentById" resultType="com.mindskip.xzs.domain.vo.QuestionVO">
+ SELECT tq.id,
+ tq.question_type as questionType,
+ tq.difficult,
+ ttc.content as contentJson,
+ tq.correct
+ FROM t_question tq
+ INNER JOIN t_text_content ttc ON tq.info_text_content_id = ttc.id AND tq.id = #{id}
+ </select>
+
+ <select id="getAnswer" resultType="com.mindskip.xzs.domain.vo.QuestionVO">
+ SELECT tq.correct,
+ ttc.content as contentJson
+ FROM t_question tq
+ INNER JOIN t_text_content ttc ON tq.info_text_content_id = ttc.id AND tq.id = #{id} AND tq.deleted = 0
+ </select>
+
+ <select id="countQuestionByTitle" resultType="integer">
+ SELECT
+ DISTINCT q.id
+ FROM
+ t_question q
+ INNER JOIN t_text_content d on q.info_text_content_id = d.id
+ WHERE JSON_VALUE(d.content, '$.titleContent') = #{title} AND q.deleted = 0
+ limit 1
+ </select>
+
+ <select id="countQuestionByTitleAndSubject" resultType="com.mindskip.xzs.vo.QuestionSubjectVO">
+ SELECT
+ s.subject_id, s.question_id
+ FROM
+ t_question q
+ INNER JOIN t_text_content d on q.info_text_content_id = d.id
+ INNER JOIN t_question_subject s ON q.id = s.question_id
+ WHERE
+ JSON_VALUE(d.content, '$.titleContent') = #{title} AND s.subject_id = #{subjectId} AND q.deleted = 0
+ </select>
+
</mapper>
--
Gitblit v1.8.0