2 Commits 083e190ff6 ... e3d3820f3b

Autore SHA1 Messaggio Data
  GUXI e3d3820f3b Merge remote-tracking branch 'origin/master' 2 anni fa
  GUXI 87617e7880 获取试卷列表优化 2 anni fa
1 ha cambiato i file con 25 aggiunte e 23 eliminazioni
  1. 25 23
      ruoyi-system/src/main/resources/mapper/dlhh/ExamMapper.xml

+ 25 - 23
ruoyi-system/src/main/resources/mapper/dlhh/ExamMapper.xml

@@ -391,29 +391,31 @@
     </select>
 
     <select id="listByTrain" resultMap="ExamTrainDtoResult" parameterType="ExamTrainDto">
-        SELECT
-            a.id,a.NAME,a.start_time,a.end_time,a.minute_len,a.create_user_id,a.role_ids,
-            b.NAME username,0 AS 'role_id','' AS 'roleName',a.create_time,a.type,
-            a.STATUS,a.train_practical_result_id,a.train_practical_step_result_id
-        FROM
-            exam a
-            LEFT JOIN userinfo b ON a.create_user_id = b.id
-        <if test="trainPracticalResultId != null">WHERE a.train_practical_result_id = #{trainPracticalResultId}</if>
-            UNION
-        SELECT
-            a.id,a.NAME,a.start_time,a.end_time,a.minute_len,a.create_user_id,a.role_ids,
-            b.NAME username,c.role_id, d.NAME roleName,a.create_time,a.type,
-            a.STATUS,a.train_practical_result_id, a.train_practical_step_result_id
-        FROM
-            train_task_step_question c
-            LEFT JOIN exam a ON a.id = c.question_id
-            LEFT JOIN userinfo b ON a.create_user_id = b.id
-            LEFT JOIN train_role d ON c.role_id = d.id
-        <if test="stepIdList != null">WHERE c.step_id in
-            <foreach item="id" collection="stepIdList" open="(" separator="," close=")">
-              #{id}
-            </foreach>
-        </if>
+        SELECT a.* from (
+            SELECT
+                a.id,a.NAME,a.start_time,a.end_time,a.minute_len,a.create_user_id,a.role_ids,
+                b.NAME username,0 AS 'role_id','' AS 'roleName',a.create_time,a.type,
+                a.STATUS,a.train_practical_result_id,a.train_practical_step_result_id
+            FROM
+                exam a
+                LEFT JOIN userinfo b ON a.create_user_id = b.id
+            <if test="trainPracticalResultId != null">WHERE a.train_practical_result_id = #{trainPracticalResultId}</if>
+                UNION
+            SELECT
+                a.id,a.NAME,a.start_time,a.end_time,a.minute_len,a.create_user_id,a.role_ids,
+                b.NAME username,c.role_id, d.NAME roleName,a.create_time,a.type,
+                a.STATUS,a.train_practical_result_id, a.train_practical_step_result_id
+            FROM
+                train_task_step_question c
+                LEFT JOIN exam a ON a.id = c.question_id
+                LEFT JOIN userinfo b ON a.create_user_id = b.id
+                LEFT JOIN train_role d ON c.role_id = d.id
+            <if test="stepIdList != null">WHERE c.step_id in
+                <foreach item="id" collection="stepIdList" open="(" separator="," close=")">
+                  #{id}
+                </foreach>
+            </if>
+        ) a where a.id is not null
     </select>
 
 </mapper>