fix 操作员

This commit is contained in:
cheche
2024-03-27 14:49:07 +08:00
parent c17df081e4
commit 91b745a28c
2 changed files with 11 additions and 4 deletions

View File

@@ -9,6 +9,11 @@ public class UserResponse
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 操作员名称
/// </summary>
public string OperatorName { get; set; }
/// <summary>
/// 规范化账号名称
/// </summary>

View File

@@ -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<UserEntity>()
.LeftJoin<UserRoleEntity>((x, ur) => x.Id == ur.UserId)
.LeftJoin<RoleEntity>((x, ur, r) => ur.RoleId == r.Id)
.WhereIF(request.Search.IsPresent(), x => x.UserName.Contains(request.Search)
.LeftJoin<UserClaimEntity>((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);
}