Skip to content

Commit

Permalink
简单代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
sundongkai authored and miemieYaho committed May 11, 2024
1 parent 192d38b commit 407b361
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,9 @@ protected String sqlSet(boolean logic, boolean ew, TableInfo table, boolean judg
sqlScript = SqlScriptUtils.convertIf(sqlScript, String.format("%s != null", alias), true);
}
if (ew) {
sqlScript += NEWLINE;
sqlScript += convertIfEwParam(U_WRAPPER_SQL_SET, false);
sqlScript = sqlScript + NEWLINE + convertIfEwParam(U_WRAPPER_SQL_SET, false);
}
sqlScript = SqlScriptUtils.convertSet(sqlScript);
return sqlScript;
return SqlScriptUtils.convertSet(sqlScript);
}

/**
Expand Down Expand Up @@ -209,16 +207,14 @@ protected String sqlWhereByMap(TableInfo table) {
sqlScript = SqlScriptUtils.convertForeach(sqlScript, COLUMN_MAP, "k", "v", "AND");
sqlScript = SqlScriptUtils.convertIf(sqlScript, String.format("%s != null and !%s.isEmpty", COLUMN_MAP, COLUMN_MAP), true);
sqlScript += (NEWLINE + table.getLogicDeleteSql(true, true));
sqlScript = SqlScriptUtils.convertWhere(sqlScript);
return sqlScript;
return SqlScriptUtils.convertWhere(sqlScript);
} else {
String sqlScript = SqlScriptUtils.convertChoose("v == null", " ${k} IS NULL ",
" ${k} = #{v} ");
sqlScript = SqlScriptUtils.convertForeach(sqlScript, COLUMN_MAP, "k", "v", "AND");
sqlScript = SqlScriptUtils.convertWhere(sqlScript);
sqlScript = SqlScriptUtils.convertIf(sqlScript, String.format("%s != null and !%s", COLUMN_MAP,
COLUMN_MAP_IS_EMPTY), true);
return sqlScript;
return SqlScriptUtils.convertIf(sqlScript, String.format("%s != null and !%s", COLUMN_MAP,
COLUMN_MAP_IS_EMPTY), true);;
}
}

Expand Down

0 comments on commit 407b361

Please sign in to comment.