Files
Yi.Framework/Yi.Framework.Net6/Yi.Framework.Model/Search/SearchRequest.cs
2021-12-25 14:50:54 +08:00

40 lines
969 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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;
}
}
}