2026-06-01 13:42:40 +08:00
|
|
|
|
namespace QYZH.InteractiveMagazine.Models.Dto;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2026-06-02 14:10:43 +08:00
|
|
|
|
/// 通用分页查询类
|
2026-06-01 13:42:40 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class PageQueryModel
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2026-06-02 14:10:43 +08:00
|
|
|
|
///当前页
|
2026-06-01 13:42:40 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public int PageIndex { get; set; } = 1;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2026-06-02 14:10:43 +08:00
|
|
|
|
///每页条数
|
2026-06-01 13:42:40 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public int PageSize { get; set; } = 10;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序字段
|
|
|
|
|
|
/// </summary>
|
2026-06-02 14:10:43 +08:00
|
|
|
|
public string Sort { get; set; } = string.Empty;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序类型,前端传入的是"ascending","descending"
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string SortType { get; set; } = string.Empty;
|
2026-06-01 13:42:40 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2026-06-02 14:10:43 +08:00
|
|
|
|
/// 关键字
|
2026-06-01 13:42:40 +08:00
|
|
|
|
/// </summary>
|
2026-06-02 14:10:43 +08:00
|
|
|
|
public string? KeyWord { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 分页查询泛型类
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <typeparam name="T">查询参数类型</typeparam>
|
|
|
|
|
|
public class PageQueryModel<T> : PageQueryModel where T : class, new()
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询参数
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public T Params { get; set; } = new T();
|
|
|
|
|
|
|
|
|
|
|
|
public TP ConvertTo<TP>() where TP : class
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Params != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Params as TP;
|
|
|
|
|
|
}
|
|
|
|
|
|
return default;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int Start => (PageIndex - 1) * PageSize + 1;
|
|
|
|
|
|
|
|
|
|
|
|
public int End => PageIndex * PageSize;
|
2026-06-01 13:42:40 +08:00
|
|
|
|
}
|