You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.7 KiB
47 lines
1.7 KiB
using SqlSugar; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Text; |
|
using System.Linq; |
|
using System.Threading.Tasks; |
|
namespace ReZero.SuperAPI |
|
{ |
|
/// <summary> |
|
/// Page |
|
/// </summary> |
|
public partial class QueryCommon : IDataService |
|
{ |
|
private async Task<object?> PageQuery(DataModel dataModel, RefAsync<int> count, Type type, QueryMethodInfo queryObject, object? result) |
|
{ |
|
result = await queryObject.ToPageListAsync(dataModel!.CommonPage!.PageNumber, dataModel.CommonPage.PageSize, count); |
|
dataModel.CommonPage.TotalCount = count.Value; |
|
if (dataModel.Columns?.Any() == false) |
|
{ |
|
dataModel.Columns = _sqlSugarClient!.EntityMaintenance.GetEntityInfo(type).Columns.Select(it => new DataColumnParameter |
|
{ |
|
PropertyName = it.PropertyName, |
|
Description = it.ColumnDescription |
|
}).ToList(); |
|
} |
|
dataModel.OutPutData = new DataModelOutPut |
|
{ |
|
Page = new DataModelPageParameter() |
|
{ |
|
TotalCount = count.Value, |
|
PageNumber = dataModel.CommonPage.PageNumber, |
|
PageSize = dataModel.CommonPage.PageSize, |
|
TotalPage = (int)Math.Ceiling((double)count.Value / dataModel.CommonPage.PageSize) |
|
}, |
|
Columns = dataModel.Columns |
|
}; |
|
return result; |
|
} |
|
|
|
private static async Task<object?> DefaultQuery(QueryMethodInfo queryObject, object? result) |
|
{ |
|
result = await queryObject.ToListAsync(); |
|
return result; |
|
} |
|
|
|
} |
|
}
|
|
|