修改课题组管理
continuous-integration/drone/push Build is running
Details
continuous-integration/drone/push Build is running
Details
parent
fdbdda71eb
commit
59339969da
|
|
@ -39,17 +39,10 @@ public class HospitalGroupAddOrEdit
|
|||
|
||||
public string CallingAE { get; set; }
|
||||
|
||||
public List<GAIdentityUserInfo> IdentityUserList { get; set; }
|
||||
public List<Guid> IdentityUserIdList { get; set; }
|
||||
}
|
||||
|
||||
public class GAIdentityUserInfo
|
||||
{
|
||||
public Guid IdentityUserId { get; set; }
|
||||
|
||||
public bool IsDisabled { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class HospitalGroupQuery : PageInput
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,9 +24,10 @@ public class HospitalGroupService(IRepository<HospitalGroup> _hospitalGroupRepos
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
public async Task<List<HospitalGroupAdminUserInfo>> GetGAUserList()
|
||||
public async Task<List<HospitalGroupAdminUserInfo>> GetGAUserList(Guid hospitalGroupId)
|
||||
{
|
||||
var list = await _identityUserRepository.Where(t => t.UserRoleList.Any(t => t.UserTypeEnum == UserTypeEnum.GA && t.IsUserRoleDisabled == false)).ProjectTo<HospitalGroupAdminUserInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
var list = await _identityUserRepository.Where(t => t.UserRoleList.Any(t => t.UserTypeEnum == UserTypeEnum.GA && t.IsUserRoleDisabled == false) && t.IdentityUserHospitalGroupList.Any(t => t.HospitalGroupId == hospitalGroupId))
|
||||
.ProjectTo<HospitalGroupAdminUserInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
|
@ -96,26 +97,24 @@ public class HospitalGroupService(IRepository<HospitalGroup> _hospitalGroupRepos
|
|||
|
||||
var addEntity = _mapper.Map<HospitalGroup>(addOrEditHospitalGroup);
|
||||
|
||||
addEntity.IdentityUserList = addOrEditHospitalGroup.IdentityUserList.Select(t => new HospitalGroupIdentityUser() { IdentityUserId = t.IdentityUserId, IsManager = true, IsDisabled = t.IsDisabled }).ToList();
|
||||
|
||||
var newEntity = await _hospitalGroupRepository.AddAsync(addEntity, true, verifyExp1);
|
||||
|
||||
return ResponseOutput.Ok(newEntity.Id.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
await _hospitalGroupIdentityUserRepository.BatchDeleteNoTrackingAsync(t => t.HospitalGroupId == addOrEditHospitalGroup.Id && t.IsManager);
|
||||
|
||||
//var find = await _hospitalGroupRepository.FirstOrDefaultAsync(t => t.Id == addOrEditHospitalGroup.Id);
|
||||
var gaAdminList = _hospitalGroupRepository.Where(t => t.Id == addOrEditHospitalGroup.Id).SelectMany(t => t.IdentityUserList.Where(t => t.IsManager)).Select(t => t.IdentityUserId).ToList();
|
||||
|
||||
//_mapper.Map(addOrEditHospitalGroup, find);
|
||||
|
||||
var adminUserList = addOrEditHospitalGroup.IdentityUserList.Select(t => new HospitalGroupIdentityUser() { IdentityUserId = t.IdentityUserId, HospitalGroupId = (Guid)addOrEditHospitalGroup.Id, IsManager = true, IsDisabled = t.IsDisabled }).ToList();
|
||||
|
||||
await _hospitalGroupIdentityUserRepository.AddRangeAsync(adminUserList);
|
||||
var entity = await _hospitalGroupRepository.UpdateFromDTOAsync(addOrEditHospitalGroup, true, false, verifyExp1);
|
||||
|
||||
|
||||
await _hospitalGroupIdentityUserRepository.BatchUpdateNoTrackingAsync(t => gaAdminList.Contains(t.IdentityUserId) && t.HospitalGroupId == addOrEditHospitalGroup.Id, u => new HospitalGroupIdentityUser() { IsManager = false });
|
||||
|
||||
await _hospitalGroupIdentityUserRepository.BatchUpdateNoTrackingAsync(t => addOrEditHospitalGroup.IdentityUserIdList.Contains(t.IdentityUserId) && t.HospitalGroupId == addOrEditHospitalGroup.Id, u => new HospitalGroupIdentityUser() { IsManager = true });
|
||||
|
||||
await _hospitalGroupIdentityUserRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<HospitalGroup, HospitalGroupView>()
|
||||
.ForMember(d => d.GAUserList, u => u.MapFrom(s => s.IdentityUserList.Where(t=>t.IsManager).Select(t => t.IdentityUser)))
|
||||
.ForMember(d => d.IdentityUserList, u => u.MapFrom(s => s.IdentityUserList.Where(t => t.IsManager).Select(t => new GAIdentityUserInfo() { IdentityUserId = t.IdentityUser.Id, IsDisabled = t.IsDisabled })));
|
||||
.ForMember(d => d.IdentityUserIdList, u => u.MapFrom(s => s.IdentityUserList.Where(t => t.IsManager).Select(t => t.IdentityUserId)));
|
||||
|
||||
|
||||
CreateMap<HospitalGroup, HospitalGroupAddOrEdit>().ReverseMap();
|
||||
|
|
|
|||
Loading…
Reference in New Issue