using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; namespace CommonUtil.Db { /// /// 数据库操作扩展 /// public abstract class DbSet : DbContext, IDbSet where T : class, new() { #region Avg函数 /// /// Avg函数 /// /// 返回值 /// avg函数表达式 /// public virtual TResult Avg(Expression> avg) => Avg(null, null, null, avg); /// /// Avg函数 /// /// 返回值 /// where函数表达式 /// avg函数表达式 /// public virtual TResult Avg(Expression> where, Expression> avg) => Avg(null, null, where, avg); /// /// Avg函数 /// /// 返回值 /// 表名 /// avg函数表达式 /// public virtual TResult Avg(string tableName, Expression> avg) => Avg(null, null, null, avg); /// /// Avg函数 /// /// 返回值 /// 表名 /// where函数表达式 /// avg函数表达式 /// public virtual TResult Avg(string tableName, Expression> where, Expression> avg) => Avg(null, tableName, where, avg); /// /// Avg函数 /// /// 返回值 /// 库名 /// 表名 /// avg函数表达式 /// public virtual TResult Avg(string storeName, string tableName, Expression> avg) => Avg(storeName, tableName, null, avg); /// /// Avg函数 /// /// 返回值 /// 库名 /// 表名 /// where函数表达式 /// avg函数表达式 /// public virtual TResult Avg(string storeName, string tableName, Expression> where, Expression> avg) { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } return queryable.Avg(avg); } #endregion #region Sum函数 /// /// Sum函数 /// /// /// /// /// public virtual TResult Sum(Expression> where, Expression> sum) => Sum(null, null, where, sum); /// /// Sum函数 /// /// /// /// /// public virtual TResult Sum(string tableName, Expression> sum) => Sum(null, tableName, null, sum); /// /// Sum函数 /// /// /// /// /// /// public virtual TResult Sum(string tableName, Expression> where, Expression> sum) => Sum(null, tableName, where, sum); /// /// Sum函数 /// /// /// /// /// /// public virtual TResult Sum(string storeName, string tableName, Expression> sum) => Sum(storeName, tableName, null, sum); /// /// Sum函数 /// /// /// /// /// /// /// public virtual TResult Sum(string storeName, string tableName, Expression> where, Expression> sum) { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } return queryable.Sum(sum); } #endregion #region Min函数 /// /// Min函数 /// /// /// /// public virtual TResult Min(Expression> min) => Min(null, null, null, min); /// /// Min函数 /// /// /// /// /// public virtual TResult Min(Expression> where, Expression> min) => Min(null, null, where, min); /// /// Min函数 /// /// /// /// /// public virtual TResult Min(string tableName, Expression> min) => Min(null, tableName, null, min); /// /// Min函数 /// /// /// /// /// /// public virtual TResult Min(string tableName, Expression> where, Expression> min) => Min(null, tableName, where, min); /// /// Min函数 /// /// /// /// /// /// public virtual TResult Min(string storeName, string tableName, Expression> min) => Min(storeName, tableName, null, min); /// /// Min函数 /// /// /// /// /// /// /// public virtual TResult Min(string storeName, string tableName, Expression> where, Expression> min) { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } return queryable.Min(min); } #endregion #region Max函数 /// /// Max函数 /// /// /// /// public virtual TResult Max(Expression> max) => Max(null, null, null, max); /// /// Max函数 /// /// /// /// /// public virtual TResult Max(Expression> where, Expression> max) => Max(null, null, where, max); /// /// Max函数 /// /// /// /// /// public virtual TResult Max(string tableName, Expression> max) => Max(null, tableName, null, max); /// /// Max函数 /// /// /// /// /// /// public virtual TResult Max(string tableName, Expression> where, Expression> max) => Max(null, tableName, where, max); /// /// Max函数 /// /// /// /// /// /// public virtual TResult Max(string storeName, string tableName, Expression> max) => Max(storeName, tableName, null, max); /// /// Max函数 /// /// /// /// /// /// /// public virtual TResult Max(string storeName, string tableName, Expression> where, Expression> max) { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } return queryable.Max(max); } #endregion #region Count函数 /// /// Count函数 /// /// /// public virtual int Count(Expression> where) => Count(null, null, where); /// /// Count函数 /// /// /// public virtual int Count(string tableName) => Count(null, tableName, null); /// /// Count函数 /// /// /// /// public virtual int Count(string tableName, Expression> where) => Count(null, tableName, where); /// /// Count函数 /// /// /// /// public virtual int Count(string storeName, string tableName) => Count(storeName, tableName, null); /// /// Count函数 /// /// /// /// /// public virtual int Count(string storeName, string tableName, Expression> where) { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } return queryable.Count(); } #endregion #region IsExist函数 /// /// 是否存在,IsExist函数 /// /// /// public virtual bool IsExist(Expression> where) => IsExist(null, null, where); /// /// IsAny函数 /// /// /// /// public virtual bool IsExist(string tableName, Expression> where) => IsExist(null, tableName, where); /// /// IsAny函数 /// /// /// /// /// public virtual bool IsExist(string storeName, string tableName, Expression> where) { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } return queryable.Any(); } #endregion #region 根据主键查询 /// /// 根据主键查询 /// /// /// public virtual T GetById(long id) => GetById(id, null, null); /// /// 根据主键查询 /// /// /// /// public virtual T GetById(long id, string tableName) => GetById(id, null, tableName); /// /// 根据主键查询 /// /// /// /// /// public virtual T GetById(long id, string storeName, string tableName) { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } return queryable.InSingle(id); } /// /// 根据主键查询 /// /// /// public virtual T GetById(string id) => GetById(id, null, null); /// /// 根据主键查询 /// /// /// /// public virtual T GetById(string id, string tableName) => GetById(id, null, tableName); /// /// 根据主键查询 /// /// /// /// /// public virtual T GetById(string id, string storeName, string tableName) { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } return queryable.InSingle(id); } #endregion #region 查询单条,多条会抛出异常 /// /// 查询单条,多条会抛出异常 /// /// /// public virtual T GetSingle(Expression> where) => GetSingle(where, null, null); /// /// 查询单条,多条会抛出异常 /// /// /// /// public virtual T GetSingle(Expression> where, string tableName) => GetSingle(where, null, tableName); /// /// 查询单条,多条会抛出异常 /// /// /// /// /// public virtual T GetSingle(Expression> where, string storeName, string tableName) { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } return queryable.Single(where); } #endregion #region 查询第一条 /// /// 查询第一条 /// /// /// public virtual T GetFirst(Expression> where) => GetFirst(null, null, where, null, null); /// /// 查询第一条 /// /// /// public virtual T GetFirst(string tableName) => GetFirst(null, tableName, null, null, null); /// /// 查询第一条 /// /// /// /// public virtual T GetFirst(Expression> order, DbEnum.OrderType? orderBy) => GetFirst(null, null, null, order, orderBy); /// /// 查询第一条 /// /// /// /// public virtual T GetFirst(string tableName, Expression> where) => GetFirst(null, tableName, where, null, null); /// /// 查询第一条 /// /// /// /// public virtual T GetFirst(string storeName, string tableName) => GetFirst(storeName, tableName, null, null, null); /// /// 查询第一条 /// /// /// /// /// public virtual T GetFirst(Expression> where, Expression> order, DbEnum.OrderType? orderBy) => GetFirst(null, null, where, order, orderBy); /// /// 查询第一条 /// /// /// /// /// public virtual T GetFirst(string tableName, Expression> order, DbEnum.OrderType? orderBy) => GetFirst(null, tableName, null, order, orderBy); /// /// 查询第一条 /// /// /// /// /// public virtual T GetFirst(string storeName, string tableName, Expression> where) => GetFirst(storeName, tableName, where, null, null); /// /// 查询第一条 /// /// /// /// /// /// public virtual T GetFirst(string tableName, Expression> where, Expression> order, DbEnum.OrderType? orderBy) => GetFirst(null, tableName, where, order, orderBy); /// /// 查询第一条 /// /// /// /// /// /// public virtual T GetFirst(string storeName, string tableName, Expression> order, DbEnum.OrderType? orderBy) => GetFirst(storeName, tableName, null, order, orderBy); /// /// 查询第一条 /// /// /// /// /// /// /// public virtual T GetFirst(string storeName, string tableName, Expression> where, Expression> order, DbEnum.OrderType? orderBy) { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (order != null) { queryable = orderBy.HasValue ? queryable.OrderBy(order, (SqlSugar.OrderByType)orderBy) : queryable.OrderBy(order); } if (where != null) { queryable = queryable.Where(where); } return queryable.First(); } #endregion #region 查询全部 /// /// 查询全部 /// /// /// public virtual List ListGet(Expression> groupBy) => ListGet(null, null, null, null, null, groupBy, null); /// /// 查询全部 /// /// /// public virtual List ListGet(Expression> where) => ListGet(null, tableName: null, where: where, order: null, orderBy: null, groupBy: null, having: null); /// /// 查询全部 /// /// /// public virtual List ListGet(string tableName) => ListGet(null, tableName, null, null, null, null, null); /// /// 查询全部 /// /// /// /// public virtual List ListGet(Expression> groupBy, Expression> having) => ListGet(null, null, null, null, null, groupBy, having); /// /// 查询全部 /// /// /// /// public virtual List ListGet(Expression> where, Expression> groupBy) => ListGet(null, null, where, order: null, orderBy: null, groupBy: groupBy, having: null); /// /// 查询全部 /// /// /// /// public virtual List ListGet(string tableName, Expression> groupBy) => ListGet(null, tableName, null, null, null, groupBy, null); /// /// 查询全部 /// /// /// /// public virtual List ListGet(Expression> order, DbEnum.OrderType? orderBy) => ListGet(null, null, null, order, orderBy, null, null); /// /// 查询全部 /// /// /// /// public virtual List ListGet(string tableName, Expression> where) => ListGet(null, tableName: tableName, where: where, order: null, orderBy: null, groupBy: null, having: null); /// /// 查询全部 /// /// /// /// public virtual List ListGet(string storeName, string tableName) => ListGet(storeName, tableName, null, null, null, null, null); /// /// 查询全部 /// /// /// /// /// public virtual List ListGet(string tableName, Expression> groupBy, Expression> having) => ListGet(null, tableName, null, null, null, groupBy, having); /// /// 查询全部 /// /// /// /// /// public virtual List ListGet(string tableName, Expression> where, Expression> groupBy) => ListGet(null, tableName, where, order: null, orderBy: null, groupBy: groupBy, having: null); /// /// 查询全部 /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> groupBy) => ListGet(storeName, tableName, null, null, null, groupBy, null); /// /// 查询全部 /// /// /// /// /// public virtual List ListGet(Expression> where, Expression> order, DbEnum.OrderType? orderBy) => ListGet(null, null, where, order, orderBy, null, null); /// /// 查询全部 /// /// /// /// /// public virtual List ListGet(string tableName, Expression> order, DbEnum.OrderType? orderBy) => ListGet(null, tableName, null, order, orderBy, null, null); /// /// 查询全部 /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> where) => ListGet(storeName, tableName: tableName, where: where, order: null, orderBy: null, groupBy: null, having: null); /// /// 查询全部 /// /// /// /// /// /// public virtual List ListGet(Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) => ListGet(null, null, null, order, orderBy, groupBy, having); /// /// 查询全部 /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> where, Expression> groupBy, Expression> having) => ListGet(null, tableName, where, order: null, orderBy: null, groupBy: groupBy, having: having); /// /// 查询全部 /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> groupBy, Expression> having) => ListGet(storeName, tableName, null, null, null, groupBy, having); /// /// 查询全部 /// /// /// /// /// /// public virtual List ListGet(Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) => ListGet(null, null, where, order, orderBy, groupBy, null); /// /// 查询全部 /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) => ListGet(null, tableName, null, order, orderBy, groupBy, null); /// /// 查询全部 /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> where, Expression> groupBy) => ListGet(storeName, tableName, where, order: null, orderBy: null, groupBy: groupBy, having: null); /// /// 查询全部 /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> where, Expression> order, DbEnum.OrderType? orderBy) => ListGet(null, tableName, where, order, orderBy, null, null); /// /// 查询全部 /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> order, DbEnum.OrderType? orderBy) => ListGet(storeName, tableName, null, order, orderBy, null, null); /// /// 查询全部 /// /// /// /// /// /// /// public virtual List ListGet(Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) => ListGet(null, null, where, order, orderBy, groupBy, having); /// /// 查询全部 /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) => ListGet(null, tableName, null, order, orderBy, groupBy, having); /// /// 查询全部 /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> where, Expression> groupBy, Expression> having) => ListGet(storeName, tableName, where, order: null, orderBy: null, groupBy: groupBy, having: having); /// /// 查询全部 /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) => ListGet(null, tableName, where, order, orderBy, groupBy, null); /// /// 查询全部 /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) => ListGet(storeName, tableName, null, order, orderBy, groupBy, null); /// /// 查询全部 /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> where, Expression> order, DbEnum.OrderType? orderBy) => ListGet(storeName, tableName, where, order, orderBy, null, null); /// /// 查询全部 /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) => ListGet(null, tableName, where, order, orderBy, groupBy, having); /// /// 查询全部 /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) => ListGet(storeName, tableName, null, order, orderBy, groupBy, having); /// /// 查询全部 /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) => ListGet(storeName, tableName, where, order, orderBy, groupBy, null); /// /// 查询全部 /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } if (order != null) { queryable = orderBy.HasValue ? queryable.OrderBy(order, (SqlSugar.OrderByType)orderBy) : queryable.OrderBy(order); } if (groupBy != null) { queryable = queryable.GroupBy(groupBy); } if (having != null) { queryable = queryable.Having(having); } return queryable.ToList(); } #endregion #region 分页查询全部 /// /// 分页查询全部 /// /// /// /// /// public virtual List ListPageGet(int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, null, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// public virtual List ListPageGet(Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, null, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// public virtual List ListPageGet(Expression> where, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName: null, tableName: null, where: where, order: null, orderBy: null, groupBy: null, having: null, pageIndex: pageIndex, pageSize: pageSize, totalCount: ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// public virtual List ListPageGet(string tableName, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, null, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, null, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> where, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, where, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, null, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, null, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> where, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName: null, tableName: tableName, where: where, order: null, orderBy: null, groupBy: null, having: null, pageIndex: pageIndex, pageSize: pageSize, totalCount: ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, null, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> where, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, where, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, null, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, null, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> where, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, where, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, null, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> where, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, where, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, null, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> where, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName: storeName, tableName: tableName, where: where, order: null, orderBy: null, groupBy: null, having: null, pageIndex: pageIndex, pageSize: pageSize, totalCount: ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, null, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> where, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, where, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, null, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, where, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, null, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> where, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, where, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> where, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, where, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, null, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, where, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, null, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> where, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, where, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, where, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, null, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> where, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, where, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, where, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, null, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, where, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询全部 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } if (order != null) { queryable = orderBy.HasValue ? queryable.OrderBy(order, (SqlSugar.OrderByType)orderBy) : queryable.OrderBy(order); } if (groupBy != null) { queryable = queryable.GroupBy(groupBy); } if (having != null) { queryable = queryable.Having(having); } return queryable.ToPageList(pageIndex, pageSize, ref totalCount); } #endregion #region 查询指定列 /// /// 查询指定列 /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> groupBy) => ListGet(null, null, select, null, null, null, groupBy, null); /// /// 查询指定列 /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> where) => ListGet(null, null, select, where, null, null, null, null); /// /// 查询指定列 /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select) => ListGet(null, tableName, select, null, null, null, null, null); /// /// 查询指定列 /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> groupBy, Expression> having) => ListGet(null, null, select, null, null, null, groupBy, having); /// /// 查询指定列 /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> where, Expression> groupBy) => ListGet(null, null, select, where, null, null, groupBy, null); /// /// 查询指定列 /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> groupBy) => ListGet(null, tableName, select, null, null, null, groupBy, null); /// /// 查询指定列 /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> order, DbEnum.OrderType? orderBy) => ListGet(null, null, select, null, order, orderBy, null, null); /// /// 查询指定列 /// /// /// /// /// public virtual List ListGet(Expression> select, string orderField) => ListGet(null, null, select, null, orderField, null, null); /// /// 查询指定列 /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> where) => ListGet(null, tableName, select, where, null, null, null, null); /// /// 查询指定列 /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select) => ListGet(storeName, tableName, select, null, null, null, null, null); /// /// 查询指定列 /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> groupBy, Expression> having) => ListGet(null, tableName, select, null, null, null, groupBy, having); /// /// 查询指定列 /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> where, Expression> groupBy) => ListGet(null, tableName, select, where, null, null, groupBy, null); /// /// 查询指定列 /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> groupBy) => ListGet(storeName, tableName, select, null, null, null, groupBy, null); /// /// 查询指定列 /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy) => ListGet(null, null, select, where, order, orderBy, null, null); /// /// 查询指定列 /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> where, string orderField) => ListGet(null, null, select, where, orderField, null, null); /// /// 查询指定列 /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> order, DbEnum.OrderType? orderBy) => ListGet(null, tableName, select, null, order, orderBy, null, null); /// /// 查询指定列 /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, string orderField) => ListGet(null, tableName, select, null, orderField, null, null); /// /// 查询指定列 /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> where) => ListGet(storeName, tableName, select, where, null, null, null, null); /// /// 查询指定列 /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) => ListGet(null, null, select, null, order, orderBy, groupBy, having); /// /// 查询指定列 /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, string orderField, Expression> groupBy, Expression> having) => ListGet(null, null, select, null, orderField, groupBy, having); /// /// 查询指定列 /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> where, Expression> groupBy, Expression> having) => ListGet(null, tableName, select, where, null, null, groupBy, having); /// /// 查询指定列 /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> groupBy, Expression> having) => ListGet(storeName, tableName, select, null, null, null, groupBy, having); /// /// 查询指定列 /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) => ListGet(null, null, select, where, order, orderBy, groupBy, null); /// /// 查询指定列 /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> where, string orderField, Expression> groupBy) => ListGet(null, null, select, where, orderField, groupBy, null); /// /// 查询指定列 /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) => ListGet(null, tableName, select, null, order, orderBy, groupBy, null); /// /// 查询指定列 /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, string orderField, Expression> groupBy) => ListGet(null, tableName, select, null, orderField, groupBy, null); /// /// 查询指定列 /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> where, Expression> groupBy) => ListGet(storeName, tableName, select, where, null, null, groupBy, null); /// /// 查询指定列 /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy) => ListGet(null, tableName, select, where, order, orderBy, null, null); /// /// 查询指定列 /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> where, string orderField) => ListGet(null, tableName, select, where, orderField, null, null); /// /// 查询指定列 /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> order, DbEnum.OrderType? orderBy) => ListGet(storeName, tableName, select, null, order, orderBy, null, null); /// /// 查询指定列 /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, string orderField) => ListGet(storeName, tableName, select, null, orderField, null, null); /// /// 查询指定列 /// /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) => ListGet(null, null, select, where, order, orderBy, groupBy, having); /// /// 查询指定列 /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> where, string orderField, Expression> groupBy, Expression> having) => ListGet(null, null, select, where, orderField, groupBy, having); /// /// 查询指定列 /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) => ListGet(null, tableName, select, null, order, orderBy, groupBy, having); /// /// 查询指定列 /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, string orderField, Expression> groupBy, Expression> having) => ListGet(null, tableName, select, null, orderField, groupBy, having); /// /// 查询指定列 /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> where, Expression> groupBy, Expression> having) => ListGet(storeName, tableName, select, where, null, null, groupBy, having); /// /// 查询指定列 /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) => ListGet(null, tableName, select, where, order, orderBy, groupBy, null); /// /// 查询指定列 /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> where, string orderField, Expression> groupBy) => ListGet(null, tableName, select, where, orderField, groupBy, null); /// /// 查询指定列 /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) => ListGet(storeName, tableName, select, null, order, orderBy, groupBy, null); /// /// 查询指定列 /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, string orderField, Expression> groupBy) => ListGet(storeName, tableName, select, null, orderField, groupBy, null); /// /// 查询指定列 /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy) => ListGet(storeName, tableName, select, where, order, orderBy, null, null); /// /// 查询指定列 /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> where, string orderField) => ListGet(storeName, tableName, select, where, orderField, null, null); /// /// 查询指定列 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) => ListGet(null, tableName, select, where, order, orderBy, groupBy, having); /// /// 查询指定列 /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> where, string orderField, Expression> groupBy, Expression> having) => ListGet(null, tableName, select, where, orderField, groupBy, having); /// /// 查询指定列 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) => ListGet(storeName, tableName, select, null, order, orderBy, groupBy, having); /// /// 查询指定列 /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, string orderField, Expression> groupBy, Expression> having) => ListGet(storeName, tableName, select, null, orderField, groupBy, having); /// /// 查询指定列 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) => ListGet(storeName, tableName, select, where, order, orderBy, groupBy, null); /// /// 查询指定列 /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> where, string orderField, Expression> groupBy) => ListGet(storeName, tableName, select, where, orderField, groupBy, null); /// /// 查询指定列 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } if (order != null) { queryable = orderBy.HasValue ? queryable.OrderBy(order, (SqlSugar.OrderByType)orderBy) : queryable.OrderBy(order); } if (groupBy != null) { queryable = queryable.GroupBy(groupBy); } if (having != null) { queryable = queryable.Having(having); } return queryable.Select(select).ToList(); } /// /// 查询指定列 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> where, string orderField, Expression> groupBy, Expression> having) { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } if (!orderField.IsNullOrEmpty()) { queryable = queryable.OrderBy(orderField); } if (groupBy != null) { queryable = queryable.GroupBy(groupBy); } if (having != null) { queryable = queryable.Having(having); } return queryable.Select(select).ToList(); } #endregion #region 分页查询指定列 /// /// 分页查询指定列 /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, select, null, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, select, null, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> where, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, select, where, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, select, null, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, select, null, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> where, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, select, where, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, select, null, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, select, null, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> where, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, select, where, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, Expression> select, string tableName, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, select, null, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> where, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, select, where, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, select, null, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, select, null, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> where, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, select, where, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, select, null, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, select, where, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, select, null, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> where, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, select, where, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, select, null, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> where, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, select, where, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, select, null, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, select, where, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, select, null, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> where, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, select, where, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, select, where, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, select, null, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, null, select, where, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, select, null, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> where, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, select, where, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, select, where, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, select, null, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, select, where, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(null, tableName, select, where, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, select, null, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) => ListPageGet(storeName, tableName, select, where, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页查询指定列 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } if (order != null) { queryable = orderBy.HasValue ? queryable.OrderBy(order, (SqlSugar.OrderByType)orderBy) : queryable.OrderBy(order); } if (groupBy != null) { queryable = queryable.GroupBy(groupBy); } if (having != null) { queryable = queryable.Having(having); } return queryable.Select(select).ToPageList(pageIndex, pageSize, ref totalCount); } #endregion #region 联表查询指定列,简写 /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, null, null, null, groupBy, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> where) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, where, null, null, null, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, null, null, null, null, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, null, null, null, groupBy, having); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> where, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, where, null, null, groupBy, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, null, null, null, groupBy, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, null, order, orderBy, null, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> where) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, where, null, null, null, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, null, null, null, null, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, null, null, null, groupBy, having); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, where, null, null, groupBy, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, null, null, null, groupBy, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, where, order, orderBy, null, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, null, order, orderBy, null, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, where, null, null, null, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, null, order, orderBy, groupBy, having); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, where, null, null, groupBy, having); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, null, null, null, groupBy, having); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, where, order, orderBy, groupBy, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, null, order, orderBy, groupBy, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, where, null, null, groupBy, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, where, order, orderBy, null, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, null, order, orderBy, null, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, where, order, orderBy, groupBy, having); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, null, order, orderBy, groupBy, having); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, where, null, null, groupBy, having); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, where, order, orderBy, groupBy, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, null, order, orderBy, groupBy, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, where, order, orderBy, null, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, where, order, orderBy, groupBy, having); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, null, order, orderBy, groupBy, having); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, where, order, orderBy, groupBy, null); /// /// 联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(join); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } if (order != null) { queryable = orderBy.HasValue ? queryable.OrderBy(order, (SqlSugar.OrderByType)orderBy) : queryable.OrderBy(order); } if (groupBy != null) { queryable = queryable.GroupBy(groupBy); } if (having != null) { queryable = queryable.Having(having); } return queryable.Select(select).ToList(); } #endregion #region 联表查询指定列,自定义 /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, null, null, null, groupBy, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> where) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, where, null, null, null, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, null, null, null, null, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, null, null, null, groupBy, having); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> where, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, where, null, null, groupBy, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, null, null, null, groupBy, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, null, order, orderBy, null, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> where) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, where, null, null, null, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, null, null, null, null, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, null, null, null, groupBy, having); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, where, null, null, groupBy, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, null, null, null, groupBy, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, where, order, orderBy, null, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, null, order, orderBy, null, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, where, null, null, null, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, null, order, orderBy, groupBy, having); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, where, null, null, groupBy, having); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, null, null, null, groupBy, having); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, where, order, orderBy, groupBy, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, null, order, orderBy, groupBy, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, where, null, null, groupBy, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, where, order, orderBy, null, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, null, order, orderBy, null, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(null, null, select, join, where, order, orderBy, groupBy, having); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, null, order, orderBy, groupBy, having); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, where, null, null, groupBy, having); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, where, order, orderBy, groupBy, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, null, order, orderBy, groupBy, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, where, order, orderBy, null, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(null, tableName, select, join, where, order, orderBy, groupBy, having); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, null, order, orderBy, groupBy, having); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy) where T1 : class, new() where T2 : class, new() => ListGet(storeName, tableName, select, join, where, order, orderBy, groupBy, null); /// /// 联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having) where T1 : class, new() where T2 : class, new() { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(join); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } if (order != null) { queryable = orderBy.HasValue ? queryable.OrderBy(order, (SqlSugar.OrderByType)orderBy) : queryable.OrderBy(order); } if (groupBy != null) { queryable = queryable.GroupBy(groupBy); } if (having != null) { queryable = queryable.Having(having); } return queryable.Select(select).ToList(); } #endregion #region 分页联表查询指定列,简写 /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, Expression> select, Expression> join, string tableName, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, where, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, where, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, where, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, where, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, where, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,简写 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(join); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } if (order != null) { queryable = orderBy.HasValue ? queryable.OrderBy(order, (SqlSugar.OrderByType)orderBy) : queryable.OrderBy(order); } if (groupBy != null) { queryable = queryable.GroupBy(groupBy); } if (having != null) { queryable = queryable.Having(having); } return queryable.Select(select).ToPageList(pageIndex, pageSize, ref totalCount); } #endregion #region 分页联表查询指定列,自定义 /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, Expression> select, Expression> join, string tableName, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, where, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, where, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, where, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, where, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, where, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(join); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } if (order != null) { queryable = orderBy.HasValue ? queryable.OrderBy(order, (SqlSugar.OrderByType)orderBy) : queryable.OrderBy(order); } if (groupBy != null) { queryable = queryable.GroupBy(groupBy); } if (having != null) { queryable = queryable.Having(having); } return queryable.Select(select).ToPageList(pageIndex, pageSize, ref totalCount); } #endregion #region 分页三表联表查询指定列,自定义 /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, Expression> select, Expression> join, string tableName, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, where, null, null, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, null, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, where, null, null, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, null, select, join, where, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, null, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, where, null, null, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, where, order, orderBy, null, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(null, tableName, select, join, where, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, null, order, orderBy, groupBy, having, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() => ListPageGet(storeName, tableName, select, join, where, order, orderBy, groupBy, null, pageIndex, pageSize, ref totalCount); /// /// 分页三表联表查询指定列,自定义 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public virtual List ListPageGet(string storeName, string tableName, Expression> select, Expression> join, Expression> where, Expression> order, DbEnum.OrderType? orderBy, Expression> groupBy, Expression> having, int pageIndex, int pageSize, ref int totalCount) where T1 : class, new() where T2 : class, new() { ChangeDatabaseIf(storeName); var queryable = Db.Queryable(join); if (!tableName.IsNullOrEmpty()) { queryable = queryable.AS(tableName); } if (where != null) { queryable = queryable.Where(where); } if (order != null) { queryable = orderBy.HasValue ? queryable.OrderBy(order, (SqlSugar.OrderByType)orderBy) : queryable.OrderBy(order); } if (groupBy != null) { queryable = queryable.GroupBy(groupBy); } if (having != null) { queryable = queryable.Having(having); } return queryable.Select(select).ToPageList(pageIndex, pageSize, ref totalCount); } #endregion /// /// Update函数 /// /// /// /// /// public virtual int Update(T t, Expression> update, Expression> where) => Update(t, null, null, update, where); /// /// Update函数 /// /// /// /// /// /// public virtual int Update(T t, string tableName, Expression> update, Expression> where) => Update(t, null, tableName, update, where); /// /// Update函数 /// /// /// /// /// /// /// public virtual int Update(T t, string storeName, string tableName, Expression> update, Expression> where) { ChangeDatabaseIf(storeName); var updateable = Db.Updateable(t); if (!tableName.IsNullOrEmpty()) { updateable = updateable.AS(tableName); } if (update != null) { updateable = updateable.UpdateColumns(update); } if (where != null) { updateable = updateable.Where(where); } return updateable.ExecuteCommand(); } /// /// Update函数 /// /// /// /// public virtual int Update(Expression> set, Expression> where) => Update(null, null, set, where); /// /// Update函数 /// /// /// /// /// public virtual int Update(string tableName, Expression> set, Expression> where) => Update(null, tableName, set, where); /// /// Update函数 /// /// /// /// /// /// public virtual int Update(string storeName, string tableName, Expression> set, Expression> where) { ChangeDatabaseIf(storeName); var updateable = Db.Updateable().SetColumns(set); if (!tableName.IsNullOrEmpty()) { updateable = updateable.AS(tableName); } if (where != null) { updateable = updateable.Where(where); } return updateable.ExecuteCommand(); } /// /// Delete函数 /// /// /// public virtual bool Delete(long id) => DeleteReturnCommand(null, null, id) > 0; /// /// Delete函数 /// /// /// /// public virtual bool Delete(string tableName, long id) => DeleteReturnCommand(null, tableName, id) > 0; /// /// Delete函数 /// /// /// /// /// public virtual bool Delete(string storeName, string tableName, long id) => DeleteReturnCommand(storeName, tableName, id) > 0; /// /// Delete函数 /// /// /// /// /// public virtual int DeleteReturnCommand(string storeName, string tableName, long id) { ChangeDatabaseIf(storeName); var deleteable = Db.Deleteable(); if (!tableName.IsNullOrEmpty()) { deleteable = deleteable.AS(tableName); } return deleteable.In(id).ExecuteCommand(); } /// /// Delete函数 /// /// /// /// /// public virtual int DeleteRange(string storeName, string tableName, IEnumerable id) { ChangeDatabaseIf(storeName); var deleteable = Db.Deleteable(); if (!tableName.IsNullOrEmpty()) { deleteable = deleteable.AS(tableName); } return deleteable.In(id.ToList()).ExecuteCommand(); } /// /// Delete函数 /// /// /// public virtual bool Delete(string id) => DeleteReturnCommand(id, null, null) > 0; /// /// Delete函数 /// /// /// /// public virtual bool Delete(string tableName, string id) => DeleteReturnCommand(null, tableName, id) > 0; /// /// Delete函数 /// /// /// /// /// public virtual bool Delete(string storeName, string tableName, string id) => DeleteReturnCommand(storeName, tableName, id) > 0; /// /// Delete函数,返回行数结果 /// /// /// /// /// public virtual int DeleteReturnCommand(string storeName, string tableName, string id) { ChangeDatabaseIf(storeName); var deleteable = Db.Deleteable(); if (!tableName.IsNullOrEmpty()) { deleteable = deleteable.AS(tableName); } return deleteable.In(id).ExecuteCommand(); } /// /// Delete函数 /// /// /// /// /// public virtual int DeleteRange(string storeName, string tableName, IEnumerable id) { ChangeDatabaseIf(storeName); var deleteable = Db.Deleteable(); if (!tableName.IsNullOrEmpty()) { deleteable = deleteable.AS(tableName); } return deleteable.In(id.ToList()).ExecuteCommand(); } /// /// Delete函数 /// /// /// public virtual int Delete(Expression> where) => Delete(null, null, where); /// /// Delete函数 /// /// /// /// public virtual int Delete(string tableName, Expression> where) => Delete(null, tableName, where); /// /// Delete函数 /// /// /// /// /// public virtual int Delete(string storeName, string tableName, Expression> where) { ChangeDatabaseIf(storeName); var deleteable = Db.Deleteable(); if (!tableName.IsNullOrEmpty()) { deleteable = deleteable.AS(tableName); } return deleteable.Where(where).ExecuteCommand(); } /// /// Insert函数 /// /// /// public virtual bool Insert(T t) => Insert(null, null, t, null, null) > 0; /// /// Insert函数 /// /// /// /// public virtual bool Insert(string tableName, T t) => Insert(null, tableName, t, null, null) > 0; /// /// Insert函数 /// /// /// /// /// public virtual bool Insert(string storeName, string tableName, T t) => Insert(storeName, tableName, t, null, null) > 0; /// /// Insert函数 /// /// /// public virtual T InsertReturnEntity(T t) => InsertReturnEntity(null, null, t, null, null); /// /// Insert函数 /// /// /// /// public virtual T InsertReturnEntity(string tableName, T t) => InsertReturnEntity(null, tableName, t, null, null); /// /// Insert函数 /// /// /// /// /// public virtual T InsertReturnEntity(string storeName, string tableName, T t) => InsertReturnEntity(storeName, tableName, t, null, null); /// /// Insert函数 /// /// /// /// /// /// /// public virtual int Insert(string storeName, string tableName, T t, Expression> insertColumns, Expression> ignoreColumns) { ChangeDatabaseIf(storeName); var insertable = Db.Insertable(t); if (!tableName.IsNullOrEmpty()) { insertable = insertable.AS(tableName); } if (insertColumns != null) { insertable = insertable.InsertColumns(insertColumns); } if (ignoreColumns != null) { insertable = insertable.IgnoreColumns(ignoreColumns); } else { insertable = insertable.IgnoreColumns(true); } return insertable.ExecuteCommand(); } /// /// Insert函数 /// /// /// /// /// /// /// public virtual T InsertReturnEntity(string storeName, string tableName, T t, Expression> insertColumns, Expression> ignoreColumns) { ChangeDatabaseIf(storeName); var insertable = Db.Insertable(t); if (!tableName.IsNullOrEmpty()) { insertable = insertable.AS(tableName); } if (insertColumns != null) { insertable = insertable.InsertColumns(insertColumns); } if (ignoreColumns != null) { insertable = insertable.IgnoreColumns(ignoreColumns); } else { insertable = insertable.IgnoreColumns(true); } return insertable.ExecuteReturnEntity(); } /// /// Insert函数 /// /// /// /// /// /// /// public virtual int InsertRange(string storeName, string tableName, IEnumerable t, Expression> insertColumns, Expression> ignoreColumns) { ChangeDatabaseIf(storeName); var insertable = Db.Insertable(t.ToList()); if (!tableName.IsNullOrEmpty()) { insertable = insertable.AS(tableName); } if (insertColumns != null) { insertable = insertable.InsertColumns(insertColumns); } if (ignoreColumns != null) { insertable = insertable.IgnoreColumns(ignoreColumns); } return insertable.ExecuteCommand(); } /// /// Insert函数 /// /// 实体集合 /// public virtual int InsertRange(IEnumerable t) => InsertRange(null, null, t, null, null); /// /// Insert函数 /// /// 表名 /// 实体集合 /// public virtual int InsertRange(string tableName, IEnumerable t) => InsertRange(null, tableName, t, null, null); /// /// Insert函数 /// /// 库名 /// 表名 /// 实体集合 /// public virtual int InsertRange(string storeName, string tableName, IEnumerable t) => InsertRange(storeName, tableName, t, null, null); /// /// Insert函数 /// /// 实体集合 /// 插入列 /// public virtual int InsertRange(IEnumerable t, Expression> insertColumns) => InsertRange(null, null, t, insertColumns, null); /// /// Insert函数 /// /// 表名 /// 实体集合 /// 插入列 /// public virtual int InsertRange(string tableName, IEnumerable t, Expression> insertColumns) => InsertRange(null, tableName, t, insertColumns, null); /// /// Insert函数 /// /// 库名 /// 表名 /// 实体集合 /// 插入列 /// public virtual int InsertRange(string storeName, string tableName, IEnumerable t, Expression> insertColumns) => InsertRange(storeName, tableName, t, insertColumns, null); /// /// Insert函数 /// /// 实体集合 /// 插入列 /// 忽略列 /// public virtual int InsertRange(IEnumerable t, Expression> insertColumns, Expression> ignoreColumns) => InsertRange(null, null, t, insertColumns, ignoreColumns); /// /// Insert函数 /// /// 表名 /// 实体集合 /// 插入列 /// 忽略列 /// public virtual int InsertRange(string tableName, IEnumerable t, Expression> insertColumns, Expression> ignoreColumns) => InsertRange(null, tableName, t, insertColumns, ignoreColumns); /// /// 执行sql /// /// 库名 /// sql语句 /// 参数 /// 影响行数 public virtual int ExecuteCommand(string storeName, string sql, object parameters) { ChangeDatabaseIf(storeName); return Db.Ado.ExecuteCommand(sql, parameters); } /// /// 执行sql /// /// sql语句 /// 参数 /// 影响行数 public virtual int ExecuteCommand(string sql, object parameters) => ExecuteCommand(null, sql, parameters); /// /// 执行sql /// /// 库名 /// sql语句 /// 可变参数 /// 影响行数 public virtual int ExecuteCommand(string storeName, string sql, params SqlSugar.SugarParameter[] parameters) { ChangeDatabaseIf(storeName); return Db.Ado.ExecuteCommand(sql, parameters); } /// /// 执行sql /// /// sql语句 /// 可变参数 /// 影响行数 public virtual int ExecuteCommand(string sql, params SqlSugar.SugarParameter[] parameters) => ExecuteCommand(null, sql, parameters); /// /// 执行sql /// /// 库名 /// sql语句 /// 参数集合 /// 影响行数 public virtual int ExecuteCommand(string storeName, string sql, List parameters) { ChangeDatabaseIf(storeName); return Db.Ado.ExecuteCommand(sql, parameters); } /// /// 执行sql /// /// sql语句 /// 参数集合 /// 影响行数 public virtual int ExecuteCommand(string sql, List parameters) => ExecuteCommand(null, sql, parameters); /// /// sql查询 /// /// 结果类型 /// 库名 /// sql语句 /// 参数 /// 结果类型集合 public virtual List SqlQuery(string storeName, string sql, object parameters) { ChangeDatabaseIf(storeName); return Db.Ado.SqlQuery(sql, parameters); } /// /// sql查询 /// /// 结果类型 /// sql语句 /// 参数 /// 结果类型集合 public virtual List SqlQuery(string sql, object parameters) => SqlQuery(null, sql, parameters); /// /// sql查询 /// /// 结果类型 /// 库名 /// sql语句 /// 可变参数 /// 结果类型集合 public virtual List SqlQuery(string storeName, string sql, params SqlSugar.SugarParameter[] parameters) { ChangeDatabaseIf(storeName); return Db.Ado.SqlQuery(sql, parameters); } /// /// sql查询 /// /// 结果类型 /// sql语句 /// 可变参数 /// 结果类型集合 public virtual List SqlQuery(string sql, params SqlSugar.SugarParameter[] parameters) => SqlQuery(null, sql, parameters); /// /// 执行sql /// /// 库名 /// sql语句 /// 参数集合 /// 影响行数 public virtual List SqlQuery(string storeName, string sql, List parameters) { ChangeDatabaseIf(storeName); return Db.Ado.SqlQuery(sql, parameters); } /// /// 执行sql /// /// sql语句 /// 参数集合 /// 影响行数 public virtual List SqlQuery(string sql, List parameters) => SqlQuery(null, sql, parameters); /// /// sql分页查询 /// /// 结果类型 /// 库名 /// sql语句 /// 页码 /// 页大小 /// 总数 /// 参数 /// 结果类型集合 public virtual List SqlQuery(string storeName, string sql, int pageIndex, int pageSize, ref int totalCount, params SqlSugar.SugarParameter[] parameters) where TResult : class, new() { ChangeDatabaseIf(storeName); return Db.SqlQueryable(sql).AddParameters(parameters).ToPageList(pageIndex, pageSize, ref totalCount); } /// /// sql分页查询 /// /// 结果类型 /// sql语句 /// 页码 /// 页大小 /// 总数 /// 参数 /// 结果类型集合 public virtual List SqlQuery(string sql, int pageIndex, int pageSize, ref int totalCount, params SqlSugar.SugarParameter[] parameters) where TResult : class, new() => SqlQuery(null, sql, pageIndex, pageSize, ref totalCount, parameters); /// /// sql分页查询 /// /// 结果类型 /// 库名 /// sql语句 /// 页码 /// 页大小 /// 总数 /// 参数 /// 结果类型集合 public virtual List SqlQuery(string storeName, string sql, int pageIndex, int pageSize, ref int totalCount, object parameters) where TResult : class, new() { ChangeDatabaseIf(storeName); return Db.SqlQueryable(sql).AddParameters(parameters).ToPageList(pageIndex, pageSize, ref totalCount); } /// /// sql分页查询 /// /// 结果类型 /// sql语句 /// 页码 /// 页大小 /// 总数 /// 参数 /// 结果类型集合 public virtual List SqlQuery(string sql, int pageIndex, int pageSize, ref int totalCount, object parameters) where TResult : class, new() => SqlQuery(null, sql, pageIndex, pageSize, ref totalCount, parameters); /// /// sql分页查询 /// /// 结果类型 /// 库名 /// sql语句 /// 页码 /// 页大小 /// 总数 /// 参数 /// 结果类型集合 public virtual List SqlQuery(string storeName, string sql, int pageIndex, int pageSize, ref int totalCount, List parameters) where TResult : class, new() { ChangeDatabaseIf(storeName); return Db.SqlQueryable(sql).AddParameters(parameters).ToPageList(pageIndex, pageSize, ref totalCount); } /// /// sql分页查询 /// /// 结果类型 /// sql语句 /// 页码 /// 页大小 /// 总数 /// 参数 /// 结果类型集合 public virtual List SqlQuery(string sql, int pageIndex, int pageSize, ref int totalCount, List parameters) where TResult : class, new() => SqlQuery(null, sql, pageIndex, pageSize, ref totalCount, parameters); /// /// 使用事务 /// /// 执行委托 /// public virtual SqlSugar.DbResult UseTran(Action action) => UseTran(action, null); /// /// 使用事务 /// /// 执行委托 /// 错误回调委托 /// public virtual SqlSugar.DbResult UseTran(Action action, Action errorCallBack) { var result = new SqlSugar.DbResult(); try { Db.BeginTran(); action?.Invoke(); Db.CommitTran(); result.Data = result.IsSuccess = true; } catch (Exception ex) { result.ErrorException = ex; result.ErrorMessage = ex.Message; result.IsSuccess = false; Db.RollbackTran(); errorCallBack?.Invoke(ex); } return result; } private void ChangeDatabaseIf(string storeName) { if (!storeName.IsNullOrEmpty()) { Db.ChangeDatabase(storeName); } } private void UnitTest() { //参数化执行SQL 三种写法 //第一种 int command1 = ExecuteCommand("select * from \"order\" where @id>0 or name=@name", new { id = 1, name = "2" }); //第二种 var p1 = new SqlSugar.SugarParameter("@id", 1); var p2 = new SqlSugar.SugarParameter("@name", "2"); int command2 = ExecuteCommand("select * from \"order\" where @id>0 or name=@name", p1, p2); //第三种 var pList = new List() { new SqlSugar.SugarParameter("@id", 1), new SqlSugar.SugarParameter("@name", "2") }; int command3 = ExecuteCommand("select * from \"order\" where @id>0 or name=@name", pList); //SQL参数化查询 三种写法 //第一种 //List orderList1 = SqlQuery("select * from \"order\" where @id>0 or name=@name", new { id = 1, name = "2" }); var idList1 = SqlQuery("select id from \"order\" where @id>0 or name=@name", new { id = 1, name = "2" }); //第二种 var p3 = new SqlSugar.SugarParameter("@id", 1); var p4 = new SqlSugar.SugarParameter("@name", "2"); //List orderList2 = SqlQuery("select * from \"order\" where @id>0 or name=@name", p3, p4); var idList2 = SqlQuery("select id from \"order\" where @id>0 or name=@name", p3, p4); //第三种 var queryParamList = new List() { new SqlSugar.SugarParameter("@id", 1), new SqlSugar.SugarParameter("@name", "2") }; //List orderList3 = SqlQuery("select * from \"order\" where @id>0 or name=@name", queryParamList); var idList3 = SqlQuery("select id from \"order\" where @id>0 or name=@name", queryParamList); //分页查询 返回动态类型 int totalCount = 0; var pageList1 = SqlQuery("select id from order", 1, 10, ref totalCount); //分页查询 返回指定类型 //var pageList2 = SqlQuery("select id from order", 1, 10, ref totalCount); } } }