using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace Highway.Assemble.SqlSugar
{
///
/// 统一操作类
///
///
public interface IBaseServices where TEntity : class
{
Task insertSQLAsync(string sql, List parameters);
Task QuerySingle(Expression> whereExpression);
Task QueryById(object objId);
Task QueryById(object objId, bool blnUseCache = false);
Task> QueryByIDs(object[] lstIds);
Task Add(TEntity model);
int Add1(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);
bool Update1(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);
List Query1(Expression> whereExpression);
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 自定义查询
List QueryList(Expression> whereExpression);
#endregion
}
///
/// 通用分页信息类
///
public class PageModel
{
///
/// 当前页标
///
public int page { get; set; } = 1;
///
/// 总页数
///
public int pageCount { get; set; } = 6;
///
/// 数据总数
///
public int dataCount { get; set; } = 0;
///
/// 每页大小
///
public int PageSize { set; get; }
///
/// 返回数据
///
public List data { get; set; }
}
}