From b7b6080d87fe7ea027fd553ad18983e68d6fa58e Mon Sep 17 00:00:00 2001 From: xusc Date: Tue, 12 Mar 2024 16:56:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=A8=E6=80=81=E6=A1=A3?= =?UTF-8?q?=E6=A1=88=E7=9A=84=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SysEnumKey/SysEnumKeyAppService.cs | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/aspnet-core/ICS.Application/Business/Service/基础设置/SysEnumKey/SysEnumKeyAppService.cs b/src/aspnet-core/ICS.Application/Business/Service/基础设置/SysEnumKey/SysEnumKeyAppService.cs index c7cf30b8..6d0d23cd 100644 --- a/src/aspnet-core/ICS.Application/Business/Service/基础设置/SysEnumKey/SysEnumKeyAppService.cs +++ b/src/aspnet-core/ICS.Application/Business/Service/基础设置/SysEnumKey/SysEnumKeyAppService.cs @@ -159,19 +159,37 @@ namespace ICS.Application.Business.Service [AbpAuthorize(SysEnumKeyPermissions.SysEnumKey_Delete)] public async Task Delete(EntityDto input) { - await _sysEnumKeyManager.DeleteAsync(input.Id); - var entity = _repository.Get(input.Id); - if (entity != null) + var entity = await _repository.GetAsync(input.Id); + if (entity == null) { - //删除子表 - _derepository.Delete(x => x.EnumKey == entity.EnumKey); + throw new UserFriendlyException(L("NoExistsCurrentCode", "xx")); } + #region //删除验证 + //删除子表 + _derepository.Delete(x => x.EnumKey == entity.EnumKey); + + #endregion + + await _sysEnumKeyManager.DeleteAsync(input.Id); } [AbpAuthorize(SysEnumKeyPermissions.SysEnumKey_BatchDelete)] public async Task BatchDelete(List input) { + var entitys = await _repository.GetAllListAsync(x => input.Contains(x.Id)); + if (entitys == null) + { + throw new UserFriendlyException(L("NoExistsCurrentCode", "xx")); + } + #region //删除验证 + foreach (var item in entitys) + { + //删除子表 + _derepository.Delete(x => x.EnumKey == item.EnumKey); + } + #endregion + await _sysEnumKeyManager.BatchDelete(input); }