/// <summary> /// /// </summary> /// <param name="dto"></param> /// <returns></returns> public PublicResult <PagedList <QueryAdminMenuItem> > PagedQueryAdminMenus(PagedQueryAdminMenusDto dto) { var page = 1; var pageSize = 1000; using (var client = DbFactory.CreateClient()) { var total = 0; var list = client.Queryable <AdminMenu>() .WhereIF(!dto.Keyword.IsNullOrEmpty(), t => t.Name.Contains(dto.Keyword)) .Select(t => new QueryAdminMenuItem() { Id = t.Id, Name = t.Name, ParentId = t.ParentId, Link = t.Link, OrderIndex = t.OrderIndex, Icon = t.Icon, IsSystem = t.IsSystem, Path = t.Path }) .OrderBy("order_index ASC, id ASC") .ToPageList(page, pageSize, ref total); return(new PagedList <QueryAdminMenuItem> { List = list, Page = page, PageSize = pageSize, TotalCount = total }); } }
public IActionResult PagedList(PagedQueryAdminMenusDto dto) { var pagedQueryAdminMenusResult = _adminMenuService.PagedQueryAdminMenus(dto); if (pagedQueryAdminMenusResult.Code > 0) { return(Json(pagedQueryAdminMenusResult)); } var result = new { Code = 0, Message = "", Total = pagedQueryAdminMenusResult.Data.TotalCount, Data = pagedQueryAdminMenusResult.Data.List }; return(Json(result)); }