chore:目录重构

This commit is contained in:
陈淳
2023-04-15 17:35:22 +08:00
parent a612af4f68
commit fb27fb8aa4
238 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
using System.Linq.Expressions;
using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
using Yi.Framework.Infrastructure.Enums;
namespace Yi.Framework.Infrastructure.Ddd.Repositories
{
public interface IRepository<T>
{
/// <summary>
/// 注释一下严格意义这里应该protected但是我认为 简易程度 与 耦合程度 中是需要进行衡量的
/// </summary>
ISugarQueryable<T> _DbQueryable { get; }
//单查
Task<T> GetByIdAsync(dynamic id);
Task<T> GetSingleAsync(Expression<Func<T, bool>> whereExpression);
Task<T> GetFirstAsync(Expression<Func<T, bool>> whereExpression);
Task<bool> IsAnyAsync(Expression<Func<T, bool>> whereExpression);
Task<int> CountAsync(Expression<Func<T, bool>> whereExpression);
//多查
Task<List<T>> GetListAsync();
Task<List<T>> GetListAsync(Expression<Func<T, bool>> whereExpression);
//分页查
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, int pageNum, int pageSize);
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, int pageNum, int pageSize, Expression<Func<T, object>>? orderByExpression = null, OrderByEnum orderByType = OrderByEnum.Asc);
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, int pageNum, int pageSize, string? orderBy, OrderByEnum orderByType = OrderByEnum.Asc);
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, IPagedAndSortedResultRequestDto page);
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, IPagedAndSortedResultRequestDto page, Expression<Func<T, object>>? orderByExpression = null, OrderByEnum orderByType = OrderByEnum.Asc);
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, IPagedAndSortedResultRequestDto page, string? orderBy, OrderByEnum orderByType = OrderByEnum.Asc);
//插入
Task<bool> InsertAsync(T insertObj);
Task<bool> InsertOrUpdateAsync(T data);
Task<bool> InsertOrUpdateAsync(List<T> datas);
Task<int> InsertReturnIdentityAsync(T insertObj);
Task<long> InsertReturnBigIdentityAsync(T insertObj);
Task<long> InsertReturnSnowflakeIdAsync(T insertObj);
Task<T> InsertReturnEntityAsync(T insertObj);
Task<bool> InsertRangeAsync(List<T> insertObjs);
//更新
Task<bool> UpdateAsync(T updateObj);
Task<bool> UpdateRangeAsync(List<T> updateObjs);
Task<bool> UpdateAsync(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
Task<bool> UpdateIgnoreNullAsync(T updateObj);
//删除
Task<bool> DeleteAsync(T deleteObj);
Task<bool> DeleteAsync(List<T> deleteObjs);
Task<bool> DeleteAsync(Expression<Func<T, bool>> whereExpression);
Task<bool> DeleteByIdAsync(dynamic id);
Task<bool> DeleteByIdsAsync(dynamic[] ids);
}
}