修改一版

Test.EIImageViewer
he 2022-10-17 16:23:30 +08:00
parent 2c22c17566
commit 79db330e1b
3 changed files with 100 additions and 5 deletions

View File

@ -20,7 +20,24 @@ namespace IRaCIS.Application.Contracts
public class GetTrialConfigDictionaryListOutDto
{
public Guid Id { get; set; }
public Guid DictionaryId { get; set; }
public int ShowOrder { get; set; }
public string Description { get; set; } = string.Empty;
public string Code { get; set; }
public string ParentCode { get; set; }
public string ChildGroup { get; set; }
public string Value { get; set; } = string.Empty;
public string ValueCN { get; set; } = string.Empty;
}
public class GetTrialConfigDictionaryListInDto
@ -33,6 +50,19 @@ namespace IRaCIS.Application.Contracts
}
public class GetTrialConfigDictionarySelectOutDto: BasicDicView
{
public bool IsAdded { get; set; }
}
public class GetTrialConfigDictionarySelectInDto
{
[NotDefault]
public Guid TrialId { get; set; }
public string Code { get; set; }
}
public class AddTrialConfigDictionaryListInDto
{
[NotDefault]

View File

@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Infra.EFCore.Common;
namespace IRaCIS.Application.Services
{
@ -136,11 +137,52 @@ namespace IRaCIS.Application.Services
}
/// <summary>
/// 删除项目字典
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpPost("{Id:guid}")]
public async Task<IResponseOutput> DeleteTrialConfigDictionary(Guid Id)
{
await _trialConfigDictionaryRepository.DeleteFromQueryAsync(Id);
await _trialConfigDictionaryRepository.SaveChangesAsync();
return ResponseOutput.Ok(true);
}
/// <summary>
/// 获取待添加的项目字典数据
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<List<GetTrialConfigDictionarySelectOutDto>> GetTrialConfigDictionarySelect(GetTrialConfigDictionarySelectInDto inDto)
{
var parentId = await _dicRepository.Where(x => x.Code == inDto.Code).Select(x => x.Id).FirstNotNullAsync();
List<GetTrialConfigDictionarySelectOutDto> result= await _dicRepository.Where(t => t.ParentId == parentId)
.OrderBy(t => t.ShowOrder).ProjectTo<GetTrialConfigDictionarySelectOutDto>(_mapper.ConfigurationProvider).ToListAsync();
List<Guid> addIds = await _trialConfigDictionaryRepository.Where(x => x.Dictionary.ParentId == parentId).Select(x => x.DictionaryId).ToListAsync();
result.ForEach(x => {
x.IsAdded = addIds.Contains(x.Id.Value);
});
return result;
}
/// <summary>
/// 批量添加项目字典
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> AddTrialConfigDictionaryList(AddTrialConfigDictionaryListInDto inDto)
{
@ -155,11 +197,33 @@ namespace IRaCIS.Application.Services
return ResponseOutput.Ok(true);
}
/// <summary>
/// 获取项目字典
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<List<GetTrialConfigDictionaryListOutDto>> GetTrialConfigDictionaryList(GetTrialConfigDictionaryListInDto inDto)
{
List<GetTrialConfigDictionaryListOutDto> result = await _trialConfigDictionaryRepository.Where(x => x.TrialId == inDto.TrialId)
.WhereIf(!inDto.ParentCode.IsNullOrEmpty(), x => x.Dictionary.Parent.Code == inDto.ParentCode)
.Select(x => new GetTrialConfigDictionaryListOutDto()
{
Id=x.Id,
DictionaryId=x.DictionaryId,
ChildGroup = x.Dictionary.ChildGroup,
Code = x.Dictionary.Code,
Description = x.Dictionary.Description,
ShowOrder = x.Dictionary.ShowOrder,
ParentCode = x.Dictionary.Parent.Code,
Value = x.Dictionary.Value,
ValueCN = x.Dictionary.ValueCN
}).OrderBy(x => x.ParentCode).ThenBy(x => x.ShowOrder).ToListAsync();
return result;
}
//public async Task<> GetTrialConfigDictionaryList(GetTrialConfigDictionaryListInDto inDto)
//{
//}
/// <summary>

View File

@ -30,7 +30,8 @@ namespace IRaCIS.Core.Application.Service
CreateMap<SystemBasicDataAddOrEdit, SystemBasicData>().ReverseMap();
CreateMap<Dictionary, GetTrialConfigDictionarySelectOutDto>()
.ForMember(o => o.ConfigType, t => t.MapFrom(u => u.ConfigDictionary.Code));
CreateMap<Dictionary, BasicDicView>()
.ForMember(o => o.ConfigType, t => t.MapFrom(u => u.ConfigDictionary.Code));