修改更新用户bug
continuous-integration/drone/push Build is passing Details

Test_HIR_Net8
hang 2025-08-26 13:06:53 +08:00
parent 98547ef145
commit 1fd2c01612
1 changed files with 6 additions and 6 deletions

View File

@ -607,7 +607,7 @@ namespace IRaCIS.Core.Application.Service
//await VerifyUserPhoneAsync(model.Id, model.UserTypeId, model.Phone);
var user = await _identityUserRepository.Where(t => t.Id == model.Id, true).Include(t => t.UserRoleList)/*.Include(t => t.IdentityUserHospitalGroupList)*/.FirstOrDefaultAsync();
var user = await _identityUserRepository.Where(t => t.Id == model.Id, true).Include(t => t.UserRoleList).Include(t => t.IdentityUserHospitalGroupList).FirstOrDefaultAsync();
if (user == null) return Null404NotFound(user);
@ -657,15 +657,15 @@ namespace IRaCIS.Core.Application.Service
}
//var existHospitalGroupIdList = user.IdentityUserHospitalGroupList.Select(t => t.HospitalGroupId).ToList();
var existHospitalGroupIdList = user.IdentityUserHospitalGroupList.Select(t => t.HospitalGroupId).ToList();
//var removeIdList = existHospitalGroupIdList.Except(model.HospitalGroupIdList).ToList();
var removeIdList = existHospitalGroupIdList.Except(model.HospitalGroupIdList).ToList();
//user.IdentityUserHospitalGroupList = user.IdentityUserHospitalGroupList.Where(t => !removeIdList.Contains(t.HospitalGroupId)).ToList();
user.IdentityUserHospitalGroupList = user.IdentityUserHospitalGroupList.Where(t => !removeIdList.Contains(t.HospitalGroupId)).ToList();
//var addIdList = model.HospitalGroupIdList.Except(existHospitalGroupIdList).ToList();
var addIdList = model.HospitalGroupIdList.Except(existHospitalGroupIdList).ToList();
//user.IdentityUserHospitalGroupList.AddRange(addIdList.Select(t => new HospitalGroupIdentityUser() { HospitalGroupId = t, IsManager = false, IdentityUserId = user.Id }));
user.IdentityUserHospitalGroupList.AddRange(addIdList.Select(t => new HospitalGroupIdentityUser() { HospitalGroupId = t, IsManager = false, IdentityUserId = user.Id }));
var success = await _identityUserRepository.SaveChangesAsync();