From 54a6c048c97011cd2a99fbef2065afe0a167fcfc Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期一, 22 七月 2024 13:46:05 +0800
Subject: [PATCH] fix:成绩统计导出完善
---
src/main/resources/mapper/QuestionMapper.xml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/src/main/resources/mapper/QuestionMapper.xml b/src/main/resources/mapper/QuestionMapper.xml
index 4e1b47a..5207f9b 100644
--- a/src/main/resources/mapper/QuestionMapper.xml
+++ b/src/main/resources/mapper/QuestionMapper.xml
@@ -186,6 +186,9 @@
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>
@@ -265,6 +268,36 @@
</where>
</select>
+ <select id="exportData" resultMap="exportDataMap">
+ SELECT
+ DISTINCT
+ q.id,
+ q.question_type,
+ 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.QuestionExportData">
+ <result column="question_type" property="questionType"/>
+ <result column="title" property="title"/>
+ <result column="analyze" property="analyze"/>
+ <result column="content" property="content"/>
+ <result column="correct" property="answer"/>
+ <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"/>
<result column="title" property="title"/>
@@ -282,6 +315,13 @@
FROM t_question_subject tqs
INNER JOIN t_subject ts
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">
@@ -333,4 +373,13 @@
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
+ COUNT(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
+ </select>
+
</mapper>
--
Gitblit v1.8.0