public async Task <IList <CategoryEntity> > Query(CategoryQueryModel model)
        {
            var paging = model.Paging();

            var query = Db.Find();

            if (!paging.OrderBy.Any())
            {
                query.OrderByDescending(m => m.Sort);
            }

            var result = await query.PaginationAsync(paging);

            model.TotalCount = paging.TotalCount;

            return(result);
        }
        public async Task <IList <CategoryEntity> > Query(CategoryQueryModel model)
        {
            var paging = model.Paging();

            var query = Db.Find();

            if (!paging.OrderBy.Any())
            {
                query.OrderByDescending(m => m.Id);
            }

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

            model.TotalCount = paging.TotalCount;

            return(result);
        }