he2802 2 vuotta sitten
vanhempi
commit
c20122e69c

+ 11 - 6
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml

@@ -1191,6 +1191,9 @@
             and u.user_id = #{userId}
             ) as realname,
         </if>
+        <if test="userId != null and userId !='' ">
+            #{userId} as user_id,
+        </if>
         (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
         null as class_hours,
         4 as type,
@@ -1248,12 +1251,14 @@
         ccs.sort,
         cs.section_id AS id,
         #{courseId} AS course_id,
-        ( SELECT u.realname FROM `user` u WHERE 1 = 1 <if test="userId != null and userId !='' ">
-        and u.user_id = #{userId}
-    </if>  ) AS realname,
-        ( SELECT u.user_id FROM `user` u WHERE 1 = 1 <if test="userId != null and userId !='' ">
-        and u.user_id = #{userId}
-    </if>  ) AS user_id,
+        <if test="userId != null and userId !='' ">
+            (SELECT u.realname FROM `user` u where 1=1
+            and u.user_id = #{userId}
+            ) as realname,
+        </if>
+        <if test="userId != null and userId !='' ">
+            #{userId} as user_id,
+        </if>
         cs.NAME AS type_name,
         cs.duration_time,
         cs.section_type,