mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-15 01:11:52 +08:00
57 lines
1.4 KiB
C#
57 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace AntDesign.TableModels
|
|
{
|
|
public class QueryModel
|
|
{
|
|
public int PageIndex { get; }
|
|
|
|
public int PageSize { get; }
|
|
|
|
public IList<ITableSortModel> SortModel { get; private set; }
|
|
|
|
public IList<ITableFilterModel> FilterModel { get; private set; }
|
|
|
|
public QueryModel()
|
|
{
|
|
this.SortModel = new List<ITableSortModel>();
|
|
this.FilterModel = new List<ITableFilterModel>();
|
|
}
|
|
|
|
internal QueryModel(int pageIndex, int pageSize)
|
|
{
|
|
this.PageSize = pageSize;
|
|
this.PageIndex = pageIndex;
|
|
this.SortModel = new List<ITableSortModel>();
|
|
this.FilterModel = new List<ITableFilterModel>();
|
|
}
|
|
}
|
|
|
|
public class QueryModel<TItem> : QueryModel
|
|
{
|
|
[JsonIgnore]
|
|
public IQueryable<TItem> QueryableLambda { get; private set; }
|
|
|
|
internal QueryModel(int pageIndex, int pageSize) : base(pageIndex, pageSize)
|
|
{
|
|
}
|
|
|
|
internal void AddSortModel(ITableSortModel model)
|
|
{
|
|
SortModel.Add(model);
|
|
}
|
|
|
|
internal void AddFilterModel(ITableFilterModel model)
|
|
{
|
|
FilterModel.Add(model);
|
|
}
|
|
|
|
internal void SetQueryableLambda(IQueryable<TItem> query)
|
|
{
|
|
this.QueryableLambda = query;
|
|
}
|
|
}
|
|
}
|