fix 账户关联名称

This commit is contained in:
cheche
2024-03-27 14:15:21 +08:00
committed by liguoyang
parent 1f1be3102d
commit b267fa51be
3 changed files with 34 additions and 1 deletions

View File

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

View File

@@ -14,15 +14,17 @@ namespace Dlhis.Sys.Identity.Services.Implements;
public class UserService : IUserService
{
private readonly IDbContext _dbContext;
private readonly IDbContext _dbContext1;
public UserService(IDbContext dbContext, IDbContext dbContext1)
{
_dbContext = dbContext.ChangeDb("identity");
_dbContext1 = dbContext1;
}
public async Task<Pagination<UserResponse>> GetPageAsync(UserPageRequest request)
{
return await _dbContext.Queryable<UserEntity>()
var page = 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)
@@ -37,6 +39,18 @@ public class UserService : IUserService
Role = r.Name
}, true)
.ToPageListAsync(request);
var gainfos = await _dbContext1.ChangeDb("default").Queryable<GainfoEntity>()
.Where(x => x.IdentityUserId > 0)
.ToListAsync();
page.Data.ForEach(item =>
{
item.GainfoName = gainfos.Where(x => x.IdentityUserId == item.Id)
.FirstOrDefault()?.Name;
});
return page;
}
public async Task ResetAccessFailedCountAsync(int id)

View File

@@ -25,6 +25,20 @@ public class SqlSugarPack : BaseAppPack
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
MoreSettings = new ConnMoreSettings
{
DisableNvarchar = true,
}
},
new()
{
ConfigId = "default",
ConnectionString = configuration.GetSection("SqlSugarOptions:DefaultConnectionString").Value,
DbType = DbType.MySql,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
MoreSettings = new ConnMoreSettings
{
DisableNvarchar = true,