From 09ecb532b694e2d1033f8efc56e6964f452e2e4f Mon Sep 17 00:00:00 2001 From: yulichang <570810310@qq.com> Date: Wed, 4 Jan 2023 13:26:56 +0800 Subject: [PATCH] fix --- .../main/java/com/github/yulichang/method/MPJBaseMethod.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/MPJBaseMethod.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/MPJBaseMethod.java index 3ac093c..e99d4f8 100644 --- a/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/MPJBaseMethod.java +++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/method/MPJBaseMethod.java @@ -42,7 +42,8 @@ public interface MPJBaseMethod extends Constants { if (ConfigProperties.subTableLogic) { sqlScript += (String.format("${%s.subLogicSql}", WRAPPER) + NEWLINE); } - sqlScript += SqlScriptUtils.convertIf(String.format("AND ${%s}", WRAPPER_SQLSEGMENT), String.format("%s != null and %s != '' and %s", WRAPPER_SQLSEGMENT, WRAPPER_SQLSEGMENT, WRAPPER_NONEMPTYOFWHERE), true); + String s = SqlScriptUtils.convertIf("AND", WRAPPER_NONEMPTYOFNORMAL, true); + sqlScript += SqlScriptUtils.convertIf(s+String.format(" ${%s}", WRAPPER_SQLSEGMENT), String.format("%s != null and %s != '' and %s", WRAPPER_SQLSEGMENT, WRAPPER_SQLSEGMENT, WRAPPER_NONEMPTYOFWHERE), true); sqlScript = SqlScriptUtils.convertWhere(sqlScript) + NEWLINE; sqlScript += SqlScriptUtils.convertIf(String.format(" ${%s}", WRAPPER_SQLSEGMENT), String.format("%s != null and %s != '' and %s", WRAPPER_SQLSEGMENT, WRAPPER_SQLSEGMENT, WRAPPER_EMPTYOFWHERE), true); sqlScript = SqlScriptUtils.convertIf(sqlScript, String.format("%s != null", WRAPPER), true);