瀏覽代碼

fixed gitee issues/IHCQB

= 7 年之前
父節點
當前提交
436c884175

+ 4 - 2
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/mapper/LogicSqlInjector.java

@@ -253,7 +253,7 @@ public class LogicSqlInjector extends AutoSqlInjector {
         if (table.isLogicDelete()) {
             StringBuilder where = new StringBuilder(128);
             where.append("\n<where>");
-            where.append("\n<if test=\"ew!=null\">");
+            where.append("\n<choose><when test=\"ew!=null\">");
             where.append("\n<if test=\"ew.entity!=null\">");
             if (StringUtils.isNotEmpty(table.getKeyProperty())) {
                 where.append("\n<if test=\"ew.entity.").append(table.getKeyProperty()).append("!=null\">");
@@ -271,7 +271,9 @@ public class LogicSqlInjector extends AutoSqlInjector {
             where.append("\n</if>");
             where.append("\n").append(getLogicDeleteSql(table));
             where.append("\n<if test=\"ew.sqlSegment!=null\">${ew.sqlSegment}\n</if>");
-            where.append("\n</if>");
+            where.append("\n</when><otherwise>");
+            where.append("\n").append(getLogicDeleteSql(table));
+            where.append("\n</otherwise></choose>");
             where.append("\n</where>");
             return where.toString();
         }