整理分页支持,统一使用请求PageData对象和返回PageResult对象,并且在ApiResult中增加Paging属性表示分页结果。
This commit is contained in:
parent
64a4761ba9
commit
92eb80ae66
|
@ -19,6 +19,10 @@ namespace Falcon.SugarApi.ApiDefinistions
|
|||
[JsonPropertyName("msg")]
|
||||
public string Msg { get; set; }
|
||||
/// <summary>
|
||||
/// 分页结果。如果为null则为未分页
|
||||
/// </summary>
|
||||
public PageResult? Paging { get; set; }
|
||||
/// <summary>
|
||||
/// 携带数据
|
||||
/// </summary>
|
||||
[JsonPropertyName("data")]
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
public class PageData
|
||||
{
|
||||
/// <summary>
|
||||
/// 页号码
|
||||
/// 页号码。从1开始
|
||||
/// </summary>
|
||||
public int Page { get; set; } = 0;
|
||||
public int Page { get; set; } = 1;
|
||||
/// <summary>
|
||||
/// 页大小
|
||||
/// </summary>
|
||||
|
|
21
Falcon.SugarApi/ApiDefinistions/PageResult.cs
Normal file
21
Falcon.SugarApi/ApiDefinistions/PageResult.cs
Normal 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;
|
||||
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user