SOMS/YunDa.Application/YunDa.SOMS.DataTransferObject/PagedAndSortedResultRequestDto.cs

39 lines
1.0 KiB
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.ComponentModel.DataAnnotations;
namespace YunDa.SOMS.DataTransferObject
{
/// <summary>
/// 分页和排序请求基础DTO
/// </summary>
public class PagedAndSortedResultRequestDto
{
/// <summary>
/// 页码从1开始
/// </summary>
[Range(1, int.MaxValue, ErrorMessage = "页码必须大于0")]
public int PageIndex { get; set; } = 1;
/// <summary>
/// 每页大小
/// </summary>
[Range(1, 1000, ErrorMessage = "每页大小必须在1-1000之间")]
public int PageSize { get; set; } = 20;
/// <summary>
/// 排序字段
/// 格式: "Name" 或 "Name DESC" 或 "Name ASC, Age DESC"
/// </summary>
public string Sorting { get; set; }
/// <summary>
/// 跳过的记录数
/// </summary>
public int SkipCount => (PageIndex - 1) * PageSize;
/// <summary>
/// 最大结果数
/// </summary>
public int MaxResultCount => PageSize;
}
}