mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-31 15:56:25 +08:00
Synchronization code
This commit is contained in:
parent
32a2baaa75
commit
7c2447ce26
@ -15,6 +15,7 @@ namespace SqlSugar
|
||||
public bool IsEnableDiffLogEvent { get; internal set; }
|
||||
public DiffLogModel DiffModel { get; internal set; }
|
||||
public List<string> UpdateColumns { get; internal set; }
|
||||
public string[] WhereColumnList { get; internal set; }
|
||||
|
||||
public UpdateableFilter<T> EnableQueryFilter()
|
||||
{
|
||||
@ -46,7 +47,7 @@ namespace SqlSugar
|
||||
}
|
||||
this.Context.Utilities.PageEach(DataList, PageSize, pageItem =>
|
||||
{
|
||||
result += this.Context.Updateable(pageItem).AS(TableName).EnableDiffLogEventIF(IsEnableDiffLogEvent, DiffModel).UpdateColumns(UpdateColumns.ToArray()).ExecuteCommand();
|
||||
result += this.Context.Updateable(pageItem).AS(TableName).WhereColumns(WhereColumnList).EnableDiffLogEventIF(IsEnableDiffLogEvent, DiffModel).UpdateColumns(UpdateColumns.ToArray()).ExecuteCommand();
|
||||
});
|
||||
if (isNoTran)
|
||||
{
|
||||
@ -80,7 +81,7 @@ namespace SqlSugar
|
||||
}
|
||||
await this.Context.Utilities.PageEachAsync(DataList, PageSize, async pageItem =>
|
||||
{
|
||||
result += await this.Context.Updateable(pageItem).AS(TableName).EnableDiffLogEventIF(IsEnableDiffLogEvent, DiffModel).UpdateColumns(UpdateColumns.ToArray()).ExecuteCommandAsync();
|
||||
result += await this.Context.Updateable(pageItem).AS(TableName).WhereColumns(WhereColumnList).EnableDiffLogEventIF(IsEnableDiffLogEvent, DiffModel).UpdateColumns(UpdateColumns.ToArray()).ExecuteCommandAsync();
|
||||
});
|
||||
if (isNoTran)
|
||||
{
|
||||
|
@ -190,6 +190,7 @@ namespace SqlSugar
|
||||
result.DataList = this.UpdateObjs;
|
||||
result.TableName = this.UpdateBuilder.TableName;
|
||||
result.IsEnableDiffLogEvent = this.IsEnableDiffLogEvent;
|
||||
result.WhereColumnList = this.WhereColumnList?.ToArray();
|
||||
result.DiffModel = this.diffModel;
|
||||
if (this.UpdateBuilder.DbColumnInfoList.Any())
|
||||
result.UpdateColumns = this.UpdateBuilder.DbColumnInfoList.GroupBy(it => it.TableId).First().Select(it => it.DbColumnName).ToList();
|
||||
@ -530,6 +531,8 @@ namespace SqlSugar
|
||||
|
||||
public IUpdateable<T> WhereColumns(string[] columnNames)
|
||||
{
|
||||
if (columnNames == null) return this;
|
||||
|
||||
ThrowUpdateByExpression();
|
||||
if (this.WhereColumnList == null) this.WhereColumnList = new List<string>();
|
||||
foreach (var columnName in columnNames)
|
||||
|
Loading…
Reference in New Issue
Block a user