Update Insetable page

This commit is contained in:
sunkaixuan
2023-08-24 13:57:06 +08:00
parent b641e30d07
commit 0386d4fe4b
2 changed files with 18 additions and 1 deletions

View File

@@ -18,6 +18,10 @@ namespace SqlSugar
public int ExecuteCommand() public int ExecuteCommand()
{ {
if (DataList.Count() == 1 && DataList.First() == null)
{
return 0;
}
if (PageSize == 0) { PageSize = 1000; } if (PageSize == 0) { PageSize = 1000; }
var result = 0; var result = 0;
this.Context.Utilities.PageEach(DataList, PageSize, pageItem => this.Context.Utilities.PageEach(DataList, PageSize, pageItem =>
@@ -28,6 +32,10 @@ namespace SqlSugar
} }
public async Task<int> ExecuteCommandAsync() public async Task<int> ExecuteCommandAsync()
{ {
if (DataList.Count() == 1 && DataList.First() == null)
{
return 0;
}
if (PageSize == 0) { PageSize = 1000; } if (PageSize == 0) { PageSize = 1000; }
var result = 0; var result = 0;
await this.Context.Utilities.PageEachAsync(DataList, PageSize,async pageItem => await this.Context.Utilities.PageEachAsync(DataList, PageSize,async pageItem =>
@@ -39,6 +47,10 @@ namespace SqlSugar
public List<long> ExecuteReturnSnowflakeIdList() public List<long> ExecuteReturnSnowflakeIdList()
{ {
if (DataList.Count() == 1 && DataList.First() == null)
{
return new List<long>();
}
if (PageSize == 0) { PageSize = 1000; } if (PageSize == 0) { PageSize = 1000; }
var result = new List<long>(); var result = new List<long>();
this.Context.Utilities.PageEach(DataList, PageSize, pageItem => this.Context.Utilities.PageEach(DataList, PageSize, pageItem =>
@@ -49,6 +61,10 @@ namespace SqlSugar
} }
public async Task<List<long>> ExecuteReturnSnowflakeIdListAsync() public async Task<List<long>> ExecuteReturnSnowflakeIdListAsync()
{ {
if (DataList.Count() == 1 && DataList.First() == null)
{
return new List<long>();
}
if (PageSize == 0) { PageSize = 1000; } if (PageSize == 0) { PageSize = 1000; }
var result = new List<long>(); var result = new List<long>();
await this.Context.Utilities.PageEachAsync(DataList, PageSize,async pageItem => await this.Context.Utilities.PageEachAsync(DataList, PageSize,async pageItem =>

View File

@@ -474,6 +474,7 @@ namespace SqlSugar
result.TableName = this.InsertBuilder.AsName; result.TableName = this.InsertBuilder.AsName;
result.IsEnableDiffLogEvent = this.IsEnableDiffLogEvent; result.IsEnableDiffLogEvent = this.IsEnableDiffLogEvent;
result.DiffModel = this.diffModel; result.DiffModel = this.diffModel;
if(this.InsertBuilder.DbColumnInfoList.Any())
result.InsertColumns = this.InsertBuilder.DbColumnInfoList.GroupBy(it => it.TableId).First().Select(it=>it.DbColumnName).ToList(); result.InsertColumns = this.InsertBuilder.DbColumnInfoList.GroupBy(it => it.TableId).First().Select(it=>it.DbColumnName).ToList();
return result; return result;
} }