整理分页支持,统一使用请求PageData对象和返回PageResult对象,并且在ApiResult中增加Paging属性表示分页结果。

This commit is contained in:
falcon 2023-04-10 18:21:55 +08:00
parent 64a4761ba9
commit 92eb80ae66
4 changed files with 27 additions and 19 deletions

View File

@ -19,6 +19,10 @@ namespace Falcon.SugarApi.ApiDefinistions
[JsonPropertyName("msg")] [JsonPropertyName("msg")]
public string Msg { get; set; } public string Msg { get; set; }
/// <summary> /// <summary>
/// 分页结果。如果为null则为未分页
/// </summary>
public PageResult? Paging { get; set; }
/// <summary>
/// 携带数据 /// 携带数据
/// </summary> /// </summary>
[JsonPropertyName("data")] [JsonPropertyName("data")]

View File

@ -6,9 +6,9 @@
public class PageData public class PageData
{ {
/// <summary> /// <summary>
/// 页号码 /// 页号码。从1开始
/// </summary> /// </summary>
public int Page { get; set; } = 0; public int Page { get; set; } = 1;
/// <summary> /// <summary>
/// 页大小 /// 页大小
/// </summary> /// </summary>

View File

@ -0,0 +1,21 @@
namespace Falcon.SugarApi.ApiDefinistions
{
/// <summary>
/// 数据分页结果
/// </summary>
public class PageResult {
/// <summary>
/// 页号码。从1开始
/// </summary>
public int Page { get; set; } = 1;
/// <summary>
/// 页大小
/// </summary>
public int PageSize { get; set; } = 50;
/// <summary>
/// 总数据数
/// </summary>
public int Count { get; set; } = 0;
}
}

View File

@ -1,17 +0,0 @@
namespace Falcon.SugarApi.DatabaseDefinitions
{
/// <summary>
/// 对数据进行分页
/// </summary>
public class Paging
{
/// <summary>
/// 每页大小
/// </summary>
public int PageSize { get; set; } = 100;
/// <summary>
/// 第几页。页码从1开始
/// </summary>
public int PageNo { get; set; } = 1;
}
}