添加项目文件。
This commit is contained in:
55
Service/Interface/IBaseService.cs
Normal file
55
Service/Interface/IBaseService.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using Model;
|
||||
using SqlSugar;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Service.Interface
|
||||
{
|
||||
/// <summary>
|
||||
/// 泛型基础服务接口(返回 Result 封装)
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity">实体类型</typeparam>
|
||||
public interface IBaseService<TEntity> where TEntity : class, new()
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询全部
|
||||
/// </summary>
|
||||
/// <returns>返回包含数据的 Result</returns>
|
||||
Task<Result<List<TEntity>>> GetAllAsync();
|
||||
|
||||
/// <summary>
|
||||
/// 根据日期查询全部
|
||||
/// </summary>
|
||||
/// <param name="startDate">开始日期</param>
|
||||
/// <param name="endDate">结束日期</param>
|
||||
/// <returns>返回包含日期范内的数据的 Result</returns>
|
||||
Task<Result<List<TEntity>>> GetAllAsyncByDate(DateTime? startDate, DateTime? endDate);
|
||||
|
||||
/// <summary>
|
||||
/// 插入单条数据
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns>返回操作是否成功的 Result</returns>
|
||||
Task<Result<bool>> InsertAsync(TEntity entity);
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询
|
||||
/// </summary>
|
||||
/// <param name="pageIndex">页码(从1开始)</param>
|
||||
/// <param name="pageSize">每页数量</param>
|
||||
/// <param name="total">总条数(输出参数)</param>
|
||||
/// <returns>返回包含分页数据的 Result</returns>
|
||||
Task<Result<List<TEntity>>> GetPagedAsync(int pageIndex, int pageSize, RefAsync<int> total);
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询,并根据日期范围进行过滤
|
||||
/// </summary>
|
||||
/// <param name="pageIndex">页码(从1开始)</param>
|
||||
/// <param name="pageSize">每页数量</param>
|
||||
/// <param name="total">总条数(输出参数)</param>
|
||||
/// <param name="startDate">开始日期</param>
|
||||
/// <param name="endDate">结束日期</param>
|
||||
/// <returns>返回包含分页数据的 Result</returns>
|
||||
Task<Result<List<TEntity>>> GetPagedAsync(int pageIndex, int pageSize, RefAsync<int> total, DateTime? startDate, DateTime? endDate);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user