添加用户修改
continuous-integration/drone/push Build is passing Details

Uat_IRC_Net8
hang 2024-12-25 14:53:19 +08:00
parent 1d4eedf5bb
commit 340f5c580e
3 changed files with 12 additions and 8 deletions

View File

@ -140,7 +140,7 @@ public static class AppSettings
case nameof(Doctor):
return IRaCISBasicConfig.DoctorCodePrefix + codeInt.ToString("D4");
case nameof(UserRole):
case nameof(IdentityUser):
return IRaCISBasicConfig.UserCodePrefix + codeInt.ToString("D4");
case nameof(QCChallenge):

View File

@ -648,7 +648,6 @@ namespace IRaCIS.Core.Application.Service
if (user == null) return Null404NotFound(user);
var existDBRoleList = user.UserRoleList;
if (user.Status != model.Status)
{
@ -670,24 +669,25 @@ namespace IRaCIS.Core.Application.Service
foreach (var role in model.UserRoleList)
{
var find = existDBRoleList.FirstOrDefault(t => t.UserTypeEnum == role.UserTypeEnum && t.UserTypeId == role.UserTypeId);
var find = user.UserRoleList.FirstOrDefault(t => t.UserTypeEnum == role.UserTypeEnum && t.UserTypeId == role.UserTypeId);
if (find != null)
if (find != null )
{
find.IsUserRoleDisabled = false;
find.IsUserRoleDisabled = role.IsUserRoleDisabled;
}
else
{
var addRole = _mapper.Map<UserRole>(model);
addRole.Id = NewId.NextSequentialGuid();
addRole.IdentityUserId = user.Id;
addRole.UserTypeEnum = role.UserTypeEnum;
addRole.UserTypeId = role.UserTypeId;
existDBRoleList.Add(addRole);
user.UserRoleList.Add(addRole);
}
}
user.UserRoleList = existDBRoleList;
var success = await _userRoleRepository.SaveChangesAsync();

View File

@ -17,7 +17,11 @@ namespace IRaCIS.Core.Application.Service
CreateMap<UserCommand, UserRole>().ForMember(d => d.UserCode, x => x.Ignore());
CreateMap<UserCommand, IdentityUser>().ForMember(d => d.UserCode, x => x.Ignore());
CreateMap<UserCommand, IdentityUser>()
.ForMember(d => d.UserCode, x => x.Ignore())
.ForMember(d => d.UserRoleList, x => x.Ignore());
CreateMap<UserType, UserTypeMenuAddOrEdit>().ReverseMap()
.ForMember(t => t.UserTypeMenuList, u => u.MapFrom(c => c.MenuIds))
.ForMember(t => t.UserTypeGroupList, u => u.MapFrom(c => c.UserTypeGroupIdList));