From d5f80c24adbef34f8e66cedb46a72a6395134445 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期二, 14 五月 2024 15:09:28 +0800 Subject: [PATCH] 题目练习 --- src/main/resources/mapper/QuestionSubjectMapper.xml | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/src/main/resources/mapper/QuestionSubjectMapper.xml b/src/main/resources/mapper/QuestionSubjectMapper.xml index 90ac102..1b05d52 100644 --- a/src/main/resources/mapper/QuestionSubjectMapper.xml +++ b/src/main/resources/mapper/QuestionSubjectMapper.xml @@ -79,4 +79,36 @@ RAND() LIMIT #{questionNum} </select> + <select id="questionsBySubjectIds" resultType="integer"> + SELECT + question_id + FROM + t_question_subject + <where> + subject_id IN <foreach collection="subjectIds" open="(" separator="," close=")" item="subjectId">#{subjectId}</foreach> + </where> + ORDER BY + id DESC + </select> + + <select id="questionsBySubjectId" resultType="integer"> + SELECT + tqs.question_id + FROM + t_question_subject tqs + INNER JOIN t_question tq ON tqs.question_id = tq.id AND tqs.subject_id = #{subjectId} + ORDER BY + tqs.id DESC + </select> + + <select id="questionsBySubjectIdAndQuestionType" resultType="integer"> + SELECT + tqs.question_id + FROM + t_question_subject tqs + INNER JOIN t_question tq ON tqs.question_id = tq.id AND tqs.subject_id = #{subjectId} AND tq.question_type = #{questionType} + ORDER BY + tqs.id DESC + </select> + </mapper> -- Gitblit v1.8.0