From 747ad313e67a2ff77cffc82ecba1a603dab77867 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 28 Jun 2023 17:29:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=B7=BB=E5=8A=A0=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/InternationalizationViewModel.cs | 9 +++++++ .../Common/InternationalizationService.cs | 26 +++++++++++++++++++ .../Service/Common/_MapConfig.cs | 3 +++ 3 files changed, 38 insertions(+) diff --git a/IRaCIS.Core.Application/Service/Common/DTO/InternationalizationViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/InternationalizationViewModel.cs index 5f2e25a59..371c9a7d4 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/InternationalizationViewModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/InternationalizationViewModel.cs @@ -45,6 +45,15 @@ namespace IRaCIS.Core.Application.ViewModel public int InternationalizationType { get; set; } } + public class BatchAddInternationalization + { + public int InternationalizationType { get; set; } + + public int State { get; set; } + + public List AddList { get; set; } + } + public class InternationalizationSimpleDto { diff --git a/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs b/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs index a076d8bd6..1c7497836 100644 --- a/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs +++ b/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs @@ -63,6 +63,32 @@ namespace IRaCIS.Core.Application.Service return pageList; } + [HttpPost] + public async Task BatchAddInternationalization(BatchAddInternationalization batchAdd) + { + foreach (var item in batchAdd.AddList) + { + + var mapItem = _mapper.Map(item); + + mapItem.InternationalizationType = batchAdd.InternationalizationType; + mapItem.State = batchAdd.State; + + var verifyExp1 = new EntityVerifyExp() + { + VerifyExp = t => t.Code == mapItem.Code && t.InternationalizationType == mapItem.InternationalizationType, + + VerifyMsg = $"该类型已有{item.Code}名称的国际化标识", + IsVerify = true + }; + + var entity = await _internationalizationRepository.InsertOrUpdateAsync(mapItem, false, verifyExp1); + } + + await _internationalizationRepository.SaveChangesAsync(); + + return ResponseOutput.Ok(); + } public async Task AddOrUpdateInternationalization(InternationalizationAddOrEdit addOrEditInternationalization) { diff --git a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs index 523e15044..7a4af27fd 100644 --- a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs @@ -57,6 +57,9 @@ namespace IRaCIS.Core.Application.Service CreateMap(); CreateMap().ReverseMap(); + CreateMap(); + + CreateMap(); CreateMap().ReverseMap();