he2802 2 年之前
父節點
當前提交
50ac46277f
共有 1 個文件被更改,包括 9 次插入6 次删除
  1. 9 6
      zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml

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

@@ -1253,12 +1253,15 @@
         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,