From 91b745a28c13c0db8e79dd41288b3a8bb9233627 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 | 5 +++++
.../Identity/Services/Implements/UserService.cs | 10 ++++++----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/Src/Dlhis.Sys/Identity/Response/UserResponse.cs b/Src/Dlhis.Sys/Identity/Response/UserResponse.cs
index 15c1fe33..8d14c7c1 100644
--- a/Src/Dlhis.Sys/Identity/Response/UserResponse.cs
+++ b/Src/Dlhis.Sys/Identity/Response/UserResponse.cs
@@ -9,6 +9,11 @@ public class UserResponse
///
public string UserName { 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 36876a16..b7ffee40 100644
--- a/Src/Dlhis.Sys/Identity/Services/Implements/UserService.cs
+++ b/Src/Dlhis.Sys/Identity/Services/Implements/UserService.cs
@@ -15,7 +15,7 @@ public class UserService : IUserService
{
private readonly IDbContext _dbContext;
- public UserService(IDbContext dbContext, IDbContext dbContext1)
+ public UserService(IDbContext dbContext)
{
_dbContext = dbContext.ChangeDb("identity");
}
@@ -25,16 +25,18 @@ public class UserService : IUserService
return 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);
}