From fcecbb178516e6059ee732920ee1e22009406475 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期一, 27 五月 2024 11:19:53 +0800 Subject: [PATCH] userIds --- src/main/resources/mapper/QuestionMapper.xml | 47 ++++++++++++++++++++++++++++++++++------------- 1 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/main/resources/mapper/QuestionMapper.xml b/src/main/resources/mapper/QuestionMapper.xml index b5d066c..4e1b47a 100644 --- a/src/main/resources/mapper/QuestionMapper.xml +++ b/src/main/resources/mapper/QuestionMapper.xml @@ -192,7 +192,7 @@ <if test="level != null "> and q.grade_level= #{level} </if> - <if test="subjectId != null "> + <if test="subjectId != null and subjectId.length > 0"> and qs.subject_id in <foreach item="subjectId" collection="subjectId" open="(" separator="," close=")"> @@ -249,16 +249,18 @@ <select id="export" resultMap="exportMap"> SELECT + DISTINCT q.*, ttc.content FROM t_question q INNER JOIN t_text_content ttc on q.info_text_content_id = ttc.id AND q.deleted = 0 + INNER JOIN t_question_subject tqs on q.id = tqs.question_id <where> - <if test="query.questionType != null"> - q.question_type = #{query.questionType} - </if> - <if test="query.start != null and query.end != null"> - q.create_time between #{query.start} and #{query.end} + <if test="query.subjectIds != null and query.subjectIds.size > 0"> + AND tqs.subject_id IN + <foreach collection="query.subjectIds" open="(" separator="," close=")" item="subjectId"> + #{subjectId} + </foreach> </if> </where> </select> @@ -284,20 +286,21 @@ <select id="getVoByIds" resultType="com.mindskip.xzs.domain.vo.QuestionVO"> SELECT - tq.id, - tq.question_type as questionType, - tq.difficult, - ttc.content as contentJson + tq.id, + tq.question_type as questionType, + tq.difficult, + ttc.content as contentJson FROM - t_question tq - INNER JOIN t_text_content ttc ON tq.info_text_content_id = ttc.id AND tq.deleted = 0 AND tq.id IN + t_question tq + INNER JOIN t_text_content ttc ON tq.info_text_content_id = ttc.id AND tq.deleted = 0 AND tq.id IN <foreach collection="ids" open="(" separator="," close=")" item="id"> #{id} </foreach> </select> - <select id="selectQuestion" resultType="com.mindskip.xzs.viewmodel.student.question.answer.QuestionPageStudentResponseVM"> + <select id="selectQuestion" + resultType="com.mindskip.xzs.viewmodel.student.question.answer.QuestionPageStudentResponseVM"> select a.id, a.question_type, JSON_VALUE(d.content, '$.titleContent') as shortTitle, @@ -307,9 +310,27 @@ inner join t_subject c on b.subject_id = c.id and c.deleted = 0 inner join t_text_content d on a.info_text_content_id = d.id where a.deleted = 0 + AND JSON_VALUE(d.content, '$.titleContent') like concat('%', #{shortTitle}, '%') group by a.id, question_type, a.create_time HAVING GROUP_CONCAT(c.name) like concat('%', #{subjectName}, '%') order by a.create_time </select> + <select id="selectContentById" resultType="com.mindskip.xzs.domain.vo.QuestionVO"> + SELECT tq.id, + tq.question_type as questionType, + tq.difficult, + ttc.content as contentJson, + tq.correct + FROM t_question tq + INNER JOIN t_text_content ttc ON tq.info_text_content_id = ttc.id AND tq.id = #{id} + </select> + + <select id="getAnswer" resultType="com.mindskip.xzs.domain.vo.QuestionVO"> + SELECT tq.correct, + ttc.content as contentJson + FROM t_question tq + INNER JOIN t_text_content ttc ON tq.info_text_content_id = ttc.id AND tq.id = #{id} AND tq.deleted = 0 + </select> + </mapper> -- Gitblit v1.8.0