diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 9a5dfea2d..35de76d6f 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -2249,6 +2249,13 @@ + + + 根据用户Id获取用户详细信息[New] + + + xiuga + 添加用户 diff --git a/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs b/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs index 8aada8e17..9ef57dafb 100644 --- a/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs +++ b/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs @@ -158,7 +158,11 @@ namespace IRaCIS.Application.Contracts public class UserDetailDTO : UserInfo { - public bool CanEditUserType { get; set; } + //public bool CanEditUserType { get; set; } + + public Guid IdentityUserId { get; set; } + + public List AccountList { get; set; } } public class UserInfo diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index b89ac54e5..721cb148a 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -506,17 +506,21 @@ namespace IRaCIS.Core.Application.Service } - ///// - ///// 根据用户Id获取用户详细信息[New] - ///// - ///// - ///// xiuga - //[HttpGet("{id:guid}")] - //public async Task GetUser(Guid id) - //{ - // var userQuery = _userRepository.Where(t => t.Id == id).ProjectTo(_mapper.ConfigurationProvider); - // return await (userQuery.FirstOrDefaultAsync()).IfNullThrowException(); - //} + /// + /// 根据用户Id获取用户详细信息[New] + /// + /// + /// xiuga + [HttpGet("{userId:guid}")] + public async Task GetUser(Guid userId) + { + var userQuery = _userRepository.Where(t => t.Id == userId).ProjectTo(_mapper.ConfigurationProvider); + + var userRole = await userQuery.FirstOrDefaultAsync(); + + userRole.AccountList = await _userRepository.Where(t => t.IdentityUserId == userRole.IdentityUserId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + return userRole; + } ///// ///// 删除用户 diff --git a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs index 0a11ea4e4..521b044a3 100644 --- a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs @@ -87,7 +87,9 @@ namespace IRaCIS.Core.Application.Service // .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName)) // .ForMember(d => d.CanEditUserType, u => u.MapFrom(s => !s.UserTrials.Any())); - var token = string.Empty; + CreateMap(); + + var token = string.Empty; var userId = Guid.Empty; CreateMap() .ForMember(t => t.PublishUserName, d => d.MapFrom(t => t.PublishedUser.UserName))