using SqlSugar;
using System.Linq.Expressions;
using UIStandardWebApi.Entity;
namespace UIStandardWebApi.IService
{
public interface IBaseService
{
#region Query
///
/// 主键查询
///
///
///
T Find(int id) where T : class;
///
/// 主键查询-异步版本
///
///
///
///
Task FindAsync(int id) where T : class;
///
/// 提供对单表的查询
///
/// ISugarQueryable类型集合
[Obsolete("尽量避免使用,using 带表达式目录树的 代替")]
ISugarQueryable Set() where T : class;
///
/// 条件查询
///
///
///
///
ISugarQueryable Query(Expression> funcWhere) where T : class;
///
/// 分页查询
///
///
///
///
///
///
///
///
PagingData QueryPage(Expression> funcWhere, int pageSize, int pageIndex, Expression> funcOrderby, bool isAsc = true) where T : class;
#endregion
#region Add
///
/// 新增数据-同步版本
///
///
///
///
T Insert(T t) where T : class, new();
///
/// 新增数据-异步版本
///
///
///
///
Task InsertAsync(T t) where T : class, new();
///
/// 批量新增
///
///
///
///
Task InsertList(List tList) where T : class, new();
#endregion
#region Update
///
/// 更新数据
///
///
///
///
Task UpdateAsync(T t) where T : class, new();
///
/// 更新数据,即时Commit
///
///
void Update(List tList) where T : class, new();
#endregion
#region Delete
///
/// 根据主键删除数据
///
///
///
///
bool Delete(object pId) where T : class, new();
///
/// 删除数据,即时Commit
///
///
void Delete(T t) where T : class, new();
///
/// 删除数据,即时Commit
///
///
void Delete(List tList) where T : class;
#endregion
#region Other
///
/// 执行sql 返回集合
///
///
///
///
ISugarQueryable ExcuteQuery(string sql) where T : class, new();
#endregion
}
}