From 9916e0ec016163d68357cad0d94537c8f9950c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=80=E6=BA=90=E6=B5=B7=E5=93=A5?= Date: Tue, 4 Jul 2023 16:12:57 +0800 Subject: [PATCH] optimize. --- .../core/dialect/impl/CommonsDialectImpl.java | 14 +++++++------- .../core/provider/EntitySqlProvider.java | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/impl/CommonsDialectImpl.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/impl/CommonsDialectImpl.java index 279c75d0..7161c353 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/impl/CommonsDialectImpl.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/impl/CommonsDialectImpl.java @@ -370,7 +370,7 @@ public class CommonsDialectImpl implements IDialect { buildOrderBySql(sqlBuilder, queryWrapper, allTables); List unions = CPI.getUnions(queryWrapper); - if (!CollectionUtil.isEmpty(unions)) { + if (CollectionUtil.isNotEmpty(unions)) { sqlBuilder.insert(0, BRACKET_LEFT).append(BRACKET_RIGHT); for (UnionWrapper unionWrapper : unions) { unionWrapper.buildSql(sqlBuilder, this); @@ -384,7 +384,7 @@ public class CommonsDialectImpl implements IDialect { } List endFragments = CPI.getEndFragments(queryWrapper); - if (!CollectionUtil.isEmpty(endFragments)) { + if (CollectionUtil.isNotEmpty(endFragments)) { for (String endFragment : endFragments) { sqlBuilder.append(BLANK).append(endFragment); } @@ -404,7 +404,7 @@ public class CommonsDialectImpl implements IDialect { buildOrderBySql(sqlBuilder, queryWrapper, Collections.EMPTY_LIST); List unions = CPI.getUnions(queryWrapper); - if (!CollectionUtil.isEmpty(unions)) { + if (CollectionUtil.isNotEmpty(unions)) { if (sqlBuilder.length() > 0) { sqlBuilder.insert(0, BRACKET_LEFT).append(BRACKET_RIGHT); } @@ -420,7 +420,7 @@ public class CommonsDialectImpl implements IDialect { } List endFragments = CPI.getEndFragments(queryWrapper); - if (!CollectionUtil.isEmpty(endFragments)) { + if (CollectionUtil.isNotEmpty(endFragments)) { for (String endFragment : endFragments) { sqlBuilder.append(BLANK).append(endFragment); } @@ -472,7 +472,7 @@ public class CommonsDialectImpl implements IDialect { //buildLimitSql(sqlBuilder, queryWrapper) List endFragments = CPI.getEndFragments(queryWrapper); - if (!CollectionUtil.isEmpty(endFragments)) { + if (CollectionUtil.isNotEmpty(endFragments)) { for (String endFragment : endFragments) { sqlBuilder.append(BLANK).append(endFragment); } @@ -829,7 +829,7 @@ public class CommonsDialectImpl implements IDialect { sql.append(WHERE).append(whereConditionSql); List endFragments = CPI.getEndFragments(queryWrapper); - if (!CollectionUtil.isEmpty(endFragments)) { + if (CollectionUtil.isNotEmpty(endFragments)) { for (String endFragment : endFragments) { sql.append(BLANK).append(endFragment); } @@ -859,7 +859,7 @@ public class CommonsDialectImpl implements IDialect { sql.append(WHERE).append(whereConditionSql); List endFragments = CPI.getEndFragments(queryWrapper); - if (!CollectionUtil.isEmpty(endFragments)) { + if (CollectionUtil.isNotEmpty(endFragments)) { for (String endFragment : endFragments) { sql.append(BLANK).append(endFragment); } diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/provider/EntitySqlProvider.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/provider/EntitySqlProvider.java index 82f43273..a3028d82 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/provider/EntitySqlProvider.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/provider/EntitySqlProvider.java @@ -401,7 +401,7 @@ public class EntitySqlProvider { private static void appendTableConditions(ProviderContext context, QueryWrapper queryWrapper, boolean setSelectColumns) { List tableInfos = getTableInfos(context, queryWrapper); - if (!CollectionUtil.isEmpty(tableInfos)) { + if (CollectionUtil.isNotEmpty(tableInfos)) { for (TableInfo tableInfo : tableInfos) { tableInfo.appendConditions(null, queryWrapper); if (setSelectColumns) { @@ -411,7 +411,7 @@ public class EntitySqlProvider { } } else { List childQueryWrappers = CPI.getChildSelect(queryWrapper); - if (!CollectionUtil.isEmpty(childQueryWrappers)) { + if (CollectionUtil.isNotEmpty(childQueryWrappers)) { for (QueryWrapper childQueryWrapper : childQueryWrappers) { appendTableConditions(context, childQueryWrapper, setSelectColumns); } @@ -423,7 +423,7 @@ public class EntitySqlProvider { private static List getTableInfos(ProviderContext context, QueryWrapper queryWrapper) { List tableInfos; List queryTables = CPI.getQueryTables(queryWrapper); - if (!CollectionUtil.isEmpty(queryTables)) { + if (CollectionUtil.isNotEmpty(queryTables)) { tableInfos = new ArrayList<>(); for (QueryTable queryTable : queryTables) { String tableNameWithSchema = queryTable.getNameWithSchema();