fix 用户列表查询问题
This commit is contained in:
@@ -20,11 +20,11 @@ public class UserCreateRequest
|
||||
/// <summary>
|
||||
/// 厂区
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Tenant { get; set; }
|
||||
[MinLength(1, ErrorMessage = "请明确厂区")]
|
||||
public List<string> Tenants { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class UserService : IUserService
|
||||
.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")
|
||||
.LeftJoin<UserClaimEntity>((x, ur, r, c, cc) => x.Id == c.UserId && c.ClaimType == "tenant")
|
||||
.LeftJoin<UserClaimEntity>((x, ur, r, c, cc) => x.Id == cc.UserId && cc.ClaimType == "tenant")
|
||||
.Where(x => x.UserName != "admin")
|
||||
.Where((x, ur, r, c, cc) => cc.ClaimValue == tenant)
|
||||
.WhereIF(request.IsOperator, (x, ur, r, c) => !SqlFunc.IsNullOrEmpty(r.Name))
|
||||
@@ -116,11 +116,11 @@ public class UserService : IUserService
|
||||
|
||||
var id = (int)await _dbContext.InsertReturnIdentityAsync(user);
|
||||
|
||||
await _dbContext.InsertAsync(new UserTenantEntity
|
||||
await _dbContext.InsertAsync(request.Tenants.Select(x => new UserTenantEntity
|
||||
{
|
||||
TenantCode = request.Tenant,
|
||||
TenantCode = x,
|
||||
UserId = id
|
||||
});
|
||||
}).ToList());
|
||||
|
||||
if (request.Name.IsPresent())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user