From f311718993dc0bcd193e03915076060815ee0036 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期三, 01 十一月 2023 19:01:50 +0800
Subject: [PATCH] #

---
 src/main/resources/mapper/OrderMapper.xml |    7 ++++++-
 src/main/resources/mapper/PlanMapper.xml  |    4 ++--
 src/main/resources/mapper/CstmrMapper.xml |   42 +++++++++++++++++++++++++++++++++++++-----
 3 files changed, 45 insertions(+), 8 deletions(-)

diff --git a/src/main/resources/mapper/CstmrMapper.xml b/src/main/resources/mapper/CstmrMapper.xml
index 2d22e4c..75c8584 100644
--- a/src/main/resources/mapper/CstmrMapper.xml
+++ b/src/main/resources/mapper/CstmrMapper.xml
@@ -103,7 +103,12 @@
             <otherwise>
                 and
                 (
-                    user_id = #{userId}
+                    <if test="userId != null and userId != ''">
+                        user_id = #{userId}
+                    </if>
+                    <if test="userId == null or userId == ''">
+                        user_id is not null
+                    </if>
                     or
                     mc.id in
                     (
@@ -164,7 +169,12 @@
             <otherwise>
                 and
                 (
-                user_id = #{userId}
+                <if test="userId != null and userId != ''">
+                    user_id = #{userId}
+                </if>
+                <if test="userId == null or userId == ''">
+                    user_id is not null
+                </if>
                 or
                 director = #{userId}
                 or
@@ -262,6 +272,13 @@
             <otherwise>
                 and
                 (
+                <if test="userId != null and userId != ''">
+                    user_id = #{userId}
+                </if>
+                <if test="userId == null or userId == ''">
+                    user_id is not null
+                </if>
+                or
                 director = #{userId}
                 or
                 mc.id in
@@ -427,7 +444,12 @@
             <otherwise>
                 and
                 (
-                user_id = #{userId}
+                <if test="userId != null and userId != ''">
+                    user_id = #{userId}
+                </if>
+                <if test="userId == null or userId == ''">
+                    user_id is not null
+                </if>
                 or
                 director = #{userId}
                 or
@@ -533,7 +555,12 @@
             <otherwise>
                 and
                 (
-                user_id = #{userId}
+                <if test="userId != null and userId != ''">
+                    user_id = #{userId}
+                </if>
+                <if test="userId == null or userId == ''">
+                    user_id is not null
+                </if>
                 or
                 director = #{userId}
                 or
@@ -637,7 +664,12 @@
             <otherwise>
                 and
                 (
-                user_id = #{userId}
+                <if test="userId != null and userId != ''">
+                    user_id = #{userId}
+                </if>
+                <if test="userId == null or userId == ''">
+                    user_id is not null
+                </if>
                 or
                 mc.id in
                 (
diff --git a/src/main/resources/mapper/OrderMapper.xml b/src/main/resources/mapper/OrderMapper.xml
index 718d54e..0c5d82f 100644
--- a/src/main/resources/mapper/OrderMapper.xml
+++ b/src/main/resources/mapper/OrderMapper.xml
@@ -77,7 +77,12 @@
             <otherwise>
                 and
                 (
-                    user_id = #{userId}
+                    <if test="userId != null and userId != ''">
+                        user_id = #{userId}
+                    </if>
+                    <if test="userId == null or userId == ''">
+                        user_id is not null
+                    </if>
                     or
                     mo.id in
                     (
diff --git a/src/main/resources/mapper/PlanMapper.xml b/src/main/resources/mapper/PlanMapper.xml
index baf9f84..cfb30cd 100644
--- a/src/main/resources/mapper/PlanMapper.xml
+++ b/src/main/resources/mapper/PlanMapper.xml
@@ -83,10 +83,10 @@
             <otherwise>
                 and
                 (
-                    <if test="condition != null and condition != ''">
+                    <if test="userId != null and userId != ''">
                         user_id = #{userId}
                     </if>
-                    <if test="condition == null or condition == ''">
+                    <if test="userId == null or userId == ''">
                         user_id is not null
                     </if>
                     or

--
Gitblit v1.9.1