xiangpei
2024-07-16 fc36338476ccb0e8fa641794de4022f300f59a2e
src/main/resources/mapper/QuestionSubjectMapper.xml
@@ -98,24 +98,67 @@
            id DESC
    </select>
    <select id="questionsBySubjectId"  resultType="integer">
    <select id="questionsBySubjectId" resultType="integer">
        SELECT
            tqs.question_id
            tqs.question_id, ttc.content
        FROM
            t_question_subject tqs
                INNER JOIN t_question tq ON tqs.question_id = tq.id AND tqs.subject_id = #{subjectId}
                INNER JOIN t_text_content ttc ON ttc.id = tq.info_text_content_id
        ORDER BY
            tqs.id DESC
    </select>
    <select id="questionsBySubjectIdAndQuestionType" resultType="integer">
        SELECT
            tqs.question_id
            tqs.question_id, ttc.content
        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}
                INNER JOIN t_text_content ttc ON ttc.id = tq.info_text_content_id
        ORDER BY
            tqs.id DESC
    </select>
    <select id="bySubjectId" resultType="com.mindskip.xzs.domain.vo.QuestionVO">
        SELECT
           tq.id,
           tq.question_type,
           tq.correct,
           ttc.content as contentJson
        FROM
            t_question_subject tqs
                INNER JOIN t_question tq ON tqs.question_id = tq.id AND tqs.subject_id = #{subjectId}
                INNER JOIN t_text_content ttc ON ttc.id = tq.info_text_content_id
        ORDER BY
            tq.id DESC
    </select>
    <select id="bySubjectIdAndQuestionType" resultType="com.mindskip.xzs.domain.vo.QuestionVO">
        SELECT
            tq.id,
            tq.question_type,
            tq.correct,
            ttc.content as contentJson
        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}
                INNER JOIN t_text_content ttc ON ttc.id = tq.info_text_content_id
        ORDER BY
            tq.id DESC
    </select>
    <select id="getSubjectBySubjectIds" resultType="com.mindskip.xzs.domain.QuestionSubject">
        select qs.*,s.name as subName
        from t_question_subject qs
                 left join t_subject s on qs.subject_id = s.id
        where qs.deleted = 0 and s.deleted = 0
        <if test="subjectIds != null and subjectIds.length > 0">
            and qs.subject_id in
            <foreach collection="subjectIds" item="subjectId" open="(" separator="," close=")">
                #{subjectId}
            </foreach>
        </if>
    </select>
</mapper>