From 0b0ffef0a59a2733b94be6cef4fc8ae093620d72 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期三, 03 七月 2024 18:38:01 +0800 Subject: [PATCH] 作弊代码生成 --- src/main/resources/mapper/QuestionMapper.xml | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/src/main/resources/mapper/QuestionMapper.xml b/src/main/resources/mapper/QuestionMapper.xml index 7c3da50..250f3a0 100644 --- a/src/main/resources/mapper/QuestionMapper.xml +++ b/src/main/resources/mapper/QuestionMapper.xml @@ -92,4 +92,30 @@ <foreach collection="questionIds" open="(" item="id" close=")" separator=",">#{id}</foreach> </select> + <select id="selectByDifAndSub" resultType="java.lang.Integer"> + SELECT COUNT(*) FROM t_question + <where> + deleted = 0 and status = 1 + <if test="subjectId!=null">and subject_id = #{subjectId}</if> + <if test="difficult!=null">AND difficult = #{difficult}</if> + <if test="questionType!=null">AND question_type = #{questionType}</if> + </where> + + </select> + + <select id="getRandomQuestion" resultMap="BaseResultMap"> + SELECT + * + FROM + t_question tq + <where> + tq.deleted = 0 and tq.status = 1 + <if test="subjectId!=null">and tq.subject_id = #{subjectId}</if> + <if test="difficult!=null">AND tq.difficult = #{difficult}</if> + <if test="questionType!=null">AND tq.question_type = #{questionType}</if> + </where> + ORDER BY + RAND() + LIMIT #{num} + </select> </mapper> -- Gitblit v1.8.0