From 2873f1cd6ea6caac062740e05994a1f0a880ffde Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 12 三月 2024 11:27:20 +0800
Subject: [PATCH] 一个用户只能是一个部门的管理员、创建随机试卷的时候人员只能选当前部门的人,试卷增加部门id

---
 src/main/resources/mapper/QuestionMapper.xml |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/src/main/resources/mapper/QuestionMapper.xml b/src/main/resources/mapper/QuestionMapper.xml
index cd42200..ba39eaa 100644
--- a/src/main/resources/mapper/QuestionMapper.xml
+++ b/src/main/resources/mapper/QuestionMapper.xml
@@ -180,26 +180,36 @@
 
   <select id="page" resultMap="BaseResultMap" parameterType="com.mindskip.xzs.viewmodel.admin.question.QuestionPageRequestVM">
     SELECT
-    <include refid="Base_Column_List"/>
-    FROM t_question
+    q.*
+    FROM t_question q
+    LEFT JOIN t_question_subject qs on q.id = qs.question_id
+    LEFT JOIN t_text_content t on q.info_text_content_id = t.id
     <where>
-        and deleted=0
+        and q.deleted=0 and qs.deleted = 0
       <if test="id != null ">
-        and id= #{id}
+        and q.id= #{id}
       </if>
       <if test="level != null ">
-        and grade_level= #{level}
+        and q.grade_level= #{level}
       </if>
       <if test="subjectId != null ">
-        and subject_id= #{subjectId}
+        and qs.subject_id in
+        <foreach item="subjectId" collection="subjectId" open="(" separator=","
+                 close=")">
+          #{subjectId}
+        </foreach>
       </if>
       <if test="questionType != null ">
-        and question_type= #{questionType}
+        and q.question_type= #{questionType}
+      </if>
+      <if test="questionName != null and questionName != ''">
+        and t.content->'$."titleContent"' LIKE concat('%',#{questionName},'%')
       </if>
       <if test="content != null">
-        and info_text_content_id in (SELECT id FROM t_text_content WHERE content like concat('%',#{content},'%') )
+        and q.info_text_content_id in (SELECT id FROM t_text_content WHERE content like concat('%',#{content},'%') )
       </if>
     </where>
+    group by q.id
   </select>
 
 
@@ -228,4 +238,8 @@
 		GROUP BY create_time
 	</select>
 
+  <select id="getAll"  resultMap="BaseResultMap">
+    SELECT <include refid="Base_Column_List"/>
+        from t_question where  deleted=0
+  </select>
 </mapper>

--
Gitblit v1.8.0