refactor: 重构项目基础架构与实体体系

- 替换原有自定义生命周期接口为通用基础服务体系
- 将所有实体基类替换为带雪花ID的SqlSugarBaseEntity
- 迁移DTO到Models项目并统一管理
- 移除冗余的Repository层实现,改用通用基础服务
- 添加Yitter.IdGenerator雪花ID生成支持
- 重构SqlSugar数据库上下文与依赖注入配置
- 新增微信用户、用户勋章、背包等实体与配套服务
- 整理分页查询与结果封装类
- 优化WebApi控制器结构
This commit is contained in:
glz
2026-06-02 14:10:43 +08:00
parent 831f8ba7f5
commit 8ed012bba8
51 changed files with 1762 additions and 1141 deletions

View File

@ -1,27 +1,57 @@
namespace QYZH.InteractiveMagazine.Models.Dto;
/// <summary>
/// 分页查询输入
/// 通用分页查询
/// </summary>
public class PageQueryModel
{
/// <summary>
/// 页码默认1
///当前页
/// </summary>
public int PageIndex { get; set; } = 1;
/// <summary>
/// 每页条数默认10
///每页条数
/// </summary>
public int PageSize { get; set; } = 10;
/// <summary>
/// 排序字段
/// </summary>
public string? SortField { get; set; }
public string Sort { get; set; } = string.Empty;
/// <summary>
/// 排序类型,前端传入的是"ascending""descending"
/// </summary>
public string SortType { get; set; } = string.Empty;
/// <summary>
/// 排序方式asc/desc
/// 关键字
/// </summary>
public string? SortOrder { get; set; }
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;
}