Skip to content

Commit

Permalink
opt
Browse files Browse the repository at this point in the history
  • Loading branch information
funky-eyes committed Feb 7, 2023
1 parent 34f3ee6 commit 4ea0066
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,23 @@ private String buildAfterImageSQL(TableMeta tableMeta, TableRecords beforeImage)
return selectSQLJoiner.toString();
}

protected List<String> getNeedUpdateColumns(String table, String tableAlias, List<String> originUpdateColumns) {
protected List<String> getNeedUpdateColumns(String table, String tableAlias, List<String> unescapeUpdateColumns) {
List<String> needUpdateColumns = new ArrayList<>();
TableMeta tableMeta = getTableMeta(table);
if (ONLY_CARE_UPDATE_COLUMNS) {
if (!containsPK(table, originUpdateColumns)) {
if (!containsPK(table, unescapeUpdateColumns)) {
List<String> pkNameList = tableMeta.getEscapePkNameList(getDbType());
if (CollectionUtils.isNotEmpty(pkNameList)) {
needUpdateColumns.add(getColumnNamesWithTablePrefix(table,tableAlias,pkNameList));
}
}
needUpdateColumns.addAll(originUpdateColumns.parallelStream()
needUpdateColumns.addAll(unescapeUpdateColumns.parallelStream()
.map(originUpdateColumn -> ColumnUtils.addEscape(originUpdateColumn, getDbType()))
.collect(Collectors.toList()));

// The on update xxx columns will be auto update by db, so it's also the actually updated columns
List<String> onUpdateColumns = tableMeta.getOnUpdateColumnsOnlyName();
onUpdateColumns.removeAll(originUpdateColumns);
onUpdateColumns.removeAll(unescapeUpdateColumns);
needUpdateColumns.addAll(onUpdateColumns.parallelStream()
.map(onUpdateColumn -> ColumnUtils.addEscape(onUpdateColumn, getDbType()))
.collect(Collectors.toList()));
Expand Down

0 comments on commit 4ea0066

Please sign in to comment.