From 29e2c618047dd655710c2972f9119f37479eb7ef Mon Sep 17 00:00:00 2001 From: admin <570810310@qq.com> Date: Tue, 16 Mar 2021 10:32:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E8=BF=9E=E8=A1=A8=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E9=80=BB=E8=BE=91=E5=88=A0=E9=99=A4=E5=AD=97=E6=AE=B5?= =?UTF-8?q?,=E9=9C=80=E8=A6=81=E6=89=8B=E5=8A=A8=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +-- pom.xml | 2 +- .../yulichang/method/MPJAbstractMethod.java | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f3c707f..20550b5 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,11 @@ com.github.yulichang mybatis-plus-join - 1.1.1 + 1.1.2 ``` 或者clone代码到本地,执行mvn install,再引入以上依赖
- 注:需要mybatis-plus版本号大于等于 3.4.0
2. 添加配置文件 diff --git a/pom.xml b/pom.xml index e9c40fa..ca82329 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.github.yulichang mybatis-plus-join - 1.1.1 + 1.1.2 mybatis-plus-join An enhanced toolkit of Mybatis-Plus to simplify development. https://github.com/yulichang/mybatis-plus-join diff --git a/src/main/java/com/github/yulichang/method/MPJAbstractMethod.java b/src/main/java/com/github/yulichang/method/MPJAbstractMethod.java index 72a8171..a9718ef 100644 --- a/src/main/java/com/github/yulichang/method/MPJAbstractMethod.java +++ b/src/main/java/com/github/yulichang/method/MPJAbstractMethod.java @@ -15,6 +15,23 @@ import java.util.List; */ public abstract class MPJAbstractMethod extends AbstractMethod { + /** + * 连表操作不考虑entity查询和逻辑删除 + */ + @Override + protected String sqlWhereEntityWrapper(boolean newLine, TableInfo table) { + String sqlScript = EMPTY; + sqlScript += SqlScriptUtils.convertIf(String.format(SqlScriptUtils.convertIf(" AND", String.format("%s and %s", WRAPPER_NONEMPTYOFENTITY, WRAPPER_NONEMPTYOFNORMAL), false) + " ${%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); + return newLine ? NEWLINE + sqlScript : sqlScript; + } + @Override protected String sqlSelectColumns(TableInfo table, boolean queryWrapper) { String selectColumns = ASTERISK;