李昊 4 years ago
parent
commit
73b10f0bef

+ 6 - 6
gx_api/GxPress/Repository/GxPress.Repository.Implement/AdminRepository.cs

@@ -168,13 +168,13 @@ namespace GxPress.Repository.Implement
         /// <returns></returns>
         public async Task<PagedList<AdminPageResult>> GetPagedList(AdminPageSearchRequest request)
         {
-            var pagedList = new PagedList<AdminPageResult>
-            {
-                Total = await GetCountAsync()
-            };
-            var list = await GetPageListAsync(request.Page, request.PerPage);
+            var pagedList = new PagedList<AdminPageResult>();
+            var query = Q.NewQuery();
+            if (!string.IsNullOrEmpty(request.Keyword))
+                query.WhereLike(nameof(Admin.Name), $"%{request.Keyword}%");
+            pagedList.Total = await _repository.CountAsync(query);
+            var list = await _repository.GetAllAsync(query);
             var items = list.Select(user => _mapper.Map<AdminPageResult>(user)).ToList();
-
             pagedList.Items = items;
             return pagedList;
         }