mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-02-27 16:50:33 +08:00
Update split table
This commit is contained in:
@@ -15,6 +15,8 @@ namespace SqlSugar
|
|||||||
public T[] UpdateObjects { get; set; }
|
public T[] UpdateObjects { get; set; }
|
||||||
|
|
||||||
public IEnumerable<SplitTableInfo> Tables { get; set; }
|
public IEnumerable<SplitTableInfo> Tables { get; set; }
|
||||||
|
internal List<string> WhereColumns { get; set; }
|
||||||
|
|
||||||
public int ExecuteCommandWithOptLock(bool isThrowError = false)
|
public int ExecuteCommandWithOptLock(bool isThrowError = false)
|
||||||
{
|
{
|
||||||
List<GroupModel> groupModels;
|
List<GroupModel> groupModels;
|
||||||
@@ -24,6 +26,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
var addList = item.Select(it => it.Item).ToList();
|
var addList = item.Select(it => it.Item).ToList();
|
||||||
result += this.Context.Updateable(addList)
|
result += this.Context.Updateable(addList)
|
||||||
|
.WhereColumns(this.WhereColumns?.ToArray())
|
||||||
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
|
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
|
||||||
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
|
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
|
||||||
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandWithOptLock(isThrowError);
|
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandWithOptLock(isThrowError);
|
||||||
@@ -39,6 +42,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
var addList = item.Select(it => it.Item).ToList();
|
var addList = item.Select(it => it.Item).ToList();
|
||||||
result += this.Context.Updateable(addList)
|
result += this.Context.Updateable(addList)
|
||||||
|
.WhereColumns(this.WhereColumns?.ToArray())
|
||||||
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
|
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
|
||||||
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity,this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
|
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity,this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
|
||||||
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommand();
|
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommand();
|
||||||
|
|||||||
@@ -290,6 +290,7 @@ namespace SqlSugar
|
|||||||
SplitTableUpdateByObjectProvider<T> result = new SplitTableUpdateByObjectProvider<T>();
|
SplitTableUpdateByObjectProvider<T> result = new SplitTableUpdateByObjectProvider<T>();
|
||||||
result.Context = this.Context;
|
result.Context = this.Context;
|
||||||
result.UpdateObjects = this.UpdateObjs;
|
result.UpdateObjects = this.UpdateObjs;
|
||||||
|
result.WhereColumns = this.WhereColumnList;
|
||||||
SplitTableContext helper = new SplitTableContext(Context)
|
SplitTableContext helper = new SplitTableContext(Context)
|
||||||
{
|
{
|
||||||
EntityInfo = this.EntityInfo
|
EntityInfo = this.EntityInfo
|
||||||
|
|||||||
Reference in New Issue
Block a user