From 38505842d98c83c05151c9a5ec9cf71198c90281 Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期五, 05 七月 2024 09:39:56 +0800 Subject: [PATCH] 会议时间bug+乐观锁版本 --- 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