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