public async Task <IResultModel> Query(ConfigQueryModel model)
        {
            var result = new QueryResultModel <ConfigEntity>
            {
                Rows  = await _repository.Query(model),
                Total = model.TotalCount
            };

            return(ResultModel.Success(result));
        }
Beispiel #2
0
        public async Task <IList <ConfigEntity> > Query(ConfigQueryModel model)
        {
            var conditions = await _filter.GetConditions <ConfigEntity, ConfigQueryModel>(model);

            var query = _dbContext.Db.Queryable <ConfigEntity>()
                        .Where(conditions)
                        .OrderBy(model.OrderFileds);

            RefAsync <int> totalCount = 0;
            var            data       = await query.ToPageListAsync(model.PageIndex, model.PageSize, totalCount);

            model.TotalCount = totalCount;

            return(data);
        }
Beispiel #3
0
        public async Task <IList <ConfigEntity> > Query(ConfigQueryModel model)
        {
            var paging = model.Paging();
            var query  = Db.Find();

            query.WhereIf(model.Key.NotNull(), m => m.Key.Contains(model.Key) || m.Value.Contains(model.Key));
            if (!paging.OrderBy.Any())
            {
                query.OrderByDescending(m => m.Id);
            }

            query.LeftJoin <AccountEntity>((x, y) => x.CreatedBy == y.Id).Select((x, y) => new { x, Creator = y.Name });
            var list = await query.PaginationAsync(paging);

            model.TotalCount = paging.TotalCount;
            return(list);
        }
Beispiel #4
0
 public Task <IResultModel> Query([FromQuery] ConfigQueryModel model)
 {
     return(_service.Query(model));
 }