优化添加字典
parent
f708d6c94a
commit
0a5bcb3eb2
|
@ -78,6 +78,43 @@ namespace IRaCIS.Application.Contracts
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AddBasicDicAndChild
|
||||||
|
{
|
||||||
|
[NotDefault]
|
||||||
|
public Guid ConfigTypeId { get; set; }
|
||||||
|
|
||||||
|
public bool IsEnable { get; set; }
|
||||||
|
|
||||||
|
public string Code { get; set; } = String.Empty;
|
||||||
|
|
||||||
|
public int ShowOrder { get; set; }
|
||||||
|
public string Description { get; set; } = String.Empty;
|
||||||
|
|
||||||
|
public DicDataTypeEnum DataTypeEnum { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public List<AddBasicDicChild> ChildList { get; set;}=new List<AddBasicDicChild>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class AddBasicDicChild
|
||||||
|
{
|
||||||
|
public string Code { get; set; } = String.Empty;
|
||||||
|
public string Value { get; set; } = String.Empty;
|
||||||
|
|
||||||
|
public string ValueCN { get; set; } = String.Empty;
|
||||||
|
|
||||||
|
public string ChildGroup { get; set; } = String.Empty;
|
||||||
|
|
||||||
|
public int ShowOrder { get; set; }
|
||||||
|
|
||||||
|
public string Description { get; set; } = String.Empty;
|
||||||
|
|
||||||
|
public bool IsEnable { get; set; } = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class GetCriterionDictionaryInDto
|
public class GetCriterionDictionaryInDto
|
||||||
{
|
{
|
||||||
public Guid? ReadingCriterionId { get; set; }
|
public Guid? ReadingCriterionId { get; set; }
|
||||||
|
@ -113,7 +150,7 @@ namespace IRaCIS.Application.Contracts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class BasicDicSelectCopy:BasicDicSelect
|
public class BasicDicSelectCopy : BasicDicSelect
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -138,12 +175,12 @@ namespace IRaCIS.Application.Contracts
|
||||||
|
|
||||||
public DicDataTypeEnum DataTypeEnum { get; set; }
|
public DicDataTypeEnum DataTypeEnum { get; set; }
|
||||||
|
|
||||||
public bool IsEnumInt => System.Text.RegularExpressions.Regex.IsMatch(Code, @"^[-+]?\d*$") && DataTypeEnum== DicDataTypeEnum.Enum;
|
public bool IsEnumInt => System.Text.RegularExpressions.Regex.IsMatch(Code, @"^[-+]?\d*$") && DataTypeEnum == DicDataTypeEnum.Enum;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BasicDicQuery:PageInput
|
public class BasicDicQuery : PageInput
|
||||||
{
|
{
|
||||||
public string? keyInfo { get; set; }
|
public string? keyInfo { get; set; }
|
||||||
|
|
||||||
|
@ -181,7 +218,7 @@ namespace IRaCIS.Application.Contracts
|
||||||
|
|
||||||
public class DicViewModelDTO : AddOrUpdateDicDTO
|
public class DicViewModelDTO : AddOrUpdateDicDTO
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -127,16 +127,6 @@ namespace IRaCIS.Application.Services
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//// 验证阅片标准是否可禁用
|
|
||||||
//if (!addOrEditBasic.IsEnable&&addOrEditBasic.Id!=null)
|
|
||||||
//{
|
|
||||||
// var result = await _readingQuestionService.SetSystemCriterionDisable(addOrEditBasic.Id.Value,addOrEditBasic.ParentId);
|
|
||||||
// if (!result.IsSuccess)
|
|
||||||
// {
|
|
||||||
// return result;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
if (addOrEditBasic.Id != null && addOrEditBasic.ParentId==null)
|
if (addOrEditBasic.Id != null && addOrEditBasic.ParentId==null)
|
||||||
{
|
{
|
||||||
|
@ -153,6 +143,42 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.Ok(entity.Id.ToString());
|
return ResponseOutput.Ok(entity.Id.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加字典 的同时 一起添加子项 --New
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="addBasicDicAndChild"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IResponseOutput> AddBasicDicAndChild(AddBasicDicAndChild addBasicDicAndChild)
|
||||||
|
{
|
||||||
|
var verifyExp1 = new EntityVerifyExp<Dictionary>()
|
||||||
|
{
|
||||||
|
VerifyExp = t => t.Code == addBasicDicAndChild.Code && t.ParentId == null,
|
||||||
|
VerifyMsg = $"已有{addBasicDicAndChild.Code}名称的字典",
|
||||||
|
IsVerify = true
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var entity = await _dicRepository.InsertFromDTOAsync(addBasicDicAndChild, false, verifyExp1);
|
||||||
|
|
||||||
|
var childList = _mapper.Map<List<Dictionary>>(addBasicDicAndChild.ChildList);
|
||||||
|
|
||||||
|
foreach (var item in childList)
|
||||||
|
{
|
||||||
|
item.DataTypeEnum = addBasicDicAndChild.DataTypeEnum;
|
||||||
|
item.ParentId = entity.Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
await _dicRepository.AddRangeAsync(childList);
|
||||||
|
|
||||||
|
await _dicRepository.SaveChangesAsync();
|
||||||
|
return ResponseOutput.Ok(entity.Id.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取子项数组
|
/// 获取子项数组
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -227,8 +253,6 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据父亲字典分组 获取子项
|
/// 根据父亲字典分组 获取子项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -39,6 +39,9 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
CreateMap<AddOrEditBasicDic, Dictionary>().ReverseMap();
|
CreateMap<AddOrEditBasicDic, Dictionary>().ReverseMap();
|
||||||
|
|
||||||
|
CreateMap<AddBasicDicAndChild, Dictionary>() .ForMember(o => o.ChildList, t => t.Ignore());
|
||||||
|
CreateMap<AddBasicDicChild, Dictionary>();
|
||||||
|
|
||||||
CreateMap<Dictionary, BasicDicSelectCopy>()
|
CreateMap<Dictionary, BasicDicSelectCopy>()
|
||||||
.ForMember(o => o.ParentChildCodeEnum, t => t.MapFrom(u => u.Parent.ChildCodeEnum))
|
.ForMember(o => o.ParentChildCodeEnum, t => t.MapFrom(u => u.Parent.ChildCodeEnum))
|
||||||
.ForMember(o => o.Value, t => t.MapFrom(u => u.MappedValue))
|
.ForMember(o => o.Value, t => t.MapFrom(u => u.MappedValue))
|
||||||
|
|
Loading…
Reference in New Issue