From 79763d7f0178603328a5c91c003ada2f90bf7ef0 Mon Sep 17 00:00:00 2001 From: cheche <717840555@qq.com> Date: Wed, 27 Mar 2024 14:49:07 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=93=8D=E4=BD=9C=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/Dlhis.Sys/Identity/Response/UserResponse.cs | 2 +- .../Identity/Services/Implements/UserService.cs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Src/Dlhis.Sys/Identity/Response/UserResponse.cs b/Src/Dlhis.Sys/Identity/Response/UserResponse.cs index f152ac30..8d14c7c1 100644 --- a/Src/Dlhis.Sys/Identity/Response/UserResponse.cs +++ b/Src/Dlhis.Sys/Identity/Response/UserResponse.cs @@ -12,7 +12,7 @@ public class UserResponse /// /// 操作员名称 /// - public string GainfoName { get; set; } + public string OperatorName { get; set; } /// /// 规范化账号名称 diff --git a/Src/Dlhis.Sys/Identity/Services/Implements/UserService.cs b/Src/Dlhis.Sys/Identity/Services/Implements/UserService.cs index e4f3f747..6b35ea3f 100644 --- a/Src/Dlhis.Sys/Identity/Services/Implements/UserService.cs +++ b/Src/Dlhis.Sys/Identity/Services/Implements/UserService.cs @@ -16,7 +16,7 @@ public class UserService : IUserService private readonly IDbContext _dbContext; private readonly IDbContext _dbContext1; - public UserService(IDbContext dbContext, IDbContext dbContext1) + public UserService(IDbContext dbContext) { _dbContext = dbContext.ChangeDb("identity"); _dbContext1 = dbContext1; @@ -27,16 +27,18 @@ public class UserService : IUserService var page = await _dbContext.Queryable() .LeftJoin((x, ur) => x.Id == ur.UserId) .LeftJoin((x, ur, r) => ur.RoleId == r.Id) - .WhereIF(request.Search.IsPresent(), x => x.UserName.Contains(request.Search) + .LeftJoin((x, ur, r,c) => x.Id == c.UserId && c.ClaimType == "preferred_username") + .WhereIF(request.Search.IsPresent(), x => x.UserName.Contains(request.Search) || x.NormalizedUserName.Contains(request.Search) || x.Email.Contains(request.Search) || x.NormalizedEmail.Contains(request.Search) || x.PhoneNumber.Contains(request.Search) ) - .Select((x, ur, r) => new UserResponse + .Select((x, ur, r,c) => new UserResponse { Id = x.Id, - Role = r.Name + Role = r.Name, + OperatorName = c.ClaimValue, }, true) .ToPageListAsync(request);