修改映射方式
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
efa9e511c3
commit
98547ef145
|
|
@ -607,7 +607,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
//await VerifyUserPhoneAsync(model.Id, model.UserTypeId, model.Phone);
|
//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);
|
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();
|
var success = await _identityUserRepository.SaveChangesAsync();
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,8 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
CreateMap<IdentityUser, UserRole>();
|
CreateMap<IdentityUser, UserRole>();
|
||||||
|
|
||||||
CreateMap<UserCommand, IdentityUser>();
|
CreateMap<UserCommand, IdentityUser>()
|
||||||
|
.ForMember(d => d.UserRoleList, c => c.Ignore());
|
||||||
|
|
||||||
CreateMap<IdentityUser, UserBasicInfo>()
|
CreateMap<IdentityUser, UserBasicInfo>()
|
||||||
.ForMember(d => d.IdentityUserId, c => c.MapFrom(t => t.Id))
|
.ForMember(d => d.IdentityUserId, c => c.MapFrom(t => t.Id))
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
|
|
||||||
[Comment("后台 - 系统真实账户表")]
|
[Comment("后台 - 系统真实账户表")]
|
||||||
[Table("IdentityUser")]
|
[Table("IdentityUser")]
|
||||||
public class IdentityUser : BaseFullAuditEntityNoNavigat
|
public class IdentityUser : BaseFullAuditEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace IRaCIS.Core.Domain.Models;
|
||||||
|
|
||||||
[Comment("后台 - 系统账户")]
|
[Comment("后台 - 系统账户")]
|
||||||
[Table("User")]
|
[Table("User")]
|
||||||
public class UserRole : BaseFullAuditEntityNoNavigat
|
public class UserRole : BaseFullAuditEntity
|
||||||
{
|
{
|
||||||
#region 导航属性
|
#region 导航属性
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,12 @@
|
||||||
<PackageReference Include="Hangfire.Core" Version="1.8.18" />
|
<PackageReference Include="Hangfire.Core" Version="1.8.18" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="8.0.10" />
|
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="8.0.10" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.19" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.15" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.19">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.15">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.19">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.10">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue