protected override async Task <IQueryable <TEntity> > GetQueryable(RequestPageDto request) { ModuleInfo moduleInfo = await ModuleInfo(request); var query = await base.GetQueryable(request); ////模块的查询需要增加高级查询内容 //if (!request.SearchCondition.IsNullOrWhiteSpace()) //{ // query = DynamicSearchParser.Parse<TEntity>(request.SearchCondition, moduleInfo, query) as IQueryable<TEntity>; //} if (request.OrderField.IsNullOrEmpty()) { //使用模块排序 //默认排序 if (moduleInfo.SortField != "Id") { query = DynamicOrderParser.Parse <TEntity>(moduleInfo.SortField, moduleInfo.SortType, moduleInfo, query) as IQueryable <TEntity>; } else { query = query.OrderBy($"{moduleInfo.SortField} {moduleInfo.SortType.ToString()}"); } } return(query); }
protected override async Task <IQueryable <TEntity> > BuildOrderQueryAsync(RequestPageDto request, IQueryable <TEntity> query) { ModuleInfo moduleInfo = await ModuleInfo(request); if (request.OrderField.IsNullOrEmpty()) { request.OrderField = moduleInfo.SortField; request.OrderType = moduleInfo.SortType.ToString(); } //使用模块排序 //默认排序 if (request.OrderField != "Id") { query = DynamicOrderParser.Parse <TEntity>(request.OrderField, request.OrderType?.ToLower() == "desc" ? SortType.Desc : SortType.Asc, moduleInfo, query) as IQueryable <TEntity>; } else { query = query.OrderBy($"{request.OrderField} {request.OrderType}"); } return(query); }