optimize.

This commit is contained in:
开源海哥 2023-07-04 16:12:57 +08:00
parent 1d12db2ed6
commit 9916e0ec01
2 changed files with 10 additions and 10 deletions

View File

@ -370,7 +370,7 @@ public class CommonsDialectImpl implements IDialect {
buildOrderBySql(sqlBuilder, queryWrapper, allTables); buildOrderBySql(sqlBuilder, queryWrapper, allTables);
List<UnionWrapper> unions = CPI.getUnions(queryWrapper); List<UnionWrapper> unions = CPI.getUnions(queryWrapper);
if (!CollectionUtil.isEmpty(unions)) { if (CollectionUtil.isNotEmpty(unions)) {
sqlBuilder.insert(0, BRACKET_LEFT).append(BRACKET_RIGHT); sqlBuilder.insert(0, BRACKET_LEFT).append(BRACKET_RIGHT);
for (UnionWrapper unionWrapper : unions) { for (UnionWrapper unionWrapper : unions) {
unionWrapper.buildSql(sqlBuilder, this); unionWrapper.buildSql(sqlBuilder, this);
@ -384,7 +384,7 @@ public class CommonsDialectImpl implements IDialect {
} }
List<String> endFragments = CPI.getEndFragments(queryWrapper); List<String> endFragments = CPI.getEndFragments(queryWrapper);
if (!CollectionUtil.isEmpty(endFragments)) { if (CollectionUtil.isNotEmpty(endFragments)) {
for (String endFragment : endFragments) { for (String endFragment : endFragments) {
sqlBuilder.append(BLANK).append(endFragment); sqlBuilder.append(BLANK).append(endFragment);
} }
@ -404,7 +404,7 @@ public class CommonsDialectImpl implements IDialect {
buildOrderBySql(sqlBuilder, queryWrapper, Collections.EMPTY_LIST); buildOrderBySql(sqlBuilder, queryWrapper, Collections.EMPTY_LIST);
List<UnionWrapper> unions = CPI.getUnions(queryWrapper); List<UnionWrapper> unions = CPI.getUnions(queryWrapper);
if (!CollectionUtil.isEmpty(unions)) { if (CollectionUtil.isNotEmpty(unions)) {
if (sqlBuilder.length() > 0) { if (sqlBuilder.length() > 0) {
sqlBuilder.insert(0, BRACKET_LEFT).append(BRACKET_RIGHT); sqlBuilder.insert(0, BRACKET_LEFT).append(BRACKET_RIGHT);
} }
@ -420,7 +420,7 @@ public class CommonsDialectImpl implements IDialect {
} }
List<String> endFragments = CPI.getEndFragments(queryWrapper); List<String> endFragments = CPI.getEndFragments(queryWrapper);
if (!CollectionUtil.isEmpty(endFragments)) { if (CollectionUtil.isNotEmpty(endFragments)) {
for (String endFragment : endFragments) { for (String endFragment : endFragments) {
sqlBuilder.append(BLANK).append(endFragment); sqlBuilder.append(BLANK).append(endFragment);
} }
@ -472,7 +472,7 @@ public class CommonsDialectImpl implements IDialect {
//buildLimitSql(sqlBuilder, queryWrapper) //buildLimitSql(sqlBuilder, queryWrapper)
List<String> endFragments = CPI.getEndFragments(queryWrapper); List<String> endFragments = CPI.getEndFragments(queryWrapper);
if (!CollectionUtil.isEmpty(endFragments)) { if (CollectionUtil.isNotEmpty(endFragments)) {
for (String endFragment : endFragments) { for (String endFragment : endFragments) {
sqlBuilder.append(BLANK).append(endFragment); sqlBuilder.append(BLANK).append(endFragment);
} }
@ -829,7 +829,7 @@ public class CommonsDialectImpl implements IDialect {
sql.append(WHERE).append(whereConditionSql); sql.append(WHERE).append(whereConditionSql);
List<String> endFragments = CPI.getEndFragments(queryWrapper); List<String> endFragments = CPI.getEndFragments(queryWrapper);
if (!CollectionUtil.isEmpty(endFragments)) { if (CollectionUtil.isNotEmpty(endFragments)) {
for (String endFragment : endFragments) { for (String endFragment : endFragments) {
sql.append(BLANK).append(endFragment); sql.append(BLANK).append(endFragment);
} }
@ -859,7 +859,7 @@ public class CommonsDialectImpl implements IDialect {
sql.append(WHERE).append(whereConditionSql); sql.append(WHERE).append(whereConditionSql);
List<String> endFragments = CPI.getEndFragments(queryWrapper); List<String> endFragments = CPI.getEndFragments(queryWrapper);
if (!CollectionUtil.isEmpty(endFragments)) { if (CollectionUtil.isNotEmpty(endFragments)) {
for (String endFragment : endFragments) { for (String endFragment : endFragments) {
sql.append(BLANK).append(endFragment); sql.append(BLANK).append(endFragment);
} }

View File

@ -401,7 +401,7 @@ public class EntitySqlProvider {
private static void appendTableConditions(ProviderContext context, QueryWrapper queryWrapper, boolean setSelectColumns) { private static void appendTableConditions(ProviderContext context, QueryWrapper queryWrapper, boolean setSelectColumns) {
List<TableInfo> tableInfos = getTableInfos(context, queryWrapper); List<TableInfo> tableInfos = getTableInfos(context, queryWrapper);
if (!CollectionUtil.isEmpty(tableInfos)) { if (CollectionUtil.isNotEmpty(tableInfos)) {
for (TableInfo tableInfo : tableInfos) { for (TableInfo tableInfo : tableInfos) {
tableInfo.appendConditions(null, queryWrapper); tableInfo.appendConditions(null, queryWrapper);
if (setSelectColumns) { if (setSelectColumns) {
@ -411,7 +411,7 @@ public class EntitySqlProvider {
} }
} else { } else {
List<QueryWrapper> childQueryWrappers = CPI.getChildSelect(queryWrapper); List<QueryWrapper> childQueryWrappers = CPI.getChildSelect(queryWrapper);
if (!CollectionUtil.isEmpty(childQueryWrappers)) { if (CollectionUtil.isNotEmpty(childQueryWrappers)) {
for (QueryWrapper childQueryWrapper : childQueryWrappers) { for (QueryWrapper childQueryWrapper : childQueryWrappers) {
appendTableConditions(context, childQueryWrapper, setSelectColumns); appendTableConditions(context, childQueryWrapper, setSelectColumns);
} }
@ -423,7 +423,7 @@ public class EntitySqlProvider {
private static List<TableInfo> getTableInfos(ProviderContext context, QueryWrapper queryWrapper) { private static List<TableInfo> getTableInfos(ProviderContext context, QueryWrapper queryWrapper) {
List<TableInfo> tableInfos; List<TableInfo> tableInfos;
List<QueryTable> queryTables = CPI.getQueryTables(queryWrapper); List<QueryTable> queryTables = CPI.getQueryTables(queryWrapper);
if (!CollectionUtil.isEmpty(queryTables)) { if (CollectionUtil.isNotEmpty(queryTables)) {
tableInfos = new ArrayList<>(); tableInfos = new ArrayList<>();
for (QueryTable queryTable : queryTables) { for (QueryTable queryTable : queryTables) {
String tableNameWithSchema = queryTable.getNameWithSchema(); String tableNameWithSchema = queryTable.getNameWithSchema();