2020-07-08 16:12:49 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace AntDesign.TableModels
|
|
|
|
|
{
|
|
|
|
|
public class QueryModel<TItem>
|
|
|
|
|
{
|
|
|
|
|
public int PageIndex { get; }
|
|
|
|
|
|
|
|
|
|
public int PageSize { get; }
|
|
|
|
|
|
|
|
|
|
public IList<ITableSortModel> SortModel { get; private set; }
|
|
|
|
|
|
2021-02-27 23:55:48 +08:00
|
|
|
|
public IList<ITableFilterModel> FilterModel { get; private set; }
|
|
|
|
|
|
2020-07-08 16:12:49 +08:00
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public IQueryable<TItem> QueryableLambda { get; private set; }
|
|
|
|
|
|
|
|
|
|
internal QueryModel(int pageIndex, int pageSize)
|
|
|
|
|
{
|
|
|
|
|
this.PageSize = pageSize;
|
|
|
|
|
this.PageIndex = pageIndex;
|
2020-09-01 17:23:31 +08:00
|
|
|
|
this.SortModel = new List<ITableSortModel>();
|
2021-02-27 23:55:48 +08:00
|
|
|
|
this.FilterModel = new List<ITableFilterModel>();
|
2020-07-08 16:12:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal void AddSortModel(ITableSortModel model)
|
|
|
|
|
{
|
|
|
|
|
SortModel.Add(model);
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-27 23:55:48 +08:00
|
|
|
|
internal void AddFilterModel(ITableFilterModel model)
|
|
|
|
|
{
|
|
|
|
|
FilterModel.Add(model);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-08 16:12:49 +08:00
|
|
|
|
internal void SetQueryableLambda(IQueryable<TItem> query)
|
|
|
|
|
{
|
|
|
|
|
this.QueryableLambda = query;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|