xiangpei
2024-05-14 d5f80c24adbef34f8e66cedb46a72a6395134445
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>