From 77dc2027ccc5beb101adad65fbd4350663384883 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期四, 23 五月 2024 16:19:59 +0800
Subject: [PATCH] feat:统计新需求
---
src/main/resources/mapper/QuestionSubjectMapper.xml | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/main/resources/mapper/QuestionSubjectMapper.xml b/src/main/resources/mapper/QuestionSubjectMapper.xml
index 7f134aa..69f5979 100644
--- a/src/main/resources/mapper/QuestionSubjectMapper.xml
+++ b/src/main/resources/mapper/QuestionSubjectMapper.xml
@@ -57,11 +57,13 @@
<select id="countQuestionNum" resultType="integer">
SELECT
- count(distinct id)
+ count(distinct tqs.question_id)
FROM
- t_question_subject
+ t_question_subject tqs
+ INNER JOIN t_question tq ON tq.id = tqs.question_id <if test="questionType != -99">AND tq.question_type = #{questionType}</if>
WHERE
- subject_id IN <foreach collection="subjects" open="(" separator="," close=")" item="subjectId">#{subjectId}</foreach>
+ tqs.subject_id IN <foreach collection="subjects" open="(" separator="," close=")" item="subjectId">#{subjectId}</foreach>
+
</select>
<select id="getRandomQuestionId" resultType="com.mindskip.xzs.domain.vo.QuestionVO">
@@ -74,7 +76,11 @@
tq.correct
FROM
t_question_subject tqs
- INNER JOIN t_question tq ON tqs.question_id = tq.id AND tq.deleted = 0 AND tqs.subject_id IN <foreach collection="subjectIds" open="(" separator="," close=")" item="subjectId">#{subjectId}</foreach>
+ INNER JOIN t_question tq ON tqs.question_id = tq.id AND tq.deleted = 0
+ <if test="questionType != null and questionType != -99">
+ AND tq.question_type = #{questionType}
+ </if>
+ AND tqs.subject_id IN <foreach collection="subjectIds" open="(" separator="," close=")" item="subjectId">#{subjectId}</foreach>
INNER JOIN t_text_content ttc ON tq.info_text_content_id = ttc.id
ORDER BY
RAND() LIMIT #{questionNum}
--
Gitblit v1.8.0