diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index a39684122..7c283a183 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -605,11 +605,17 @@ namespace IRaCIS.Core.Application.Service { sysUserInfo = (await _identityUserRepository.Where(t => t.UserRoleList.Any(t => t.DoctorId == doctorId || t.IdentityUser.EMail == doctor.EMail), true).Include(t => t.UserRoleList).FirstOrDefaultAsync()).IfNullThrowException(); + + var findRole = sysUserInfo.UserRoleList.FirstOrDefault(t => t.UserTypeId == userType.Id); //不存在该角色,那么就加入该角色 - if (!sysUserInfo.UserRoleList.Any(t => t.UserTypeId == userType.Id)) + if (findRole == null) { sysUserInfo.UserRoleList.Add(new UserRole() { DoctorId = doctorId, UserTypeEnum = UserTypeEnum.IndependentReviewer, UserTypeId = userType.Id }); } + else + { + findRole.IsUserRoleDisabled = false; + } sysUserInfo.Status = UserStateEnum.Enable;