using SLH.SSDMS.Model.DTO;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace SLH.SSDMS.Services
{
///
/// IBaseRepository
///
public interface IBaseServices where TEntity : class
{
Task QuerySingle(Expression> whereExpression);
Task QueryById(object objId);
Task QueryById(object objId, bool blnUseCache = false);
Task> QueryByIDs(object[] lstIds);
Task Add(TEntity model);
Task AddLog(TEntity model);
Task Add(List listEntity);
Task DeleteById(object id);
Task Delete(TEntity model);
Task Delete(Expression> whereExpression);
Task DeleteByIds(object[] ids);
Task Update(TEntity model);
Task Update(TEntity entity, string strWhere);
Task Update(object operateAnonymousObjects);
Task Update(TEntity entity, List lstColumns = null, List lstIgnoreColumns = null, string strWhere = "");
Task> Query();
Task> Query(string strWhere);
Task> Query(Expression> whereExpression);
Task> Query(Expression> whereExpression, string strOrderByFileds);
Task> Query(Expression> whereExpression, Expression> orderByExpression, bool isAsc = true);
Task> Query(string strWhere, string strOrderByFileds);
Task QueryFirst(Expression> whereExpression, Expression> orderByExpression, bool isAsc = true);
Task> Query(Expression> whereExpression, int intTop, string strOrderByFileds);
Task> Query(string strWhere, int intTop, string strOrderByFileds);
Task> Query(
Expression> whereExpression, int intPageIndex, int intPageSize, string strOrderByFileds);
Task> Query(string strWhere, int intPageIndex, int intPageSize, string strOrderByFileds);
Task> QueryPage(Expression> whereExpression, int intPageIndex = 1, int intPageSize = 20, string strOrderByFileds = null);
Task> QueryMuch(
Expression> joinExpression,
Expression> selectExpression,
Expression> whereLambda = null) where T : class, new();
Task> QueryMuch(
Expression> joinExpression,
Expression> selectExpression,
Expression> whereLambda = null) where T : class, new();
Task> QueryMuch(
Expression> joinExpression,
Expression> selectExpression,
Expression> whereLambda = null) where T : class, new();
Task> QueryMuch(
Expression> joinExpression,
Expression> selectExpression,
Expression> whereLambda = null) where T : class, new();
#region 多表分页
///
///查询-多表查询
///
/// 实体1
/// 实体2
/// 实体3
/// 实体4
/// 实体5
/// 返回对象
/// 关联表达式 (join1,join2) => new object[] {JoinType.Left,join1.UserNo==join2.UserNo}
/// 返回表达式 (s1, s2) => new { Id =s1.UserNo, Id1 = s2.UserNo}
/// 查询表达式 (w1, w2) =>w1.UserNo == "")
/// 值
Task> QueryMuchPage(
Expression> joinExpression,
Expression> selectExpression,
Expression> whereLambda = null, int intPageIndex = 1, int intPageSize = 20,
string strOrderByFileds = null) where T : class, new();
///
///查询-多表查询
///
/// 实体1
/// 实体2
/// 实体3
/// 实体4
/// 返回对象
/// 关联表达式 (join1,join2) => new object[] {JoinType.Left,join1.UserNo==join2.UserNo}
/// 返回表达式 (s1, s2) => new { Id =s1.UserNo, Id1 = s2.UserNo}
/// 查询表达式 (w1, w2) =>w1.UserNo == "")
/// 值
Task> QueryMuchPage(
Expression> joinExpression,
Expression> selectExpression,
Expression> whereLambda = null, int intPageIndex = 1, int intPageSize = 20,
string strOrderByFileds = null) where T : class, new();
///
///查询-多表查询
///
/// 实体1
/// 实体2
/// 实体3
/// 返回对象
/// 关联表达式 (join1,join2) => new object[] {JoinType.Left,join1.UserNo==join2.UserNo}
/// 返回表达式 (s1, s2) => new { Id =s1.UserNo, Id1 = s2.UserNo}
/// 查询表达式 (w1, w2) =>w1.UserNo == "")
/// 值
Task> QueryMuchPage(
Expression> joinExpression,
Expression> selectExpression,
Expression> whereLambda = null, int intPageIndex = 1, int intPageSize = 20,
string strOrderByFileds = null) where T : class, new();
///
///查询-多表查询
///
/// 实体1
/// 实体2
/// 返回对象
/// 关联表达式 (join1,join2) => new object[] {JoinType.Left,join1.UserNo==join2.UserNo}
/// 返回表达式 (s1, s2) => new { Id =s1.UserNo, Id1 = s2.UserNo}
/// 查询表达式 (w1, w2) =>w1.UserNo == "")
/// 值
Task> QueryMuchPage(
Expression> joinExpression,
Expression> selectExpression,
Expression> whereLambda = null, int intPageIndex = 1, int intPageSize = 20,
string strOrderByFileds = null) where T : class, new();
///
///查询-多表查询 (测试)
///
/// 实体1
/// 实体2
/// 返回对象
/// 关联表达式 (join1,join2) => new object[] {JoinType.Left,join1.UserNo==join2.UserNo}
/// 返回表达式 (s1, s2) => new { Id =s1.UserNo, Id1 = s2.UserNo}
/// 查询表达式 (w1, w2) =>w1.UserNo == "")
/// 值
Task> QueryMuchPage(
Expression> joinExpression,
Expression> selectExpression,
Expression> sortExpression,
Expression> whereLambda = null,
int intPageIndex = 1, int intPageSize = 20, string strOrderByFileds = null) where T : class, new();
#endregion
///
/// 存储过程
///
///
///
///
Task> QueryByProc(string proc, List parameters) where T : class, new();
Task, List>> QueryByProc(string proc, List parameters)
where T : class, new();
///
/// sql语句
///
Task> QueryBySql(string sql, List parameters) where T : class, new();
#region 自定义
///
/// 添加上机记录
///
///
///
///
Task BoardAdd(TEntity boardEntity, Expression> whereExpression);
#endregion
}
}