优化字典添加
parent
79ffa3e29a
commit
398a804b41
|
@ -10936,6 +10936,13 @@
|
||||||
<param name="addOrEditBasic"></param>
|
<param name="addOrEditBasic"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Application.Services.DictionaryService.AddBasicDicAndChild(IRaCIS.Application.Contracts.AddBasicDicAndChild)">
|
||||||
|
<summary>
|
||||||
|
添加字典 的同时 一起添加子项 --New
|
||||||
|
</summary>
|
||||||
|
<param name="addBasicDicAndChild"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Application.Services.DictionaryService.GetBasicDicList(IRaCIS.Application.Contracts.BasicDicQuery)">
|
<member name="M:IRaCIS.Application.Services.DictionaryService.GetBasicDicList(IRaCIS.Application.Contracts.BasicDicQuery)">
|
||||||
<summary>
|
<summary>
|
||||||
New 查询条件
|
New 查询条件
|
||||||
|
|
|
@ -165,7 +165,40 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,39 @@ 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>
|
||||||
/// New 查询条件
|
/// New 查询条件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -39,6 +39,10 @@ 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