fix role,user查看; 设备状态
This commit is contained in:
@@ -85,8 +85,8 @@ public class RolesController : ControllerBase
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("my")]
|
||||
public async Task<RoleRespone> GetMyRoleAsync()
|
||||
public async Task<RoleRespone> GetMyRoleAsync(int? userId)
|
||||
{
|
||||
return await _roleService.GetMyRoleAsync();
|
||||
return await _roleService.GetMyRoleAsync(userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,4 +58,10 @@ public class UserResponse
|
||||
/// 登陆失败次数
|
||||
/// </summary>
|
||||
public int AccessFailedCount { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 角色
|
||||
/// </summary>
|
||||
public string Role { get; set; }
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public interface IRoleService : IScopeDependency
|
||||
|
||||
Task SaveRoleAsync(RoleSaveRequest request);
|
||||
|
||||
Task<RoleRespone> GetMyRoleAsync();
|
||||
Task<RoleRespone> GetMyRoleAsync(int? userId);
|
||||
|
||||
Task RemoveRoleAsync(RoleRemoveRequest request);
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
|
||||
namespace Dlhis.Sys.Identity.Services.Implements;
|
||||
|
||||
@@ -40,9 +39,9 @@ public class RoleService : IRoleService
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<RoleRespone> GetMyRoleAsync()
|
||||
public async Task<RoleRespone> GetMyRoleAsync(int? userId)
|
||||
{
|
||||
var userId = _currentUser.GetIntSubjectId();
|
||||
userId ??= _currentUser.GetIntSubjectId();
|
||||
|
||||
return await Scoped.Request.Value.CreateAsync(async sp =>
|
||||
{
|
||||
@@ -50,7 +49,6 @@ public class RoleService : IRoleService
|
||||
var identityConnection = _configuration.GetSection("SqlSugarOptions:IdentityConnectionString").Value;
|
||||
dbContext.Client.CurrentConnectionConfig.ConnectionString = identityConnection;
|
||||
|
||||
|
||||
return await dbContext.Queryable<UserRoleEntity>()
|
||||
.LeftJoin<RoleEntity>((x, r) => x.RoleId == r.Id)
|
||||
.Where(x => x.UserId == userId)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Configuration;
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Dlhis.Sys.Identity.Request;
|
||||
using Dlhis.Sys.Identity.Response;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
@@ -23,13 +22,18 @@ public class UserService : IUserService
|
||||
public async Task<Pagination<UserResponse>> GetPageAsync(UserPageRequest request)
|
||||
{
|
||||
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)
|
||||
|| x.NormalizedUserName.Contains(request.Search)
|
||||
|| x.Email.Contains(request.Search)
|
||||
|| x.NormalizedEmail.Contains(request.Search)
|
||||
|| x.PhoneNumber.Contains(request.Search)
|
||||
)
|
||||
.Select<UserResponse>()
|
||||
.Select((x, ur, r) => new UserResponse
|
||||
{
|
||||
Id = x.Id
|
||||
}, true)
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user