Update split table

This commit is contained in:
sunkaixuan
2024-02-06 23:14:46 +08:00
parent 5f8a34e229
commit 76bb603705
2 changed files with 5 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,7 @@ namespace SqlSugar
SplitTableUpdateByObjectProvider<T> result = new SplitTableUpdateByObjectProvider<T>();
result.Context = this.Context;
result.UpdateObjects = this.UpdateObjs;
result.WhereColumns = this.WhereColumnList;
SplitTableContext helper = new SplitTableContext(Context)
{
EntityInfo = this.EntityInfo