Browse Source

添加常量

Caratacus 6 years ago
parent
commit
0d255bd801

+ 1 - 1
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/injector/AbstractMethod.java

@@ -190,7 +190,7 @@ public abstract class AbstractMethod implements Constants {
         String sqlScript = table.getAllSqlWhere(false, true, WRAPPER_ENTITY_DOT);
         sqlScript = SqlScriptUtils.convertIf(sqlScript, String.format("%s != null", WRAPPER_ENTITY), true);
         sqlScript += NEWLINE;
-        sqlScript += SqlScriptUtils.convertIf(String.format(SqlScriptUtils.convertIf(" AND", "ew.nonEmptyOfEntity and ew.nonEmptyOfNormal", false) + " ${%s}", WRAPPER_SQLSEGMENT),
+        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;

+ 4 - 0
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/Constants.java

@@ -62,6 +62,10 @@ public interface Constants extends StringPool {
      * wrapper 类的属性 nonEmptyOfNormal
      */
     String WRAPPER_NONEMPTYOFNORMAL = WRAPPER_DOT + "nonEmptyOfNormal";
+    /**
+     * wrapper 类的属性 nonEmptyOfEntity
+     */
+    String WRAPPER_NONEMPTYOFENTITY = WRAPPER_DOT + "nonEmptyOfEntity";
     /**
      * wrapper 类的属性 emptyOfWhere
      */