mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
Update split table
This commit is contained in:
@@ -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();
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user