add 操作人

This commit is contained in:
2025-03-25 10:48:20 +08:00
parent c6bc8bf619
commit c6ad50c783
5 changed files with 41 additions and 4 deletions

View File

@@ -90,7 +90,7 @@ public class UserService : IUserService
Role = r.Name,
OperatorName = c.ClaimValue,
}, true)
.FirstAsync();
.SingleAsync();
return user;
}
@@ -102,8 +102,19 @@ public class UserService : IUserService
public async Task<List<UserResponse>> GetUserByIdsAsync(List<int> ids)
{
var users = await _identityDbContext.Queryable<UserEntity>().Where(x => ids.Contains(x.Id)).Select<UserResponse>().ToListAsync();
return users;
return await _identityDbContext.Queryable<UserEntity>()
.LeftJoin<UserRoleEntity>((x, ur) => x.Id == ur.UserId)
.LeftJoin<RoleEntity>((x, ur, r) => ur.RoleId == r.Id)
.LeftJoin<UserClaimEntity>((x, ur, r, c) => x.Id == c.UserId && c.ClaimType == "preferred_username")
.Where(x => ids.Contains(x.Id))
.Select((x, ur, r, c) => new UserResponse
{
Id = x.Id,
RoleId = ur.RoleId,
Role = r.Name,
OperatorName = c.ClaimValue,
}, true)
.ToListAsync();
}
public async Task CreateUserAsync(UserCreateRequest request)