/// <summary> /// 视图分页 /// </summary> /// <code> /// <![CDATA[ /// PagedInputDto pagedInputDto = new PagedInputDto() /// { /// PageIndex = 1, /// PageSize = 10, /// Order = "StuName desc" /// }; /// pagedInputDto.Filter = new PageFilterDto() /// { /// Type = "and", /// Conditions = new System.Collections.Generic.List<Condition>() /// { /// new Condition() { Attribute = "StuName", Datatype = "nvarchar", Operatoer = "like", Value = "0" }, /// new Condition() { Attribute = "Birthday", Datatype = "int", Operatoer = "null" } /// }, /// Filters = new System.Collections.Generic.List<PageFilterDto>() /// { /// new PageFilterDto() /// { /// Type = "or", /// Conditions = new System.Collections.Generic.List<Condition>() /// { /// new Condition() { Attribute = "ApproveState", Datatype = "nvarchar", /// Operatoer = "eq", Value = "审核中" } /// } /// } /// } /// }; /// var pagedResult = service.GetPage(pagedInputDto); /// ]]> /// </code> /// <param name="pagedInputDto">分页输入对象</param> /// <returns>分页对象</returns> public virtual async Task <MyPagedResult <TView> > GetViewPageAsync(PagedInputDto pagedInputDto) { var db = this._dbContextProvider.GetDbContext(); MyPagedResult <TView> pageResult = await db.Set <TView>().GetPageAsync <TView, TView>(pagedInputDto); return(pageResult); }
/// <summary> /// 分页 /// </summary> /// <code> /// <![CDATA[ /// PagedInputDto pagedInputDto = new PagedInputDto() /// { /// PageIndex = 1, /// PageSize = 10, /// Order = "StuName desc" /// }; /// pagedInputDto.Filter = new PageFilterDto() /// { /// Type = "and", /// Conditions = new System.Collections.Generic.List<Condition>() /// { /// new Condition() { Attribute = "StuName", Datatype = "nvarchar", Operatoer = "like", Value = "0" }, /// new Condition() { Attribute = "Birthday", Datatype = "int", Operatoer = "null" } /// }, /// Filters = new System.Collections.Generic.List<PageFilterDto>() /// { /// new PageFilterDto() /// { /// Type = "or", /// Conditions = new System.Collections.Generic.List<Condition>() /// { /// new Condition() { Attribute = "ApproveState", Datatype = "nvarchar", /// Operatoer = "eq", Value = "审核中" } /// } /// } /// } /// }; /// var pagedResult = service.GetPage(pagedInputDto); /// ]]> /// </code> /// <param name="pagedInputDto">分页输入对象</param> /// <returns>分页对象</returns> public virtual async Task <MyPagedResult <TEntityDto> > GetPageAsync(PagedInputDto pagedInputDto) { var db = this._dbContextProvider.GetDbContext(); var pageResult = await db.Set <TEntity>().GetPageAsync <TEntity, TEntityDto>(pagedInputDto); return(pageResult); }
public async Task <IHttpActionResult> Get(Guid percentDiscountId, [FromUri] PagedInputDto pagedInput) { var result = await _percentDiscountQueryService.GetProductPercentDiscountByIdPaging(percentDiscountId, pagedInput); return(Ok(result)); }
public async Task <IHttpActionResult> Get(Guid categoryId, Guid brandId, [FromUri] PagedInputDto pagedInput) { var result = await _productQueryService.GetProductsWithCategoryAndOtherBrand(categoryId, brandId, pagedInput); return(Ok(result)); }
/// <summary> /// 获取Gird的数据(Mapper) /// </summary> /// <param name="inDto">表格接收参数</param> /// <returns>grid</returns> public async Task <string> GetGridMapperList(GetGridListInDto inDto) { string viewName = inDto.ViewName.ToCamel(); if (!string.IsNullOrEmpty(inDto.Sort)) { inDto.Order = inDto.Sort + " " + inDto.Order; } if (!string.IsNullOrEmpty(inDto.Select)) { inDto.Select = $"new({inDto.Select})"; } PagedInputDto pagedInputDto = new PagedInputDto() { PageSize = inDto.limit.ToString().ToDefault(99999), PageIndex = inDto.page.ToString().ToDefault(1), Order = inDto.Order, Select = inDto.Select, configurationProvider = inDto.configurationProvider }; if (!string.IsNullOrEmpty(inDto.Filter)) { pagedInputDto.Filter = JsonConvert.DeserializeObject <PageFilterDto>(inDto.Filter); } MyDbContext db = this._dbContextProvider.GetDbContext(); PropertyInfo prop = db.GetType().GetProperty(viewName); object propVaule = prop.GetValue(db, null); Assembly autoAssembly = Assembly.Load("GridData.Core"); string viewFullName = $"My.D3.Entity.Demo.View.{viewName}"; string viewModel = $"My.D3.Entity.Demo.Dto.{viewName}Dto"; Assembly assembly = Assembly.Load("My.D3.Entity"); Type curType = assembly.GetType(viewFullName); Type resultModel = assembly.GetType(viewModel); MethodInfo pageMethodinfo = autoAssembly.GetExtensionMethods("GetPageAsync").FirstOrDefault(); dynamic result = await pageMethodinfo.MakeGenericMethod(curType, resultModel) .InvokeAsync(null, new object[] { propVaule, pagedInputDto }); GridResult gridResult = new GridResult { data = result.DataList, count = result.RowCount }; JsonSerializerSettings settings = new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Error, //忽略循环引用,如果设置为Error,则遇到循环引用的时候报错(建议设置为Error,这样更规范) DateFormatString = "yyyy-MM-dd HH:mm:ss", //日期格式化,默认的格式也不好看 ContractResolver = new CamelCasePropertyNamesContractResolver() //json中属性开头字母小写的驼峰命名 }; return(JsonConvert.SerializeObject(gridResult, settings)); }
public ApiResult <PageResult <TEntity> > QueryPageList([FromQuery] PagedInputDto parameter) { if (BaseService == null) { return(ApiResult.Failure <PageResult <TEntity> >("请在控制器中定义BaseService")); } var dic = QueryDictionary(); var result = BaseService.GetApiPagedList(dic.ToJson(), AutoModel); return(ApiResult.Success(result)); }
public void DynamicInputBySql() { PagedInputDto pagedInputDto = new PagedInputDto() { PageIndex = 1, PageSize = 10, Select = "StuName,Birthday", Order = "StuName desc" }; pagedInputDto.Filter = new PageFilterDto() { Type = "and", Conditions = new List <Condition>() { new Condition() { Attribute = "StuName", Datatype = "nvarchar", Operatoer = "like", Value = "0" }, new Condition() { Attribute = "Birthday", Datatype = "int", Operatoer = "null" } }, Filters = new List <PageFilterDto>() { new PageFilterDto() { Type = "or", Conditions = new System.Collections.Generic.List <Condition>() { new Condition() { Attribute = "ApproveState", Datatype = "nvarchar", Operatoer = "rlike", Value = "审核中" }, new Condition() { Attribute = "ApproveAge", Datatype = "int", Operatoer = "gt", Value = "1" } } } } }; string whereStr = pagedInputDto.Filter.ToWhere(); }
public ApiResult <PageResult <ViewImagePage> > QrcodeList([FromQuery] PagedInputDto parameter) { var model = Resolve <IUserQrCodeService>().GetQrCodeList(parameter); var apiRusult = new PageResult <ViewImagePage> { PageCount = model.PageCount, Result = model, RecordCount = model.RecordCount, CurrentSize = model.CurrentSize, PageIndex = model.PageIndex, PageSize = model.PageSize }; return(ApiResult.Success(apiRusult)); }
public PagedList <ViewImagePage> GetQrCodeList(PagedInputDto parameter) { var users = Resolve <IUserService>() .GetListByPageDesc(15, (int)parameter.PageIndex, u => u.ParentId == parameter.UserId); var usersCount = Resolve <IUserService>().GetList(u => u.ParentId == parameter.UserId).Count(); var list = new List <ViewImagePage>(); users.ToList().ForEach(r => { list.Add(new ViewImagePage { Id = r.Id, Title = r.GetUserName(), ImageUrl = $"/wwwroot/qrcode/{r.Id}.jpeg" }); }); return(PagedList <ViewImagePage> .Create(list, usersCount, 15, parameter.PageIndex)); }
public MobilePagingResultDto <IPublicMessageDto> GetShopPublicMessages(PagedInputDto pagedInput) { var data = _publicMessageRepository.AsQuery() .Where(p => p.PublicMessageType == PublicMessageType.ShopMessage); var result = data.OrderByDescending(p => p.CreationTime) .Skip(pagedInput.Skip) .Take(pagedInput.Count) .ToList() .Select(item => item.ToDto()) .ToList(); return(new MobilePagingResultDto <IPublicMessageDto> { Count = data.Count(), Result = result }); }
public ApiResult <PageResult <Product> > ProductList([FromQuery] PagedInputDto parameter) { var query = new ExpressionQuery <Product> { PageIndex = (int)parameter.PageIndex, PageSize = (int)parameter.PageSize, EnablePaging = true }; //query.And(e => e.StoreId == parameter.StoreId); if (!parameter.StoreId.IsObjectIdNullOrEmpty()) { query.And(s => s.StoreId == parameter.StoreId.ToString()); } if (parameter.Bn != null) { query.And(s => s.Bn.Contains(parameter.Bn)); } if (parameter.Name != null) { query.And(s => s.Name.Contains(parameter.Name)); } query.OrderByDescending(e => e.Id); var list = Resolve <IProductService>().GetPagedList(query); var apiRusult = new PageResult <Product> { PageCount = list.PageCount, Result = list, RecordCount = list.RecordCount, CurrentSize = list.CurrentSize, PageIndex = list.PageIndex, PageSize = list.PageSize }; if (list.Count < 0) { return(ApiResult.Success(new PageResult <Product>())); } return(ApiResult.Success(apiRusult)); //return ApiResult.Success(list); }
public ApiResult <PageResult <ViewAdminBill> > ViewBillList([FromQuery] PagedInputDto parameter, object query) { var list = Resolve <IFinanceAdminService>().GetBillPageList(Query); var apiRusult = new PageResult <ViewAdminBill> { PageCount = list.PageCount, Result = list, RecordCount = list.RecordCount, CurrentSize = list.CurrentSize, PageIndex = list.PageIndex, PageSize = list.PageSize }; if (list.Count < 0) { return(ApiResult.Success(new PageResult <ViewAdminBill>())); } return(ApiResult.Success(apiRusult)); }
public IHttpActionResult Get([FromUri] PagedInputDto pagedInput) { return(Ok(_shopProductsSuggestionQuery.GetByUserId(UserId, pagedInput))); }
public IHttpActionResult Get([FromUri] PagedInputDto pagedInput) { return(Ok(_factorQueryService.GetPendingShopFactors(UserId, pagedInput))); }
public ApiResult <PagedList <ViewUser> > UserList([FromQuery] PagedInputDto parameter) { var model = Resolve <IUserService>().GetViewUserPageList(Query); return(ApiResult.Success(model)); }
public ApiResult <PagedList <UpgradeRecord> > UpgradeList([FromQuery] PagedInputDto parameter) { var model = Resolve <IUpgradeRecordService>().GetPagedList(Query); return(ApiResult.Success(model)); }
/// <summary> /// 视图分页 /// </summary> /// <code> /// <![CDATA[ /// PagedInputDto pagedInputDto = new PagedInputDto() /// { /// PageIndex = 1, /// PageSize = 10, /// Order = "StuName desc" /// }; /// pagedInputDto.Filter = new PageFilterDto() /// { /// Type = "and", /// Conditions = new System.Collections.Generic.List<Condition>() /// { /// new Condition() { Attribute = "StuName", Datatype = "nvarchar", Operatoer = "like", Value = "0" }, /// new Condition() { Attribute = "Birthday", Datatype = "int", Operatoer = "null" } /// }, /// Filters = new System.Collections.Generic.List<PageFilterDto>() /// { /// new PageFilterDto() /// { /// Type = "or", /// Conditions = new System.Collections.Generic.List<Condition>() /// { /// new Condition() { Attribute = "ApproveState", Datatype = "nvarchar", /// Operatoer = "eq", Value = "审核中" } /// } /// } /// } /// }; /// var pagedResult = service.GetPage(pagedInputDto); /// ]]> /// </code> /// <param name="pagedInputDto">分页输入对象</param> /// <returns>分页对象</returns> public virtual async Task <MyPagedResult <TView> > GetViewPageAsync(PagedInputDto pagedInputDto) { MyPagedResult <TView> pageResult = await _db.Query <TView>().GetPageAsync <TView, TView>(pagedInputDto); return(pageResult); }
public ApiResult <PagedList <ViewOrderDeliveryList> > OrderDeliveryList([FromQuery] PagedInputDto parameter) { var model = Resolve <IOrderDeliveryService>().GetPageList(Query); return(ApiResult.Success(model)); }
public ApiResult <PagedList <ViewBlockChain> > BlockChainList([FromQuery] PagedInputDto parameter) { var model = Resolve <IAccountService>().GetBlockChainList(Query); return(ApiResult.Success(model)); }
/// <summary> /// 获取分页信息,不使用Mapper /// </summary> /// <typeparam name="TEntityOrView"></typeparam> /// <param name="query"></param> /// <param name="pagedInputDto"></param> /// <returns></returns> public static async Task <MyPagedResult <TEntityOrView> > GetPageEntityOrViewAsync <TEntityOrView>(this IQueryable <TEntityOrView> query, PagedInputDto pagedInputDto) where TEntityOrView : class { query = EntityFrameworkQueryableExtensions.AsNoTracking <TEntityOrView>(query); //排序 if (!string.IsNullOrEmpty(pagedInputDto.Order)) { List <string> strList = pagedInputDto.Order.Split(new char[1] { ',' }).ToList(); for (int i = 0; i < strList.Count; i++) { query = ((i != 0) ? ((!strList[i].ToLower().Contains("desc")) ? DynamicQueryable.OrderBy <TEntityOrView>(query, pagedInputDto.Order, Array.Empty <object>()) : DynamicQueryable.ThenByDescending <TEntityOrView>(query, pagedInputDto.Order, Array.Empty <object>())) : ((!strList[i].ToLower().Contains("desc")) ? DynamicQueryable.OrderBy <TEntityOrView>(query, pagedInputDto.Order, Array.Empty <object>()) : DynamicQueryable.OrderByDescending <TEntityOrView>(query, pagedInputDto.Order, Array.Empty <object>()))); } } if (pagedInputDto.Filter != null) { string text = pagedInputDto.Filter.ToWhere(); object[] array = pagedInputDto.Filter.paramValues.ToArray(); query = DynamicQueryable.Where <TEntityOrView>(query, text, array); } IQueryable <TEntityOrView> queryable = query.Skip(pagedInputDto.SkipCount).Take(pagedInputDto.PageSize); List <TEntityOrView> dataList = await EntityFrameworkQueryableExtensions.ToListAsync <TEntityOrView>(queryable, default(CancellationToken)); MyPagedResult <TEntityOrView> obj = new MyPagedResult <TEntityOrView>(); obj.PageSize = pagedInputDto.PageSize; obj.PageIndex = pagedInputDto.PageIndex; obj.DataList = dataList; obj.RowCount = query.Count(); return(obj); }
public async Task <MyPagedResult <DemoStudent2CourseDto> > GetPage(PagedInputDto pagedInputDto) { var pagedResult = await this._demoStudent2CourseAppService.GetPage(pagedInputDto); return(pagedResult); }
/// <summary> /// 分页 /// </summary> /// <code> /// <![CDATA[ /// PagedInputDto pagedInputDto = new PagedInputDto() /// { /// PageIndex = 1, /// PageSize = 10, /// Order = "StuName desc" /// }; /// pagedInputDto.Filter = new PageFilterDto() /// { /// Type = "and", /// Conditions = new System.Collections.Generic.List<Condition>() /// { /// new Condition() { Attribute = "StuName", Datatype = "nvarchar", Operatoer = "like", Value = "0" }, /// new Condition() { Attribute = "Birthday", Datatype = "int", Operatoer = "null" } /// }, /// Filters = new System.Collections.Generic.List<PageFilterDto>() /// { /// new PageFilterDto() /// { /// Type = "or", /// Conditions = new System.Collections.Generic.List<Condition>() /// { /// new Condition() { Attribute = "ApproveState", Datatype = "nvarchar", /// Operatoer = "eq", Value = "审核中" } /// } /// } /// } /// }; /// var pagedResult = service.GetPage(pagedInputDto); /// ]]> /// </code> /// <param name="pagedInputDto">分页输入对象</param> /// <returns>分页对象</returns> public virtual async Task <MyPagedResult <TEntityDto> > GetPageAsync(PagedInputDto pagedInputDto) { var pageResult = await _db.Query <TEntity>().GetPageAsync <TEntity, TEntityDto>(pagedInputDto); return(pageResult); }
public ApiResult <PagedList <WorkOrder> > WordOrderList([FromQuery] PagedInputDto parameter) { var model = Resolve <IWorkOrderServices>().GetPagedList(Query); return(ApiResult.Success(model)); }
public virtual Task <MyPagedResult <TEntityDto> > GetPage(PagedInputDto pagedInputDto) { throw new NotImplementedException(); }
public IHttpActionResult Get(Guid categoryId, Guid brandId, [FromUri] PagedInputDto pagedInput) { return(Ok(_productQueryService.GetProductsWithCategoryAndBrand(categoryId, brandId, pagedInput))); }
/// <summary> /// 带mapper /// </summary> /// <typeparam name="TEntityOrView"></typeparam> /// <typeparam name="TDto"></typeparam> /// <param name="query"></param> /// <param name="pagedInputDto"></param> /// <param name="configurationProvider"></param> /// <returns></returns> public static async Task <MyPagedResult <TDto> > GetPageAsync <TEntityOrView, TDto>(this IQueryable <TEntityOrView> query, PagedInputDto pagedInputDto) where TEntityOrView : class where TDto : class { query = EntityFrameworkQueryableExtensions.AsNoTracking <TEntityOrView>(query); //排序 if (!string.IsNullOrEmpty(pagedInputDto.Order)) { List <string> strList = pagedInputDto.Order.Split(new char[1] { ',' }).ToList(); for (int i = 0; i < strList.Count; i++) { query = ((i != 0) ? ((!strList[i].ToLower().Contains("desc")) ? DynamicQueryable.OrderBy <TEntityOrView>(query, pagedInputDto.Order, Array.Empty <object>()) : DynamicQueryable.ThenByDescending <TEntityOrView>(query, pagedInputDto.Order, Array.Empty <object>())) : ((!strList[i].ToLower().Contains("desc")) ? DynamicQueryable.OrderBy <TEntityOrView>(query, pagedInputDto.Order, Array.Empty <object>()) : DynamicQueryable.OrderByDescending <TEntityOrView>(query, pagedInputDto.Order, Array.Empty <object>()))); } } //if (!string.IsNullOrEmpty(pagedInputDto.Order)) //{ // query = DynamicQueryable.OrderBy<TEntityOrView>(query, pagedInputDto.Order, Array.Empty<object>()); //} if (pagedInputDto.Filter != null) { string text = pagedInputDto.Filter.ToWhere(); object[] array = pagedInputDto.Filter.paramValues.ToArray(); query = DynamicQueryable.Where <TEntityOrView>(query, text, array); } IQueryable <TEntityOrView> queryable = query.Skip(pagedInputDto.SkipCount).Take(pagedInputDto.PageSize); IQueryable <TDto> queryable2; if (!string.IsNullOrEmpty(pagedInputDto.Select)) { queryable2 = DynamicQueryable.Select(queryable, pagedInputDto.Select, Array.Empty <object>()).Cast <TDto>(); } else { queryable2 = Extensions.ProjectTo <TDto>(queryable, (AutoMapper.IConfigurationProvider)pagedInputDto.configurationProvider, Array.Empty <Expression <Func <TDto, object> > >()); } List <TDto> dataList = await EntityFrameworkQueryableExtensions.ToListAsync <TDto>(queryable2, default(CancellationToken)); MyPagedResult <TDto> obj = new MyPagedResult <TDto>(); obj.PageSize = pagedInputDto.PageSize; obj.PageIndex = pagedInputDto.PageIndex; obj.DataList = dataList; obj.RowCount = query.Count(); return(obj); }
public virtual Task <MyPagedResult <TView> > GetViewPage(PagedInputDto pagedInputDto) { throw new NotImplementedException(); }
public async Task <MobilePagingResultDto <IProductDiscountDto> > GetProductPercentDiscountByIdPaging(Guid percentDiscountId, PagedInputDto pagedInput) { var percentDiscount = _percentRepository.Find(percentDiscountId); if (percentDiscount == null) { throw new DomainException("تخفیف یافت نشد"); } if (!(percentDiscount.FromDate <= DateTime.Today && percentDiscount.ToDate >= DateTime.Today)) { throw new DomainException("تخفیف در این بازه زمانی روز موجود نمی باشد"); } if (!(percentDiscount.FromTime <= DateTime.Now.TimeOfDay && percentDiscount.ToTime >= DateTime.Now.TimeOfDay)) { throw new DomainException("تخفیف در این بازه زمانی ساعت موجود نمی باشد"); } if (percentDiscount.RemainOrderCount <= 0) { throw new DomainException("تخفیف در این بازه زمانی ساعت موجود نمی باشد"); } var data = _percentRepository.AsQuery().Where(item => item.Id == percentDiscountId) .SelectMany(item => item.ProductDiscounts); var result = await data.OrderByDescending(p => p.CreationTime) .Skip(pagedInput.Skip) .Take(pagedInput.Count) .ToListAsync(); return(new MobilePagingResultDto <IProductDiscountDto> { Result = result.Select(item => item.ToDto()) .ToList(), Count = data.Count() }); }
public ApiResult <PagedList <GradeKpi> > GradeKpiList([FromQuery] PagedInputDto parameter) { var model = Resolve <IGradeKpiService>().GetGradeKpiList(Query); return(ApiResult.Success(model)); }
/// <summary> /// 获取 [用户表] 分页的信息 /// </summary> /// <param name="pagedInputDto">分页输入的Dto</param> /// <returns>分页信息</returns> public override async Task <MyPagedResult <Module2PermissionDto> > GetPage(PagedInputDto pagedInputDto) { var pagedResult = await this._module2PermissionRepository.GetPageAsync(pagedInputDto); return(pagedResult); }