public IActionResult PagedList(PagedQueryPermissionDto dto) { var result = _permissionService.PagedQueryPermissions(dto); if (result.Code > 0) { return(Json(result)); } var data = new { Code = 0, Message = "", Total = result.Data.TotalCount, Data = result.Data.List }; return(Json(data)); }
/// <summary> /// 分页查询 /// </summary> /// <param name="dto"></param> /// <returns></returns> public PublicResult <PagedList <QueryPermissionItem> > PagedQueryPermissions(PagedQueryPermissionDto dto) { var page = dto.Page ?? 1; var pageSize = dto.PageSize ?? 20; using (var client = DbFactory.CreateClient()) { var total = 0; var list = client.Queryable <Permission>() //.WhereIF(!request.Keyword.IsNullOrEmpty(), t => t.Name.Contains(request.Keyword)) .Select(t => new QueryPermissionItem() { Id = t.Id, Name = t.Name, Code = t.Code, IsActive = t.IsActive, ParentId = t.ParentId, OrderIndex = t.OrderIndex, IsSystem = t.IsSystem, }) .OrderBy("order_index ASC,id ASC") .ToPageList(page, pageSize, ref total); /* * foreach (var item in list) * { * UpdatePathByPermissionId(item.Id); * } */ return(new PagedList <QueryPermissionItem> { List = list, Page = page, PageSize = pageSize, TotalCount = total }); } }