From ba1c7a7a8e6aa184155ee811d26c1a7c9f580109 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Fri, 19 Aug 2022 11:09:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reading/Dto/ReadingQuestionViewModel.cs | 11 ++++ .../Service/Reading/ReadingQuestionService.cs | 55 ++++++++++++++++++- .../Service/Reading/_MapConfig.cs | 5 ++ .../Reading/ReadingTableQuestionTrial.cs | 8 +-- 4 files changed, 74 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs index 9a8e6aadb..86f39d424 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs @@ -24,6 +24,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public string CriterionName { get; set; } } + + public class ReadingTableQuestionTrialView: ReadingTableQuestionSystemView + { + + } public class ReadingTableQuestionSystemView { public Guid Id { get; set; } @@ -77,6 +82,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto } + + public class ReadingTableQuestionTrialAddOrEdit: ReadingTableQuestionSystemAddOrEdit + { + + } + /// ReadingTableQuestionSystemAddOrEdit 列表查询参数模型 public class ReadingTableQuestionSystemAddOrEdit { diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs index 264f3e5e3..957ae8365 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs @@ -199,6 +199,25 @@ namespace IRaCIS.Application.Services } + + /// + /// 获取项目的表格问题 + /// + /// + /// + [HttpPost] + public async Task> GetReadingTableQuestionTrialList(ReadingTableQuestionSystemQuery inDto) + { + + var readingTableQuestionSystemQueryable = _readingTableQuestionTrialRepository + .WhereIf(inDto.TableQuestionType != null, x => x.TableQuestionType == inDto.TableQuestionType!) + .Where(x => x.ReadingQuestionId == inDto.ReadingQuestionId).ProjectTo(_mapper.ConfigurationProvider); + + var result = await readingTableQuestionSystemQueryable.ToListAsync(); + return result; + } + + /// /// 新增修改系统表格问题 /// @@ -214,6 +233,40 @@ namespace IRaCIS.Application.Services } + /// + /// 新增修改想想项目表格问题 + /// + /// + /// + [HttpPost] + public async Task AddOrUpdateReadingTableQuestionTrial(ReadingTableQuestionTrialAddOrEdit addOrEditReadingTableQuestionTrial) + { + + var entity = await _readingTableQuestionTrialRepository.InsertOrUpdateAsync(addOrEditReadingTableQuestionTrial, true); + + return ResponseOutput.Ok(entity.Id.ToString()); + + } + + + + /// + /// 删除项目表格问题 + /// + /// + /// + [HttpDelete("{Id:guid}")] + public async Task DeleteReadingTableQuestionTrial(Guid Id) + { + if (await _readingTableQuestionTrialRepository.AnyAsync(x => x.ParentId == Id || x.RelevanceId == Id)) + { + return ResponseOutput.NotOk("当前问题存在子问题 删除失败"); + } + + await _readingTableQuestionTrialRepository.DeleteFromQueryAsync(t => t.Id == Id); + var success = await _readingTableQuestionTrialRepository.SaveChangesAsync(); + return ResponseOutput.Result(success); + } /// /// 删除系统表格问题 @@ -228,7 +281,7 @@ namespace IRaCIS.Application.Services return ResponseOutput.NotOk("当前问题存在子问题 删除失败"); } - await _readingTableQuestionSystemRepository.BatchDeleteNoTrackingAsync(t => t.Id == Id); + await _readingTableQuestionSystemRepository.DeleteFromQueryAsync(t => t.Id == Id); var success= await _readingTableQuestionSystemRepository.SaveChangesAsync(); return ResponseOutput.Result(success); } diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs index afa51fcd7..cf4576938 100644 --- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs @@ -52,8 +52,13 @@ namespace IRaCIS.Core.Application.Service #region 阅片问题 CreateMap(); + + + CreateMap(); CreateMap(); + CreateMap(); + CreateMap(); diff --git a/IRaCIS.Core.Domain/Reading/ReadingTableQuestionTrial.cs b/IRaCIS.Core.Domain/Reading/ReadingTableQuestionTrial.cs index cdde5630e..29c0b3f06 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingTableQuestionTrial.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingTableQuestionTrial.cs @@ -109,11 +109,11 @@ namespace IRaCIS.Core.Domain.Models /// DataTableColumn /// public string DataTableColumn { get; set; } - + /// - /// TableQuestionType - /// - public int TableQuestionType { get; set; } + /// TableQuestionType + /// + public TableQuestionType? TableQuestionType { get; set; } /// /// DependParentId