- 补充 fsql.InsertOrUpdate UpdateColumns 数据存在时只更新指定的字段;

This commit is contained in:
28810
2020-07-29 15:32:14 +08:00
parent a8d1db8614
commit 06b301395f
19 changed files with 89 additions and 26 deletions

View File

@ -43,8 +43,9 @@ namespace FreeSql.Odbc.KingbaseES
else
{
var ocdu = new OdbcKingbaseESOnConflictDoUpdate<T1>(insert.InsertIdentity());
ocdu.IgnoreColumns(_table.Columns.Values.Where(a => a.Attribute.CanUpdate == false).Select(a => a.Attribute.Name).ToArray());
if (_doNothing == true || _table.Columns.Values.Where(a => a.Attribute.IsPrimary == false && a.Attribute.CanUpdate == true).Any() == false)
var cols = _table.Columns.Values.Where(a => a.Attribute.IsPrimary == false && a.Attribute.CanUpdate == true && _updateIgnore.ContainsKey(a.Attribute.Name) == false);
ocdu.UpdateColumns(cols.Select(a => a.Attribute.Name).ToArray());
if (_doNothing == true || cols.Any() == false)
ocdu.DoNothing();
sql = ocdu.ToSql();
}