소스 검색

fixed gitee issues/IHCQB

= 7 년 전
부모
커밋
436c884175
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/mapper/LogicSqlInjector.java

+ 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()) {
         if (table.isLogicDelete()) {
             StringBuilder where = new StringBuilder(128);
             StringBuilder where = new StringBuilder(128);
             where.append("\n<where>");
             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\">");
             where.append("\n<if test=\"ew.entity!=null\">");
             if (StringUtils.isNotEmpty(table.getKeyProperty())) {
             if (StringUtils.isNotEmpty(table.getKeyProperty())) {
                 where.append("\n<if test=\"ew.entity.").append(table.getKeyProperty()).append("!=null\">");
                 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</if>");
             where.append("\n").append(getLogicDeleteSql(table));
             where.append("\n").append(getLogicDeleteSql(table));
             where.append("\n<if test=\"ew.sqlSegment!=null\">${ew.sqlSegment}\n</if>");
             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>");
             where.append("\n</where>");
             return where.toString();
             return where.toString();
         }
         }