Synchronization Code

This commit is contained in:
sunkaixuan 2024-02-07 00:34:43 +08:00
parent b7b1d3e430
commit 3314bab8b5
2 changed files with 6 additions and 0 deletions

View File

@ -15,6 +15,8 @@ namespace SqlSugar
public T[] UpdateObjects { get; set; }
public IEnumerable<SplitTableInfo> Tables { get; set; }
internal List<string> WhereColumns { get; set; }
public int ExecuteCommandWithOptLock(bool isThrowError = false)
{
List<GroupModel> groupModels;
@ -24,6 +26,7 @@ namespace SqlSugar
{
var addList = item.Select(it => it.Item).ToList();
result += this.Context.Updateable(addList)
.WhereColumns(this.WhereColumns?.ToArray())
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandWithOptLock(isThrowError);
@ -39,6 +42,7 @@ namespace SqlSugar
{
var addList = item.Select(it => it.Item).ToList();
result += this.Context.Updateable(addList)
.WhereColumns(this.WhereColumns?.ToArray())
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity,this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommand();

View File

@ -290,6 +290,8 @@ namespace SqlSugar
SplitTableUpdateByObjectProvider<T> result = new SplitTableUpdateByObjectProvider<T>();
result.Context = this.Context;
result.UpdateObjects = this.UpdateObjs;
if(this.IsWhereColumns)
result.WhereColumns = this.WhereColumnList;
SplitTableContext helper = new SplitTableContext(Context)
{
EntityInfo = this.EntityInfo