From dcaea52b2c0778ec4f929f60752cc6baf37b5a50 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 29 三月 2024 13:50:43 +0800
Subject: [PATCH] 题目导出

---
 src/main/resources/mapper/QuestionMapper.xml |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/QuestionMapper.xml b/src/main/resources/mapper/QuestionMapper.xml
index 6a2e725..fe253d0 100644
--- a/src/main/resources/mapper/QuestionMapper.xml
+++ b/src/main/resources/mapper/QuestionMapper.xml
@@ -244,11 +244,39 @@
   </select>
 
   <select id="export" resultMap="exportMap">
-    SELECT * FROM t_question q INNER JOIN t_question_subject qs on q.id = qs.question_id
+    SELECT
+           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
+    <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>
+    </where>
   </select>
 
   <resultMap id="exportMap" type="com.mindskip.xzs.vo.QuestionImportVO">
-
+    <result column="question_type" property="questionType" />
+    <result column="title" property="title" />
+    <result column="analyze" property="analyze" />
+    <result column="score" property="score" />
+    <result column="difficult" property="difficult" />
+    <result column="content" property="questionContent" />
+    <result column="score" property="score" />
+    <result column="correct" property="correct" />
+    <collection property="subjectList" column="id" ofType="string" select="selectSubjects"/>
   </resultMap>
 
+  <select id="selectSubjects" 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 = #{id} AND tqs.deleted = 0 AND ts.deleted = 0
+  </select>
+
 </mapper>

--
Gitblit v1.8.0