Update ToPageListAsync(+1)

This commit is contained in:
sunkaixuan 2022-05-13 15:39:36 +08:00
parent 3d389abdef
commit 4f12f96c2b
2 changed files with 10 additions and 3 deletions

View File

@ -265,6 +265,13 @@ namespace OrmTest
//}).ExecuteCommand(); //}).ExecuteCommand();
var d1111111111111 = db.Queryable<SqlSugarDemo.UserEntity>() var d1111111111111 = db.Queryable<SqlSugarDemo.UserEntity>()
.Mapper<SqlSugarDemo.UserEntity, SqlSugarDemo.RoleEntity, SqlSugarDemo.UserRoleEntity>(it => ManyToMany.Config(it.UserId, it.RoleId)).InSingle(data.UserId); .Mapper<SqlSugarDemo.UserEntity, SqlSugarDemo.RoleEntity, SqlSugarDemo.UserRoleEntity>(it => ManyToMany.Config(it.UserId, it.RoleId)).InSingle(data.UserId);
RefAsync<int> x11 = 0;
RefAsync<int> y1 = 0;
db.Queryable<Order>().ToPageListAsync(1, 2, x11, y1).GetAwaiter().GetResult();
if (x11.Value > 0 && y1.Value == 0)
{
throw new Exception("unit test error");
}
} }

View File

@ -2122,10 +2122,10 @@ namespace SqlSugar
this.Context.MappingTables = oldMapping; this.Context.MappingTables = oldMapping;
return await this.Clone().ToPageListAsync(pageIndex, pageSize); return await this.Clone().ToPageListAsync(pageIndex, pageSize);
} }
public Task<List<T>> ToPageListAsync(int pageNumber, int pageSize, RefAsync<int> totalNumber, RefAsync<int> totalPage) public async Task<List<T>> ToPageListAsync(int pageNumber, int pageSize, RefAsync<int> totalNumber, RefAsync<int> totalPage)
{ {
var result = ToPageListAsync(pageNumber, pageSize, totalNumber); var result =await ToPageListAsync(pageNumber, pageSize, totalNumber);
totalPage.Value = (totalNumber + pageSize - 1) / pageSize; totalPage.Value = (totalNumber.Value + pageSize - 1) / pageSize;
return result; return result;
} }
public async Task<string> ToJsonAsync() public async Task<string> ToJsonAsync()