public async Task <PagedResultDto <GetRoleListOutput> > GetRolePagedList(QueryListPagedRequestInput input) { int total; var list = await _roleRepository.GetAll().AsNoTracking().Where(input, out total).ToListAsync(); return(new PagedResultDto <GetRoleListOutput>(total, list.MapTo <List <GetRoleListOutput> >())); }
/// <summary> /// 获取用户列表数据 /// </summary> /// <param name="input"></param> /// <returns>列表数据</returns> public async Task <PagedResultDto <GetUserListOutput> > GetUserPagedList(QueryListPagedRequestInput input) { int total; var list = await UserRepo.GetAll() .Where(p => p.UserType == UserType.系统管理员) .AsNoTracking() .Where(input, out total) .ToListAsync(); return(new PagedResultDto <GetUserListOutput>(total, list.MapTo <List <GetUserListOutput> >())); }
/// <inheritdoc/> public async Task <PagedResultDto <AttributeDto> > GetAttributePagedList(QueryListPagedRequestInput input) { var query = _attributeRepository.GetAll(); //第一次查询只显示公共属性 if (input.FilterGroup == null || !input.FilterGroup.Rules.Any(p => p.Field == "productClassifyId")) { query = _attributeRepository.GetAll().Where(p => p.ProductClassifyId == 0); } int total; var list = await query.Where(input, out total).ToListAsync(); return(new PagedResultDto <AttributeDto>(total, list.MapTo <List <AttributeDto> >())); }
/// <inheritdoc/> public async Task <PagedResultDto <ProductExtendServiceDto> > GetExtendServicePagedList(QueryListPagedRequestInput input) { //验证商品Id的查询参数 if (input.FilterGroup == null || !input.FilterGroup.Rules.Any(p => p.Field == "productId")) { throw new AbpValidationException("查询参数错误"); } int total; var list = await _extendServiceRepository.GetAll().Where(input, out total).ToListAsync(); return(new PagedResultDto <ProductExtendServiceDto>(total, list.MapTo <List <ProductExtendServiceDto> >())); }
/// <summary> /// 从指定<see cref="IQueryable{T}"/>集合中查询指定分页条件的子数据集 /// </summary> /// <typeparam name="TEntity">动态实体类型</typeparam> /// <param name="source">要查询的数据集</param> /// <param name="input">查询条件</param> /// <param name="total">输出符合条件的总记录数</param> /// <returns></returns> public static IQueryable <TEntity> Where <TEntity>(this IQueryable <TEntity> source, QueryListPagedRequestInput input, out int total) { Expression <Func <TEntity, bool> > predicate = p => true; if (input.FilterGroup != null) { foreach (var item in input.FilterGroup.Rules) { item.Field = item.Field.ToPascalCase(); //TODO:处理FilterGroup.Groups } predicate = FilterHelper.GetExpression <TEntity>(input.FilterGroup); } return(source.Where <TEntity>(predicate, input.PageIndex, input.PageSize, out total, input.SortConditions)); }
/// <summary> /// 获取 审计日志分页 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <PagedResultDto <GetAuditLogListOutput> > GetUserAuditLogPagedList(QueryListPagedRequestInput input) { int total; var list = await _auditLogRepository.GetAll().Where(t => t.UserId == AbpSession.UserId).Where(input, out total).ToListAsync(); return(new PagedResultDto <GetAuditLogListOutput>(total, list.MapTo <List <GetAuditLogListOutput> >())); }
/// <inheritdoc/> public async Task <PagedResultDto <OrganizationUnitDto> > GetOrganizationUnitPagedList(QueryListPagedRequestInput input) { int total; var list = await _ouRepository.GetAll().Where(input, out total).ToListAsync(); return(new PagedResultDto <OrganizationUnitDto>(total, list.MapTo <List <OrganizationUnitDto> >())); }
/// <inheritdoc/> public async Task <PagedResultDto <UserLoginAttemptOutPut> > GetUserLoginLogList(QueryListPagedRequestInput input) { int total; var list = await LoginAttemptRepo.GetAll().Where(input, out total).ToListAsync(); return(new PagedResultDto <UserLoginAttemptOutPut>(total, list.MapTo <List <UserLoginAttemptOutPut> >())); }
/// <inheritdoc/> public async Task <PagedResultDto <GetBackgroundJobListOutput> > GetBackgroundJobPagedList(QueryListPagedRequestInput input) { int total; var list = await _backgroundJobRepository.GetAll().Where(input, out total).ToListAsync(); return(new PagedResultDto <GetBackgroundJobListOutput>(total, list.MapTo <List <GetBackgroundJobListOutput> >())); }
/// <summary> /// This method should create <see cref="IQueryable{TEntity}"/> based on given input. /// methods. /// </summary> /// <param name="input">The input.</param> protected virtual void QueryInputHandler(QueryListPagedRequestInput input) { }
/// <inheritdoc/> public async Task <PagedResultDto <AttributeOptionDto> > GetAttributeOptionPagedList(QueryListPagedRequestInput input) { int total; var query = _attributeOptionRepository.GetAll().AsNoTracking(); //首次加载不显示属性选项 if (input.FilterGroup == null || !input.FilterGroup.Rules.Any(p => p.Field == "attributeId")) { query = query.Where(p => false); } var list = await query.Where(input, out total).ToListAsync(); return(new PagedResultDto <AttributeOptionDto>(total, list.MapTo <List <AttributeOptionDto> >())); }