去除连表查询逻辑删除字段,需要手动添加

This commit is contained in:
admin 2021-03-16 10:32:27 +08:00
parent 600786c121
commit 29e2c61804
3 changed files with 19 additions and 3 deletions

View File

@ -20,12 +20,11 @@
<dependency> <dependency>
<groupId>com.github.yulichang</groupId> <groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join</artifactId> <artifactId>mybatis-plus-join</artifactId>
<version>1.1.1</version> <version>1.1.2</version>
</dependency> </dependency>
``` ```
或者clone代码到本地,执行mvn install,再引入以上依赖 或者clone代码到本地,执行mvn install,再引入以上依赖
<br> <br>
注:需要mybatis-plus版本号大于等于 3.4.0
<br> <br>
2. 添加配置文件 2. 添加配置文件

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.github.yulichang</groupId> <groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join</artifactId> <artifactId>mybatis-plus-join</artifactId>
<version>1.1.1</version> <version>1.1.2</version>
<name>mybatis-plus-join</name> <name>mybatis-plus-join</name>
<description>An enhanced toolkit of Mybatis-Plus to simplify development.</description> <description>An enhanced toolkit of Mybatis-Plus to simplify development.</description>
<url>https://github.com/yulichang/mybatis-plus-join</url> <url>https://github.com/yulichang/mybatis-plus-join</url>

View File

@ -15,6 +15,23 @@ import java.util.List;
*/ */
public abstract class MPJAbstractMethod extends AbstractMethod { 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 @Override
protected String sqlSelectColumns(TableInfo table, boolean queryWrapper) { protected String sqlSelectColumns(TableInfo table, boolean queryWrapper) {
String selectColumns = ASTERISK; String selectColumns = ASTERISK;