|
@@ -272,10 +272,36 @@ namespace GxPress.Service.Implement
|
|
|
.OrWhereLike(nameof(User.Phone), keyword)
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
return await _userRepository.GetAllAsync(query);
|
|
|
}
|
|
|
|
|
|
+ public async Task<PagedList<User>> GetPageListAsync(UserPageSearchRequest request)
|
|
|
+ {
|
|
|
+ var result = new PagedList<User>();
|
|
|
+ var query = Q.ForPage(request.Page, request.PerPage);
|
|
|
+ if (request.DepartmentId > 0)
|
|
|
+ {
|
|
|
+ query.Where(nameof(User.DepartmentId), request.DepartmentId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (request.RoleId > 0)
|
|
|
+ {
|
|
|
+ query.Where(nameof(User.RoleId), request.RoleId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(request.Keyword))
|
|
|
+ {
|
|
|
+ request.Keyword = "%" + request.Keyword + "%";
|
|
|
+ query.Where(q =>
|
|
|
+ q.WhereLike(nameof(User.Name), request.Keyword)
|
|
|
+ .OrWhereLike(nameof(User.Email), request.Keyword)
|
|
|
+ .OrWhereLike(nameof(User.Phone), request.Keyword)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ result.Items = await _userRepository.GetAllAsync(query);
|
|
|
+ result.Total = await _userRepository.CountAsync(query);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
/// <summary>
|
|
|
/// 删除用户
|
|
|
/// </summary>
|