修改映射方式
continuous-integration/drone/push Build is passing Details

Test_HIR_Net8
hang 2025-08-26 11:51:06 +08:00
parent efa9e511c3
commit 98547ef145
5 changed files with 13 additions and 12 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();

View File

@ -140,7 +140,8 @@ namespace IRaCIS.Core.Application.Service
CreateMap<IdentityUser, UserRole>();
CreateMap<UserCommand, IdentityUser>();
CreateMap<UserCommand, IdentityUser>()
.ForMember(d => d.UserRoleList, c => c.Ignore());
CreateMap<IdentityUser, UserBasicInfo>()
.ForMember(d => d.IdentityUserId, c => c.MapFrom(t => t.Id))

View File

@ -61,7 +61,7 @@ namespace IRaCIS.Core.Domain.Models
[Comment("后台 - 系统真实账户表")]
[Table("IdentityUser")]
public class IdentityUser : BaseFullAuditEntityNoNavigat
public class IdentityUser : BaseFullAuditEntity
{
[JsonIgnore]

View File

@ -5,7 +5,7 @@ namespace IRaCIS.Core.Domain.Models;
[Comment("后台 - 系统账户")]
[Table("User")]
public class UserRole : BaseFullAuditEntityNoNavigat
public class UserRole : BaseFullAuditEntity
{
#region 导航属性

View File

@ -31,12 +31,12 @@
<PackageReference Include="Hangfire.Core" Version="1.8.18" />
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.19" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.19">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.15" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.15">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.19">
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>