diff --git a/CoreCms.Net.IRepository/Good/ICoreCmsGoodsRepository.cs b/CoreCms.Net.IRepository/Good/ICoreCmsGoodsRepository.cs index 5dadb01a..5327b1a5 100644 --- a/CoreCms.Net.IRepository/Good/ICoreCmsGoodsRepository.cs +++ b/CoreCms.Net.IRepository/Good/ICoreCmsGoodsRepository.cs @@ -142,13 +142,11 @@ namespace CoreCms.Net.IRepository /// 重写根据条件及自定义排序查询分页数据(返回DTO) /// /// - /// /// 当前页面索引 /// 分布大小 /// 是否使用WITH(NOLOCK) /// - Task> QueryPageByDTOAsync(Expression> predicate, - string orderBy = "", int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false); + Task> QueryPageByDTOAsync(Expression> predicate, int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false); /// @@ -160,8 +158,7 @@ namespace CoreCms.Net.IRepository /// 分布大小 /// 是否使用WITH(NOLOCK) /// - Task> QueryAgentGoodsPageAsync(Expression> predicate, - string orderBy = "", int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false); + Task> QueryAgentGoodsPageAsync(Expression> predicate, int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false); diff --git a/CoreCms.Net.IRepository/IBaseRepository.cs b/CoreCms.Net.IRepository/IBaseRepository.cs index 9c20039c..3a4c84e8 100644 --- a/CoreCms.Net.IRepository/IBaseRepository.cs +++ b/CoreCms.Net.IRepository/IBaseRepository.cs @@ -104,51 +104,6 @@ namespace CoreCms.Net.IRepository /// Task> QueryAsync(bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - /// - /// 根据条件查询数据 - /// - /// 条件 - /// 排序 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// 泛型实体集合 - List QueryListByClause(string strWhere, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - - /// - /// 根据条件查询数据 - /// - /// 条件 - /// 排序 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// 泛型实体集合 - Task> QueryListByClauseAsync(string strWhere, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - - /// - /// 根据条件查询数据 - /// - /// 条件表达式树 - /// 排序 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// 泛型实体集合 - List QueryListByClause(Expression> predicate, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - - /// - /// 根据条件查询数据 - /// - /// 条件表达式树 - /// 排序 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// 泛型实体集合 - Task> QueryListByClauseAsync(Expression> predicate, string orderBy = "", - bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - /// /// 根据条件查询数据 /// @@ -159,8 +114,8 @@ namespace CoreCms.Net.IRepository /// 是否启用缓存 /// 缓存时长(分钟) /// 泛型实体集合 - List QueryListByClause(Expression> predicate, Expression> orderByPredicate, - OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); + List QueryListByClause(Expression> predicate, Expression> orderByPredicate = null, + OrderByType orderByType = OrderByType.Asc, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); /// /// 根据条件查询数据 @@ -173,7 +128,7 @@ namespace CoreCms.Net.IRepository /// 缓存时长(分钟) /// 泛型实体集合 Task> QueryListByClauseAsync(Expression> predicate, - Expression> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); + Expression> orderByPredicate = null, OrderByType orderByType=OrderByType.Asc, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); /// /// 根据条件查询一定数量数据 @@ -203,32 +158,6 @@ namespace CoreCms.Net.IRepository Task> QueryListByClauseAsync(Expression> predicate, int take, Expression> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - /// - /// 根据条件查询一定数量数据 - /// - /// 条件表达式树 - /// 获取数量 - /// 排序字段,如name asc,age desc - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - List QueryListByClause(Expression> predicate, int take, string strOrderByFields = "", - bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - - /// - /// 根据条件查询一定数量数据 - /// - /// 条件表达式树 - /// 获取数量 - /// 排序字段,如name asc,age desc - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - Task> QueryListByClauseAsync(Expression> predicate, int take, - string strOrderByFields = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - /// /// 根据条件查询数据 /// @@ -394,40 +323,6 @@ namespace CoreCms.Net.IRepository /// Task UpdateAsync(T entity, bool isRemoveDataCache = false); - /// - /// 根据手写条件更新 - /// - /// - /// - /// 是否清除缓存 - /// - bool Update(T entity, string strWhere, bool isRemoveDataCache = false); - - /// - /// 根据手写条件更新 - /// - /// - /// - /// 是否清除缓存 - /// - Task UpdateAsync(T entity, string strWhere, bool isRemoveDataCache = false); - - /// - /// 根据手写sql语句更新数据 - /// - /// - /// - /// - bool Update(string strSql, SugarParameter[] parameters = null); - - /// - /// 根据手写sql语句更新数据 - /// - /// - /// - /// - Task UpdateAsync(string strSql, SugarParameter[] parameters = null); - /// /// 更新某个字段 /// @@ -446,28 +341,6 @@ namespace CoreCms.Net.IRepository /// Task UpdateAsync(Expression> columns, Expression> where, bool isRemoveDataCache = false); - /// - /// 根据条件更新 - /// - /// - /// - /// - /// - /// 是否清除缓存 - /// - Task UpdateAsync(T entity, List lstColumns, List lstIgnoreColumns, - string strWhere = "", bool isRemoveDataCache = false); - - /// - /// 根据条件更新 - /// - /// - /// - /// - /// - /// 是否清除缓存 - /// - bool Update(T entity, List lstColumns, List lstIgnoreColumns, string strWhere = "", bool isRemoveDataCache = false); #endregion #region 删除数据 @@ -778,33 +651,6 @@ namespace CoreCms.Net.IRepository #endregion #region 分页查询 - - /// - /// 根据条件查询分页数据 - /// - /// - /// - /// 当前页面索引 - /// 分布大小 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - IPageList QueryPage(Expression> predicate, string orderBy = "", int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - - /// - /// 根据条件查询分页数据 - /// - /// - /// - /// 当前页面索引 - /// 分布大小 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - Task> QueryPageAsync(Expression> predicate, string orderBy = "", int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - /// /// 根据条件查询分页数据 /// diff --git a/CoreCms.Net.IServices/Good/ICoreCmsGoodsServices.cs b/CoreCms.Net.IServices/Good/ICoreCmsGoodsServices.cs index 0fce15bb..fc60ec77 100644 --- a/CoreCms.Net.IServices/Good/ICoreCmsGoodsServices.cs +++ b/CoreCms.Net.IServices/Good/ICoreCmsGoodsServices.cs @@ -206,13 +206,11 @@ namespace CoreCms.Net.IServices /// 重写根据条件及自定义排序查询分页数据(返回DTO) /// /// - /// /// 当前页面索引 /// 分布大小 /// 是否使用WITH(NOLOCK) /// - Task> QueryPageByDTOAsync(Expression> predicate, - string orderBy = "", int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false); + Task> QueryPageByDTOAsync(Expression> predicate, int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false); /// /// 重写根据条件及自定义排序查询分页数据 @@ -223,8 +221,7 @@ namespace CoreCms.Net.IServices /// 分布大小 /// 是否使用WITH(NOLOCK) /// - Task> QueryAgentGoodsPageAsync(Expression> predicate, - string orderBy = "", int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false); + Task> QueryAgentGoodsPageAsync(Expression> predicate, int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false); /// diff --git a/CoreCms.Net.IServices/IBaseServices.cs b/CoreCms.Net.IServices/IBaseServices.cs index c3feca67..474a6654 100644 --- a/CoreCms.Net.IServices/IBaseServices.cs +++ b/CoreCms.Net.IServices/IBaseServices.cs @@ -105,51 +105,6 @@ namespace CoreCms.Net.IServices /// Task> QueryAsync(bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - /// - /// 根据条件查询数据 - /// - /// 条件 - /// 排序 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// 泛型实体集合 - List QueryListByClause(string strWhere, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - - /// - /// 根据条件查询数据 - /// - /// 条件 - /// 排序 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// 泛型实体集合 - Task> QueryListByClauseAsync(string strWhere, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - - /// - /// 根据条件查询数据 - /// - /// 条件表达式树 - /// 排序 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// 泛型实体集合 - List QueryListByClause(Expression> predicate, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - - /// - /// 根据条件查询数据 - /// - /// 条件表达式树 - /// 排序 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// 泛型实体集合 - Task> QueryListByClauseAsync(Expression> predicate, string orderBy = "", - bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - /// /// 根据条件查询数据 /// @@ -160,8 +115,8 @@ namespace CoreCms.Net.IServices /// 是否启用缓存 /// 缓存时长(分钟) /// 泛型实体集合 - List QueryListByClause(Expression> predicate, Expression> orderByPredicate, - OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); + List QueryListByClause(Expression> predicate, Expression> orderByPredicate = null, + OrderByType orderByType = OrderByType.Asc, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); /// /// 根据条件查询数据 @@ -174,7 +129,7 @@ namespace CoreCms.Net.IServices /// 缓存时长(分钟) /// 泛型实体集合 Task> QueryListByClauseAsync(Expression> predicate, - Expression> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); + Expression> orderByPredicate = null, OrderByType orderByType = OrderByType.Asc, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); /// /// 根据条件查询一定数量数据 @@ -204,32 +159,6 @@ namespace CoreCms.Net.IServices Task> QueryListByClauseAsync(Expression> predicate, int take, Expression> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - /// - /// 根据条件查询一定数量数据 - /// - /// 条件表达式树 - /// 获取数量 - /// 排序字段,如name asc,age desc - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - List QueryListByClause(Expression> predicate, int take, string strOrderByFields = "", - bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - - /// - /// 根据条件查询一定数量数据 - /// - /// 条件表达式树 - /// 获取数量 - /// 排序字段,如name asc,age desc - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - Task> QueryListByClauseAsync(Expression> predicate, int take, - string strOrderByFields = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - /// /// 根据条件查询数据 /// @@ -262,8 +191,7 @@ namespace CoreCms.Net.IServices /// 是否启用缓存 /// 缓存时长(分钟) /// - T QueryByClause(Expression> predicate, Expression> orderByPredicate, - OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); + T QueryByClause(Expression> predicate, Expression> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); /// /// 根据条件查询数据 @@ -282,7 +210,7 @@ namespace CoreCms.Net.IServices #endregion - #region 新闻数据 + #region 插入数据 /// /// 写入实体数据 @@ -396,40 +324,6 @@ namespace CoreCms.Net.IServices /// Task UpdateAsync(T entity, bool isRemoveDataCache = false); - /// - /// 根据手写条件更新 - /// - /// - /// - /// 是否清除缓存 - /// - bool Update(T entity, string strWhere, bool isRemoveDataCache = false); - - /// - /// 根据手写条件更新 - /// - /// - /// - /// 是否清除缓存 - /// - Task UpdateAsync(T entity, string strWhere, bool isRemoveDataCache = false); - - /// - /// 根据手写sql语句更新数据 - /// - /// - /// - /// - bool Update(string strSql, SugarParameter[] parameters = null); - - /// - /// 根据手写sql语句更新数据 - /// - /// - /// - /// - Task UpdateAsync(string strSql, SugarParameter[] parameters = null); - /// /// 更新某个字段 /// @@ -448,28 +342,6 @@ namespace CoreCms.Net.IServices /// Task UpdateAsync(Expression> columns, Expression> where, bool isRemoveDataCache = false); - /// - /// 根据条件更新 - /// - /// - /// - /// - /// - /// 是否清除缓存 - /// - Task UpdateAsync(T entity, List lstColumns, List lstIgnoreColumns, - string strWhere = "", bool isRemoveDataCache = false); - - /// - /// 根据条件更新 - /// - /// - /// - /// - /// - /// 是否清除缓存 - /// - bool Update(T entity, List lstColumns, List lstIgnoreColumns, string strWhere = "", bool isRemoveDataCache = false); #endregion #region 删除数据 @@ -602,7 +474,6 @@ namespace CoreCms.Net.IServices /// Task DeleteByIdsAsync(string[] ids, bool isRemoveDataCache = false); - /// /// 删除指定ID集合的数据(批量删除) /// @@ -619,7 +490,6 @@ namespace CoreCms.Net.IServices /// Task DeleteByIdsAsync(List ids, bool isRemoveDataCache = false); - /// /// 删除指定ID集合的数据(批量删除) /// @@ -636,7 +506,6 @@ namespace CoreCms.Net.IServices /// Task DeleteByIdsAsync(List ids, bool isRemoveDataCache = false); - /// /// 删除指定ID集合的数据(批量删除) /// @@ -653,7 +522,6 @@ namespace CoreCms.Net.IServices /// Task DeleteByIdsAsync(List ids, bool isRemoveDataCache = false); - /// /// 删除指定ID集合的数据(批量删除) /// @@ -781,32 +649,6 @@ namespace CoreCms.Net.IServices #region 分页查询 - /// - /// 根据条件查询分页数据 - /// - /// - /// - /// 当前页面索引 - /// 分布大小 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - IPageList QueryPage(Expression> predicate, string orderBy = "", int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - - /// - /// 根据条件查询分页数据 - /// - /// - /// - /// 当前页面索引 - /// 分布大小 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - Task> QueryPageAsync(Expression> predicate, string orderBy = "", int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue); - /// /// 根据条件查询分页数据 /// diff --git a/CoreCms.Net.Model/CoreCms.Net.Model.xml b/CoreCms.Net.Model/CoreCms.Net.Model.xml index c8d3ed3b..bdd98be2 100644 --- a/CoreCms.Net.Model/CoreCms.Net.Model.xml +++ b/CoreCms.Net.Model/CoreCms.Net.Model.xml @@ -9706,11 +9706,6 @@ 每页数据量 - - - 排序 - - 判断条件 @@ -9721,6 +9716,16 @@ 根据int类型id加where查询条件和order排序获取列表(一般用于直接id分页) + + + 其他数据 + + + + + 序列 + + 当前页码 @@ -9731,11 +9736,6 @@ 每页数据量 - - - 排序 - - 判断条件 @@ -9746,6 +9746,11 @@ 根据String类型id加where查询条件和order排序获取列表(一般用于直接id分页) + + + 序列 + + 当前页码 @@ -9756,21 +9761,16 @@ 每页数据量 - - - 排序 - - - - - 判断条件 - - 根据String类型id加where查询条件和order排序获取列表(一般用于直接id分页) + + + 序列 + + 当前页码 diff --git a/CoreCms.Net.Model/FromBody/FMPage.cs b/CoreCms.Net.Model/FromBody/FMPage.cs index 74e73491..ecadd235 100644 --- a/CoreCms.Net.Model/FromBody/FMPage.cs +++ b/CoreCms.Net.Model/FromBody/FMPage.cs @@ -26,11 +26,6 @@ namespace CoreCms.Net.Model.FromBody /// public int limit { get; set; } = 10; - /// - /// 排序 - /// - public string order { get; set; } - /// /// 判断条件 /// @@ -43,9 +38,14 @@ namespace CoreCms.Net.Model.FromBody /// public class FMPageByIntId { + /// + /// 其他数据 + /// public object otherData { get; set; } - + /// + /// 序列 + /// public int id { get; set; } @@ -59,11 +59,6 @@ namespace CoreCms.Net.Model.FromBody /// public int limit { get; set; } = 10; - /// - /// 排序 - /// - public string order { get; set; } - /// /// 判断条件 /// @@ -75,9 +70,11 @@ namespace CoreCms.Net.Model.FromBody /// public class FMPageByStringId { + /// + /// 序列 + /// public string id { get; set; } - /// /// 当前页码 /// @@ -87,16 +84,6 @@ namespace CoreCms.Net.Model.FromBody /// 每页数据量 /// public int limit { get; set; } = 10; - - /// - /// 排序 - /// - public string order { get; set; } - - /// - /// 判断条件 - /// - public string where { get; set; } } @@ -105,6 +92,9 @@ namespace CoreCms.Net.Model.FromBody /// public class FMPageByStringIdWhitStatus { + /// + /// 序列 + /// public string id { get; set; } /// diff --git a/CoreCms.Net.Repository/BaseRepository.cs b/CoreCms.Net.Repository/BaseRepository.cs index 30e47833..095f917a 100644 --- a/CoreCms.Net.Repository/BaseRepository.cs +++ b/CoreCms.Net.Repository/BaseRepository.cs @@ -139,82 +139,6 @@ namespace CoreCms.Net.Repository return await DbBaseClient.Queryable().WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).ToListAsync(); } - /// - /// 根据条件查询数据 - /// - /// 条件 - /// 排序字段,如name asc,age desc - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// 泛型实体集合 - public List QueryListByClause(string strWhere, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - return DbBaseClient.Queryable() - .OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy) - .WhereIF(!string.IsNullOrEmpty(strWhere), strWhere) - .WithNoLockOrNot(blUseNoLock) - .WithCacheIF(isDataCache, cacheTimes) - .ToList(); - } - - /// - /// 根据条件查询数据 - /// - /// 条件 - /// 排序字段,如name asc,age desc - /// 泛型实体集合 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - public async Task> QueryListByClauseAsync(string strWhere, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - return await DbBaseClient.Queryable() - .OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy) - .WhereIF(!string.IsNullOrEmpty(strWhere), strWhere) - .WithNoLockOrNot(blUseNoLock) - .WithCacheIF(isDataCache, cacheTimes) - .ToListAsync(); - } - - /// - /// 根据条件查询数据 - /// - /// 条件表达式树 - /// 排序字段,如name asc,age desc - /// 泛型实体集合 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - public List QueryListByClause(Expression> predicate, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - return DbBaseClient.Queryable() - .OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy) - .WhereIF(predicate != null, predicate) - .WithNoLockOrNot(blUseNoLock) - .WithCacheIF(isDataCache, cacheTimes) - .ToList(); - } - - /// - /// 根据条件查询数据 - /// - /// 条件表达式树 - /// 排序字段,如name asc,age desc - /// 泛型实体集合 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - public async Task> QueryListByClauseAsync(Expression> predicate, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - return await DbBaseClient.Queryable() - .OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy) - .WhereIF(predicate != null, predicate) - .WithNoLockOrNot(blUseNoLock) - .WithCacheIF(isDataCache, cacheTimes) - .ToListAsync(); - } - /// /// 根据条件查询数据 /// @@ -225,7 +149,7 @@ namespace CoreCms.Net.Repository /// 是否启用缓存 /// 缓存时长(分钟) /// 泛型实体集合 - public List QueryListByClause(Expression> predicate, Expression> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) + public List QueryListByClause(Expression> predicate, Expression> orderByPredicate = null, OrderByType orderByType = OrderByType.Asc, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) { return DbBaseClient.Queryable() .OrderByIF(orderByPredicate != null, orderByPredicate, orderByType) @@ -245,7 +169,7 @@ namespace CoreCms.Net.Repository /// 是否启用缓存 /// 缓存时长(分钟) /// 泛型实体集合 - public async Task> QueryListByClauseAsync(Expression> predicate, Expression> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) + public async Task> QueryListByClauseAsync(Expression> predicate, Expression> orderByPredicate = null, OrderByType orderByType = OrderByType.Asc, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) { return await DbBaseClient.Queryable() .OrderByIF(orderByPredicate != null, orderByPredicate, orderByType) @@ -299,48 +223,6 @@ namespace CoreCms.Net.Repository .ToListAsync(); } - /// - /// 根据条件查询一定数量数据 - /// - /// 条件表达式树 - /// 获取数量 - /// 排序字段,如name asc,age desc - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - public List QueryListByClause(Expression> predicate, int take, string strOrderByFields = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - return DbBaseClient.Queryable() - .OrderByIF(!string.IsNullOrEmpty(strOrderByFields), strOrderByFields) - .Where(predicate) - .Take(take) - .WithNoLockOrNot(blUseNoLock) - .WithCacheIF(isDataCache, cacheTimes) - .ToList(); - } - - /// - /// 根据条件查询一定数量数据 - /// - /// 条件表达式树 - /// 获取数量 - /// 排序字段,如name asc,age desc - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - public async Task> QueryListByClauseAsync(Expression> predicate, int take, string strOrderByFields = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - return await DbBaseClient.Queryable() - .OrderByIF(!string.IsNullOrEmpty(strOrderByFields), strOrderByFields) - .Where(predicate) - .Take(take) - .WithNoLockOrNot(blUseNoLock) - .WithCacheIF(isDataCache, cacheTimes) - .ToListAsync(); - } - /// /// 根据条件查询数据 /// @@ -597,54 +479,6 @@ namespace CoreCms.Net.Repository : await DbBaseClient.Updateable(entity).ExecuteCommandHasChangeAsync(); } - /// - /// 根据手写条件更新 - /// - /// 实体数据 - /// - /// 是否清除缓存 - /// - public bool Update(T entity, string strWhere, bool isRemoveDataCache = false) - { - return isRemoveDataCache ? DbBaseClient.Updateable(entity).Where(strWhere).RemoveDataCache().ExecuteCommandHasChange() : DbBaseClient.Updateable(entity).Where(strWhere).ExecuteCommandHasChange(); - } - - /// - /// 根据手写条件更新 - /// - /// 实体数据 - /// - /// 是否清除缓存 - /// - public async Task UpdateAsync(T entity, string strWhere, bool isRemoveDataCache = false) - { - return isRemoveDataCache - ? await DbBaseClient.Updateable(entity).Where(strWhere).RemoveDataCache().ExecuteCommandHasChangeAsync() - : await DbBaseClient.Updateable(entity).Where(strWhere).ExecuteCommandHasChangeAsync(); - } - - /// - /// 根据手写sql语句更新数据 - /// - /// - /// - /// - public bool Update(string strSql, SugarParameter[] parameters = null) - { - return DbBaseClient.Ado.ExecuteCommand(strSql, parameters) > 0; - } - - /// - /// 根据手写sql语句更新数据 - /// - /// - /// - /// - public async Task UpdateAsync(string strSql, SugarParameter[] parameters = null) - { - return await DbBaseClient.Ado.ExecuteCommandAsync(strSql, parameters) > 0; - } - /// /// 更新某个字段 /// @@ -672,45 +506,6 @@ namespace CoreCms.Net.Repository : await DbBaseClient.Updateable().SetColumns(columns).Where(where).ExecuteCommandHasChangeAsync(); } - /// - /// 根据条件更新 - /// - /// 实体数据 - /// - /// - /// - /// 是否清除缓存 - /// - public async Task UpdateAsync(T entity, List lstColumns, List lstIgnoreColumns, string strWhere = "", bool isRemoveDataCache = false) - { - var up = DbBaseClient.Updateable(entity); - if (lstIgnoreColumns != null && lstIgnoreColumns.Count > 0) up = up.IgnoreColumns(lstIgnoreColumns.ToArray()); - if (lstColumns is { Count: > 0 }) up = up.UpdateColumns(lstColumns.ToArray()); - if (!string.IsNullOrEmpty(strWhere)) up = up.Where(strWhere); - - return isRemoveDataCache - ? await up.RemoveDataCache().ExecuteCommandHasChangeAsync() - : await up.ExecuteCommandHasChangeAsync(); - } - - /// - /// 根据条件更新 - /// - /// 实体数据 - /// - /// - /// - /// 是否清除缓存 - /// - public bool Update(T entity, List lstColumns, List lstIgnoreColumns, string strWhere = "", bool isRemoveDataCache = false) - { - var up = DbBaseClient.Updateable(entity); - if (lstIgnoreColumns != null && lstIgnoreColumns.Count > 0) - up = up.IgnoreColumns(lstIgnoreColumns.ToArray()); - if (lstColumns != null && lstColumns.Count > 0) up = up.UpdateColumns(lstColumns.ToArray()); - if (!string.IsNullOrEmpty(strWhere)) up = up.Where(strWhere); - return isRemoveDataCache ? up.RemoveDataCache().ExecuteCommandHasChange() : up.ExecuteCommandHasChange(); - } #endregion #region 删除数据 @@ -1169,70 +964,6 @@ namespace CoreCms.Net.Repository #region 分页数据 - /// - /// 根据条件查询分页数据 - /// - /// - /// - /// 当前页面索引 - /// 分布大小 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - public IPageList QueryPage(Expression> predicate, string orderBy = "", int pageIndex = 1, - int pageSize = 20, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - var totalCount = 0; - - var page = blUseNoLock - ? DbBaseClient.Queryable() - .OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy) - .WhereIF(predicate != null, predicate) - .WithNoLockOrNot(blUseNoLock) - .WithCacheIF(isDataCache, cacheTimes) - .ToPageList(pageIndex, pageSize, ref totalCount) - : DbClient.Queryable() - .OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy) - .WhereIF(predicate != null, predicate) - .WithCacheIF(isDataCache, cacheTimes) - .ToPageList(pageIndex, pageSize, ref totalCount); - - var list = new PageList(page, pageIndex, pageSize, totalCount); - return list; - } - - /// - /// 根据条件查询分页数据 - /// - /// - /// - /// 当前页面索引 - /// 分布大小 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - public async Task> QueryPageAsync(Expression> predicate, string orderBy = "", - int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - RefAsync totalCount = 0; - var page = blUseNoLock - ? await DbBaseClient.Queryable() - .OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy) - .WhereIF(predicate != null, predicate) - .WithNoLockOrNot(blUseNoLock) - .WithCacheIF(isDataCache, cacheTimes) - .ToPageListAsync(pageIndex, pageSize, totalCount) - : await DbBaseClient.Queryable() - .OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy) - .WhereIF(predicate != null, predicate) - .WithCacheIF(isDataCache, cacheTimes) - .ToPageListAsync(pageIndex, pageSize, totalCount); - var list = new PageList(page, pageIndex, pageSize, totalCount); - return list; - } - /// /// 根据条件查询分页数据 /// diff --git a/CoreCms.Net.Repository/Good/CoreCmsGoodsRepository.cs b/CoreCms.Net.Repository/Good/CoreCmsGoodsRepository.cs index 234d764f..b83a13e3 100644 --- a/CoreCms.Net.Repository/Good/CoreCmsGoodsRepository.cs +++ b/CoreCms.Net.Repository/Good/CoreCmsGoodsRepository.cs @@ -193,7 +193,7 @@ namespace CoreCms.Net.Repository obj.points = p.points; obj.isDefalut = p.isDefalut; obj.isDel = false; - obj.images=p.images; + obj.images = p.images; products.Add(obj); var pd = new CoreCmsProductsDistribution(); @@ -1671,13 +1671,11 @@ namespace CoreCms.Net.Repository /// 重写根据条件及自定义排序查询分页数据(返回DTO) /// /// - /// /// 当前页面索引 /// 分布大小 /// 是否使用WITH(NOLOCK) /// - public async Task> QueryPageByDTOAsync(Expression> predicate, string orderBy = "", - int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false) + public async Task> QueryPageByDTOAsync(Expression> predicate, int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false) { RefAsync totalCount = 0; List page; @@ -1720,7 +1718,7 @@ namespace CoreCms.Net.Repository .With(SqlWith.NoLock) .MergeTable() .Where(predicate) - .OrderBy(orderBy) + .OrderBy(it => SqlFunc.Desc(it.isRecommend)).OrderBy(it => SqlFunc.Desc(it.isHot)) .ToPageListAsync(pageIndex, pageSize, totalCount); } else @@ -1761,7 +1759,7 @@ namespace CoreCms.Net.Repository }) .MergeTable() .Where(predicate) - .OrderBy(orderBy) + .OrderBy(it => SqlFunc.Desc(it.isRecommend)).OrderBy(it => SqlFunc.Desc(it.isHot)) .ToPageListAsync(pageIndex, pageSize, totalCount); } var list = new PageList(page, pageIndex, pageSize, totalCount); @@ -1783,7 +1781,7 @@ namespace CoreCms.Net.Repository /// 分布大小 /// 是否使用WITH(NOLOCK) /// - public async Task> QueryAgentGoodsPageAsync(Expression> predicate, string orderBy = "", + public async Task> QueryAgentGoodsPageAsync(Expression> predicate, int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false) { RefAsync totalCount = 0; @@ -1840,7 +1838,7 @@ namespace CoreCms.Net.Repository .With(SqlWith.NoLock) .MergeTable() .Where(predicate) - .OrderBy(orderBy) + .OrderBy(it => SqlFunc.Desc(it.isRecommend)).OrderBy(it => SqlFunc.Desc(it.isHot)) .ToPageListAsync(pageIndex, pageSize, totalCount); } else @@ -1894,7 +1892,7 @@ namespace CoreCms.Net.Repository }) .MergeTable() .Where(predicate) - .OrderBy(orderBy) + .OrderBy(it => SqlFunc.Desc(it.isRecommend)).OrderBy(it => SqlFunc.Desc(it.isHot)) .ToPageListAsync(pageIndex, pageSize, totalCount); } var list = new PageList(page, pageIndex, pageSize, totalCount); diff --git a/CoreCms.Net.Services/BaseServices.cs b/CoreCms.Net.Services/BaseServices.cs index 52ce222b..4571d4f6 100644 --- a/CoreCms.Net.Services/BaseServices.cs +++ b/CoreCms.Net.Services/BaseServices.cs @@ -130,62 +130,6 @@ namespace CoreCms.Net.Services return await BaseDal.QueryAsync(blUseNoLock, isDataCache, cacheTimes); } - /// - /// 根据条件查询数据 - /// - /// 条件 - /// 排序字段,如name asc,age desc - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// 泛型实体集合 - public List QueryListByClause(string strWhere, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - return BaseDal.QueryListByClause(strWhere, orderBy, blUseNoLock, isDataCache, cacheTimes); - } - - /// - /// 根据条件查询数据 - /// - /// 条件 - /// 排序字段,如name asc,age desc - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// 泛型实体集合 - public async Task> QueryListByClauseAsync(string strWhere, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - return await BaseDal.QueryListByClauseAsync(strWhere, orderBy, blUseNoLock, isDataCache, cacheTimes); - } - - /// - /// 根据条件查询数据 - /// - /// 条件表达式树 - /// 排序字段,如name asc,age desc - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// 泛型实体集合 - public List QueryListByClause(Expression> predicate, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - return BaseDal.QueryListByClause(predicate, orderBy, blUseNoLock, isDataCache, cacheTimes); - } - - /// - /// 根据条件查询数据 - /// - /// 条件表达式树 - /// 排序字段,如name asc,age desc - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// 泛型实体集合 - public async Task> QueryListByClauseAsync(Expression> predicate, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - return await BaseDal.QueryListByClauseAsync(predicate, orderBy, blUseNoLock, isDataCache, cacheTimes); - } - /// /// 根据条件查询数据 /// @@ -196,7 +140,7 @@ namespace CoreCms.Net.Services /// 是否启用缓存 /// 缓存时长(分钟) /// 泛型实体集合 - public List QueryListByClause(Expression> predicate, Expression> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) + public List QueryListByClause(Expression> predicate, Expression> orderByPredicate = null, OrderByType orderByType = OrderByType.Asc, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) { return BaseDal.QueryListByClause(predicate, orderByPredicate, orderByType, blUseNoLock, isDataCache, cacheTimes); } @@ -211,7 +155,7 @@ namespace CoreCms.Net.Services /// 是否启用缓存 /// 缓存时长(分钟) /// 泛型实体集合 - public async Task> QueryListByClauseAsync(Expression> predicate, Expression> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) + public async Task> QueryListByClauseAsync(Expression> predicate, Expression> orderByPredicate = null, OrderByType orderByType = OrderByType.Asc, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) { return await BaseDal.QueryListByClauseAsync(predicate, orderByPredicate, orderByType, blUseNoLock, isDataCache, cacheTimes); } @@ -248,36 +192,6 @@ namespace CoreCms.Net.Services return await BaseDal.QueryListByClauseAsync(predicate, take, orderByPredicate, orderByType, blUseNoLock, isDataCache, cacheTimes); } - /// - /// 根据条件查询一定数量数据 - /// - /// 条件表达式树 - /// 获取数量 - /// 排序字段,如name asc,age desc - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - public List QueryListByClause(Expression> predicate, int take, string strOrderByFields = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - return BaseDal.QueryListByClause(predicate, take, strOrderByFields, blUseNoLock, isDataCache, cacheTimes); - } - - /// - /// 根据条件查询一定数量数据 - /// - /// 条件表达式树 - /// 获取数量 - /// 排序字段,如name asc,age desc - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - public async Task> QueryListByClauseAsync(Expression> predicate, int take, string strOrderByFields = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - return await BaseDal.QueryListByClauseAsync(predicate, take, strOrderByFields, blUseNoLock, isDataCache, cacheTimes); - } - /// /// 根据条件查询数据 /// @@ -494,52 +408,6 @@ namespace CoreCms.Net.Services return await BaseDal.UpdateAsync(entity, isRemoveDataCache); } - /// - /// 根据手写条件更新 - /// - /// - /// - /// - /// - public bool Update(T entity, string strWhere, bool isRemoveDataCache = false) - { - return BaseDal.Update(entity, strWhere, isRemoveDataCache); - } - - /// - /// 根据手写条件更新 - /// - /// - /// - /// - /// - public async Task UpdateAsync(T entity, string strWhere, bool isRemoveDataCache = false) - { - return await BaseDal.UpdateAsync(entity, strWhere, isRemoveDataCache); - } - - /// - /// 根据手写sql语句更新数据 - /// - /// - /// - /// - public bool Update(string strSql, SugarParameter[] parameters = null) - { - return BaseDal.Update(strSql, parameters); - } - - /// - /// 根据手写sql语句更新数据 - /// - /// - /// - /// - public async Task UpdateAsync(string strSql, SugarParameter[] parameters = null) - { - return await BaseDal.UpdateAsync(strSql, parameters); - } - /// /// 更新某个字段 /// @@ -564,33 +432,6 @@ namespace CoreCms.Net.Services return await BaseDal.UpdateAsync(columns, where, isRemoveDataCache); } - /// - /// 根据条件更新 - /// - /// - /// - /// - /// - /// - /// - public async Task UpdateAsync(T entity, List lstColumns = null, List lstIgnoreColumns = null, string strWhere = "", bool isRemoveDataCache = false) - { - return await BaseDal.UpdateAsync(entity, lstColumns, lstIgnoreColumns, strWhere, isRemoveDataCache); - } - - /// - /// 根据条件更新 - /// - /// - /// - /// - /// - /// - /// - public bool Update(T entity, List lstColumns = null, List lstIgnoreColumns = null, string strWhere = "", bool isRemoveDataCache = false) - { - return BaseDal.Update(entity, lstColumns, lstIgnoreColumns, strWhere, isRemoveDataCache); - } #endregion #region 删除数据 @@ -1006,40 +847,6 @@ namespace CoreCms.Net.Services #region 分页数据 - /// - /// 根据条件查询分页数据 - /// - /// - /// - /// 当前页面索引 - /// 分布大小 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - public IPageList QueryPage(Expression> predicate, string orderBy = "", int pageIndex = 1, - int pageSize = 20, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - return BaseDal.QueryPage(predicate, orderBy, pageIndex, pageSize, blUseNoLock, isDataCache, cacheTimes); - } - - /// - /// 根据条件查询分页数据 - /// - /// - /// - /// 当前页面索引 - /// 分布大小 - /// 是否使用WITH(NoLock) - /// 是否启用缓存 - /// 缓存时长(分钟) - /// - public async Task> QueryPageAsync(Expression> predicate, string orderBy = "", - int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue) - { - return await BaseDal.QueryPageAsync(predicate, orderBy, pageIndex, pageSize, blUseNoLock, isDataCache, cacheTimes); - } - /// /// 根据条件查询分页数据 /// diff --git a/CoreCms.Net.Services/Good/CoreCmsGoodsServices.cs b/CoreCms.Net.Services/Good/CoreCmsGoodsServices.cs index 33f289e0..5774bca3 100644 --- a/CoreCms.Net.Services/Good/CoreCmsGoodsServices.cs +++ b/CoreCms.Net.Services/Good/CoreCmsGoodsServices.cs @@ -1010,10 +1010,9 @@ namespace CoreCms.Net.Services /// 分布大小 /// 是否使用WITH(NOLOCK) /// - public async Task> QueryPageByDTOAsync(Expression> predicate, - string orderBy = "", int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false) + public async Task> QueryPageByDTOAsync(Expression> predicate, int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false) { - return await _dal.QueryPageByDTOAsync(predicate, orderBy, pageIndex, pageSize, blUseNoLock); + return await _dal.QueryPageByDTOAsync(predicate, pageIndex, pageSize, blUseNoLock); } #endregion @@ -1026,10 +1025,10 @@ namespace CoreCms.Net.Services /// 分布大小 /// 是否使用WITH(NOLOCK) /// - public async Task> QueryAgentGoodsPageAsync(Expression> predicate, string orderBy = "", + public async Task> QueryAgentGoodsPageAsync(Expression> predicate, int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false) { - return await _dal.QueryAgentGoodsPageAsync(predicate, orderBy, pageIndex, pageSize, blUseNoLock); + return await _dal.QueryAgentGoodsPageAsync(predicate, pageIndex, pageSize, blUseNoLock); } diff --git a/CoreCms.Net.Services/Promotion/CoreCmsPromotionServices.cs b/CoreCms.Net.Services/Promotion/CoreCmsPromotionServices.cs index a908a9b2..6274c276 100644 --- a/CoreCms.Net.Services/Promotion/CoreCmsPromotionServices.cs +++ b/CoreCms.Net.Services/Promotion/CoreCmsPromotionServices.cs @@ -190,7 +190,7 @@ namespace CoreCms.Net.Services var dtoData = new List(); - var promotions = await _dal.QueryListByClauseAsync(p => p.isEnable == true && p.isDel == false && promotionIds.Contains(p.id), promotionIds.Length, "", true, true); + var promotions = await _dal.QueryListByClauseAsync(p => p.isEnable == true && p.isDel == false && promotionIds.Contains(p.id), promotionIds.Length, p => p.id, OrderByType.Desc, true, true); if (promotions != null && promotions.Any()) { //获取团购序列 diff --git a/CoreCms.Net.Services/Shop/CoreCmsPagesServices.cs b/CoreCms.Net.Services/Shop/CoreCmsPagesServices.cs index 6f63aeae..ac11b32d 100644 --- a/CoreCms.Net.Services/Shop/CoreCmsPagesServices.cs +++ b/CoreCms.Net.Services/Shop/CoreCmsPagesServices.cs @@ -197,21 +197,21 @@ namespace CoreCms.Net.Services var result = JArray.Parse(parameters["list"].ToString()); var noticeIds = result.Select(ss => ((JObject)ss)["id"].ObjectToInt(0)).Where(noticeId => noticeId > 0).ToList(); where = where.And(p => noticeIds.Contains(p.id)); - if (noticeIds.Any()) - { - noticeIdsStr = string.Join(",", noticeIdsStr); - //按照固定的序列id进行排序 - if (AppSettingsConstVars.DbDbType == DbType.SqlServer.ToString()) - { - orderBy = " CHARINDEX(RTRIM(CAST(id as NCHAR)),'" + noticeIdsStr + "') "; - } - else if (AppSettingsConstVars.DbDbType == DbType.MySql.ToString()) - { - orderBy = " find_in_set(id,'" + noticeIdsStr + "') "; - } - } + //if (noticeIds.Any()) + //{ + // noticeIdsStr = string.Join(",", noticeIdsStr); + // //按照固定的序列id进行排序 + // if (AppSettingsConstVars.DbDbType == DbType.SqlServer.ToString()) + // { + // orderBy = " CHARINDEX(RTRIM(CAST(id as NCHAR)),'" + noticeIdsStr + "') "; + // } + // else if (AppSettingsConstVars.DbDbType == DbType.MySql.ToString()) + // { + // orderBy = " find_in_set(id,'" + noticeIdsStr + "') "; + // } + //} } - var notices = await _noticeServices.QueryListByClauseAsync(where, orderBy); + var notices = await _noticeServices.QueryListByClauseAsync(where, p => p.createTime, OrderByType.Desc); if (notices != null && notices.Any()) { var result = JArray.FromObject(notices); diff --git a/CoreCms.Net.Web.Admin/Controllers/Good/CoreCmsGoodsController.cs b/CoreCms.Net.Web.Admin/Controllers/Good/CoreCmsGoodsController.cs index 69d88ef1..60a2092a 100644 --- a/CoreCms.Net.Web.Admin/Controllers/Good/CoreCmsGoodsController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/Good/CoreCmsGoodsController.cs @@ -1243,7 +1243,7 @@ namespace CoreCms.Net.Web.Admin.Controllers r.AddRange(arr); }); - var labels = _labelServices.QueryListByClause(p => r.Contains(p.id)); + var labels =await _labelServices.QueryListByClauseAsync(p => r.Contains(p.id)); jm.code = 0; jm.data = new diff --git a/CoreCms.Net.Web.WebApi/Controllers/AgentController.cs b/CoreCms.Net.Web.WebApi/Controllers/AgentController.cs index 8810e76f..84b4d110 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/AgentController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/AgentController.cs @@ -162,13 +162,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers } } - var orderBy = " isRecommend desc,isHot desc"; - if (!string.IsNullOrEmpty(entity.order)) - { - orderBy += "," + entity.order; - } - - var list = await _goodsServices.QueryAgentGoodsPageAsync(where, orderBy, entity.page, entity.limit, false); + var list = await _goodsServices.QueryAgentGoodsPageAsync(where, entity.page, entity.limit, true); if (list.Any()) { foreach (var goods in list) @@ -188,7 +182,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers list.TotalPages, entity.limit, entity.where, - entity.order, }; jm.msg = "数据调用成功!"; diff --git a/CoreCms.Net.Web.WebApi/Controllers/GoodController.cs b/CoreCms.Net.Web.WebApi/Controllers/GoodController.cs index 9f304385..2c37efc1 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/GoodController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/GoodController.cs @@ -249,13 +249,8 @@ namespace CoreCms.Net.Web.WebApi.Controllers where = where.And(p => p.name.Contains(obj.searchName)); } } - var orderBy = " isRecommend desc,isHot desc,sort desc"; - if (!string.IsNullOrWhiteSpace(entity.order)) - { - orderBy += "," + entity.order; - } //获取数据 - var list = await _goodsServices.QueryPageByDTOAsync(where, orderBy, entity.page, entity.limit, true); + var list = await _goodsServices.QueryPageByDTOAsync(where, entity.page, entity.limit, true); //获取品牌 var brands = await _brandServices.QueryListByClauseAsync(p => p.isShow == true, p => p.sort, OrderByType.Desc, true, true); @@ -271,7 +266,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers list.TotalPages, entity.limit, entity.where, - entity.order, brands }; jm.msg = "数据调用成功!";