提交.Net6版本
This commit is contained in:
20
Yi.Framework.Net5/Yi.Framework.Model/Search/PageResult.cs
Normal file
20
Yi.Framework.Net5/Yi.Framework.Model/Search/PageResult.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Yi.Framework.Model.Search
|
||||
{
|
||||
public class PageResult<T>
|
||||
{
|
||||
public static readonly long serialVersionUID = 4612105649493688532L;
|
||||
public long total; // 总记录数
|
||||
public int totalPages; //总页数
|
||||
public List<T> rows; // 每页显示的数据集合
|
||||
|
||||
public PageResult(long total, List<T> rows)
|
||||
{
|
||||
this.total = total;
|
||||
this.rows = rows;
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Yi.Framework.Net5/Yi.Framework.Model/Search/SearchRequest.cs
Normal file
39
Yi.Framework.Net5/Yi.Framework.Model/Search/SearchRequest.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Model.Search
|
||||
{
|
||||
public class SearchRequest
|
||||
{
|
||||
public static readonly int DEFAULT_PAGE = 1;
|
||||
public static readonly int DEFAULT_SIZE = 20;
|
||||
public string key { get; set; }
|
||||
public int page { get; set; }
|
||||
//排序字段
|
||||
public string sortBy { get; set; }
|
||||
//是否降序
|
||||
public bool descending { get; set; }
|
||||
//过滤字段
|
||||
public Dictionary<string, string> filter = new Dictionary<string, string>();
|
||||
|
||||
public int getPage()
|
||||
{
|
||||
if (page == 0)
|
||||
{
|
||||
return DEFAULT_PAGE;
|
||||
}
|
||||
// 获取页码时做一些校验,不能小于1
|
||||
return Math.Max(DEFAULT_PAGE, page);
|
||||
}
|
||||
|
||||
public int getSize()
|
||||
{
|
||||
return DEFAULT_SIZE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user