| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- using SqlSugar;
- using System;
- using System.Collections.Generic;
- using System.Linq.Expressions;
- using System.Text;
- using System.Threading.Tasks;
- namespace System.Common
- {
- public interface IRepository<T> where T : class
- {
- /// <summary>
- /// 获取数量
- /// </summary>
- /// <param name="whereExpression"></param>
- /// <returns></returns>
- Task<int> GetCount(Expression<Func<T, bool>> whereExpression = null);
- /// <summary>
- /// 获取所有
- /// </summary>
- /// <returns></returns>
- Task<List<T>> GetList();
- Task<List<T>> GetListALL(Expression<Func<T, bool>> whereExpression);
- Task<List<T>> GetListALL(List<IConditionalModel> conModels, string orderby);
- Task<List<T>> GetListALL(Expression<Func<T, bool>> whereExpression, Expression<Func<T, object>> orderExpression, OrderByType ordertype = OrderByType.Asc);
- /// <summary>
- /// 分页获取所有
- /// </summary>
- /// <returns></returns>
- Task<PageData<T>> GetListByPage(List<IConditionalModel> conModels, PageModel pagemodel);
- Task<PageData<T>> GetListByPage(List<IConditionalModel> conModels, PageModel pagemodel, string orderby);
- Task<PageData<T>> GetListByPage(Expression<Func<T, bool>> whereExpression, PageModel pagemodel);
- Task<PageData<T>> GetListByPage(Expression<Func<T, bool>> whereExpression, PageModel pagemodel, string orderby);
- Task<T> GetSingle(Expression<Func<T, bool>> whereExpression);
- /// <summary>
- /// 添加
- /// </summary>
- Task<int> Add(T obj);
- /// <summary>
- /// 批量添加
- /// </summary>
- /// <param name="objlist"></param>
- /// <returns></returns>
- Task<bool> AddMany(List<T> objlist);
- /// <summary>
- /// 根据主键删除
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- Task<bool> Delete(Expression<Func<T, bool>> whereExpression);
- /// <summary>
- /// 更新
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- Task<bool> Update(T obj);
- }
- }
|