update 删除所有Xn前缀, 规范了所有分页参数和返回值

This commit is contained in:
2021-05-27 21:07:30 +08:00
parent f612f7e4e9
commit c023f86f6e
34 changed files with 146 additions and 205 deletions

View File

@@ -43,12 +43,12 @@ namespace Ewide.Core.Extension
public static Task<PagedList<T>> ToPageData<T>(this IQueryable<T> source, PageInputBase input) where T : new()
{
return source.OrderBy(OrderBuilder<T>(input)).ToPagedListAsync(input.PageNo, input.PageSize);
return source.OrderBy(OrderBuilder<T>(input)).ToPagedListAsync(input.PageIndex, input.PageSize);
}
public static Task<PagedList<O>> ToPageData<T, O>(this IQueryable<T> source, PageInputBase input) where O : new()
{
return source.OrderBy(OrderBuilder<T>(input)).Select(u => u.Adapt<O>()).ToPagedListAsync(input.PageNo, input.PageSize);
return source.OrderBy(OrderBuilder<T>(input)).Select(u => u.Adapt<O>()).ToPagedListAsync(input.PageIndex, input.PageSize);
}
#region DAPPER
@@ -72,7 +72,7 @@ namespace Ewide.Core.Extension
var page = new PagedList
{
PageIndex = input.PageNo,
PageIndex = input.PageIndex,
PageSize = input.PageSize,
Items = data,
TotalCount = count,
@@ -102,7 +102,7 @@ namespace Ewide.Core.Extension
var page = new PagedList<T>
{
PageIndex = input.PageNo,
PageIndex = input.PageIndex,
PageSize = input.PageSize,
Items = data,
TotalCount = count,
@@ -131,7 +131,7 @@ namespace Ewide.Core.Extension
var orderStr = OrderBuilder(input);
if (!string.IsNullOrEmpty(orderStr)) sqlStrList.Add(" ORDER BY " + orderStr);
// input.PageSize = 0表示不分页
if (input.PageSize != 0) sqlStrList.Add(" LIMIT " + ((input.PageNo - 1) * input.PageSize).ToString() + "," + input.PageSize.ToString());
if (input.PageSize != 0) sqlStrList.Add(" LIMIT " + ((input.PageIndex - 1) * input.PageSize).ToString() + "," + input.PageSize.ToString());
sql += String.Join("", sqlStrList);
return sql;
}