using EntrustSettle.Model; using SqlSugar; using System; using System.Collections.Generic; using System.Data; using System.Linq.Expressions; using System.Threading.Tasks; namespace EntrustSettle.IRepository.Base { public interface IBaseRepository where TEntity : class { /// /// SqlsugarClient实体 /// ISqlSugarClient Db { get; } #region 查询 Task QueryById(object objId); Task QueryById(object objId, bool blnUseCache = false); Task> QueryByIDs(object[] lstIds); Task QueryFirst(Expression> whereExpression); Task QueryFirstInclude(Expression> whereExpression, Expression>> include); Task> Query(); Task> Query(Expression> whereExpression); Task> Query(Expression> whereExpression, Expression> orderByExpression, bool isAsc = true); Task> Query(Expression> whereExpression, string orderByFields); Task> Query(string where, string orderByFields); Task> QueryTop(string where, int intTop, string orderByFields); Task> QueryTop(Expression> whereExpression, int intTop, string orderByFields); Task> QueryPage(string where, int pageIndex, int pageSize, string orderByFields); Task> QueryPage(Expression> whereExpression, int pageIndex, int pageSize, string orderByFields); Task> QueryPageModel(Expression> whereExpression, int pageIndex = 1, int pageSize = 20, Expression> orderByExpression = null, bool isAsc = true); Task> QueryPageModel(Expression> whereExpression, int pageIndex = 1, int pageSize = 20, string orderByFields = null); Task> QueryDto(Expression> expression); Task> QueryDto(Expression> expression, Expression> whereExpression, string orderByFields); Task> QuerySql(string sql, SugarParameter[] parameters = null); Task QueryTable(string sql, SugarParameter[] parameters = null); /// /// 两表联查 /// Task> QueryMuch(Expression> joinExpression, Expression> whereLambda, Expression> selectExpression) where T : class, new(); /// /// 两表联查-分页 /// Task> QueryMuchPage(Expression> joinExpression, Expression> whereExpression, Expression> selectExpression, int pageIndex = 1, int pageSize = 20, string strOrderByFileds = null); /// /// 两表联合查询-分页-分组 /// Task> QueryMuchPageGroup(Expression> joinExpression, Expression> whereExpression, Expression> selectExpression, Expression> groupExpression, int pageIndex = 1, int pageSize = 20, string strOrderByFileds = null); /// /// 三表联查 /// Task> QueryMuch(Expression> joinExpression, Expression> whereLambda, Expression> selectExpression) where T : class, new(); /// /// 三表联查-分页 /// Task> QueryMuchPage(Expression> joinExpression, Expression> whereExpression, Expression> selectExpression, int pageIndex = 1, int pageSize = 20, string strOrderByFileds = null); #endregion #region 新增 Task Add(TEntity model); Task> Add(List listEntity); #endregion #region 删除 Task Delete(Expression> whereExpression); Task DeleteById(object id); Task Delete(TEntity model); Task DeleteByIds(object[] ids); #endregion #region 更新 Task Update(TEntity model); Task Update(TEntity entity, Expression> updateColumns); Task Update(List model); Task Update(TEntity entity, string where); Task Update(object operateAnonymousObjects); Task Update(TEntity entity, List lstColumns = null, List lstIgnoreColumns = null, string where = ""); Task Update(Expression> columns, Expression> where); #endregion #region Split分表基础接口 (基础CRUD) /// /// 通过ID查询(自动分表) /// Task QueryByIdSplit(object objId); /// /// 分页查询(自动分表) /// Task> QueryPageSplit(Expression> whereExpression, DateTime beginTime, DateTime endTime, int pageIndex = 1, int pageSize = 20, string orderByFields = null); /// /// 插入(自动分表) /// Task> AddSplit(TEntity entity); /// /// 删除(自动分表) /// Task DeleteSplit(TEntity entity, DateTime dateTime); /// /// 更新(自动分表) /// Task UpdateSplit(TEntity entity, DateTime dateTime); #endregion } }