Browse Source

指定人员查询不出来bug修复

yangfeng 1 year ago
parent
commit
e048df9d81

+ 18 - 21
web/src/main/java/com/ynfy/buss/course/course/mapper/xml/CourseMapper.xml

@@ -3,37 +3,34 @@
 <mapper namespace="com.ynfy.buss.course.course.mapper.CourseMapper">
     <select id="selectCourseList" resultType="com.ynfy.buss.course.course.entity.Course">
         SELECT
-        tmp1.*,
-        u.realname AS teacherName,
-        tmp2.learner_number
+            tmp1.*,
+            u.realname AS teacherName,
+            tmp2.learner_number
         FROM
         (
-        SELECT
-        *
-        FROM course
-        WHERE
-        open_type = 1
-        <choose>
-            <when test="user!=null and user.orgCode!=null and user.orgCode!=''">
+            SELECT
+            *
+            FROM course
+            WHERE
+                open_type = 1
+            <if test="user!=null and user.orgCode!=null and user.orgCode!=''">
                 UNION
                 SELECT
-                *
+                    *
                 FROM course
                 WHERE
-                open_type = 2
-                AND learner like concat('%', #{user.orgCode}, '%')
-            </when>
-
-            <when test="user!=null and user.username!=null and user.username!=''">
+                    open_type = 2
+                    AND learner like concat('%', #{user.orgCode}, '%')
+            </if>
+            <if test="user!=null and user.username!=null and user.username!=''">
                 UNION
                 SELECT
-                *
+                    *
                 FROM course
                 WHERE
-                open_type = 3
-                AND learner like concat('%', #{user.username}, '%')
-            </when>
-        </choose>
+                    open_type = 3
+                    AND learner like concat('%', #{user.username}, '%')
+            </if>
         ) tmp1
         LEFT JOIN
         (

+ 5 - 7
web/src/main/java/com/ynfy/buss/exam/exam/mapper/xml/ExamMapper.xml

@@ -95,9 +95,8 @@
         <include refid="stateCondition"/>
         FROM exam
         WHERE
-        open_type = 1
-        <choose>
-            <when test="user!=null and user.orgCode!=null and user.orgCode!=''">
+            open_type = 1
+            <if test="user!=null and user.orgCode!=null and user.orgCode!=''">
                 UNION
                 SELECT
                 *,
@@ -106,8 +105,8 @@
                 WHERE
                 open_type = 2
                 AND examiner like concat('%', #{user.orgCode}, '%')
-            </when>
-            <when test="user!=null and user.username!=null and user.username!=''">
+            </if>
+            <if test="user!=null and user.username!=null and user.username!=''">
                 UNION
                 SELECT
                 *,
@@ -116,8 +115,7 @@
                 WHERE
                 open_type = 3
                 AND examiner like concat('%', #{user.username}, '%')
-            </when>
-        </choose>
+            </if>
         ) tmp1
         <choose>
             <when test="user!=null and user.id!=null and user.id!=''">