From a2b8763dad6587dda3593ff38edd033aaf5bf8b5 Mon Sep 17 00:00:00 2001 From: colin Date: Mon, 28 Apr 2025 20:20:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(platform):=20=E7=BC=96=E8=BE=91=E6=97=B6?= =?UTF-8?q?=E5=BA=94=E6=A3=80=E6=9F=A5=E6=98=AF=E5=90=A6=E9=87=8D=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LINGYUN/Platform/Datas/Dto/DataMoveDto.cs | 3 +++ .../LINGYUN/Platform/Datas/DataAppService.cs | 4 ++++ .../LINGYUN/Platform/Layouts/LayoutAppService.cs | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataMoveDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataMoveDto.cs index 45801cf33..86e61aa42 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataMoveDto.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Datas/Dto/DataMoveDto.cs @@ -1,8 +1,11 @@ using System; +using System.ComponentModel; namespace LINGYUN.Platform.Datas; public class DataMoveDto { + + [DisplayName("DisplayName:ParentData")] public Guid? ParentId { get; set; } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Datas/DataAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Datas/DataAppService.cs index 1d6b418f1..dbd934de4 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Datas/DataAppService.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Datas/DataAppService.cs @@ -130,6 +130,10 @@ public class DataAppService : PlatformApplicationServiceBase, IDataAppService if (!string.Equals(data.Name, input.Name, StringComparison.InvariantCultureIgnoreCase)) { + if (await DataRepository.FindByNameAsync(input.Name) != null) + { + throw new UserFriendlyException(L["DuplicateData", input.Name]); + } data.Name = input.Name; } if (!string.Equals(data.DisplayName, input.DisplayName, StringComparison.InvariantCultureIgnoreCase)) diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs index a2e554aed..3dc5735f1 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs @@ -94,6 +94,10 @@ public class LayoutAppService : PlatformApplicationServiceBase, ILayoutAppServic if (!string.Equals(layout.Name, input.Name, StringComparison.InvariantCultureIgnoreCase)) { + if (await LayoutRepository.FindByNameAsync(input.Name) != null) + { + throw new UserFriendlyException(L["DuplicateLayout", input.Name]); + } layout.Name = input.Name; } if (!string.Equals(layout.DisplayName, input.DisplayName, StringComparison.InvariantCultureIgnoreCase))