From ec565dcba3b9bf06bea6645516ae728ac70a7c47 Mon Sep 17 00:00:00 2001 From: hanpaopao <510423039@qq.com> Date: Fri, 15 Nov 2024 17:28:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AF=AD=E8=A8=80=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8F=AA=E8=BF=94=E5=9B=9E=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E5=92=8C=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Languages/LanguageAppService.cs | 3 +-- .../Languages/EfCoreLanguageRepository.cs | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/aspnet-core/modules/LanguageManagement/src/Lion.AbpPro.LanguageManagement.Application/Languages/LanguageAppService.cs b/aspnet-core/modules/LanguageManagement/src/Lion.AbpPro.LanguageManagement.Application/Languages/LanguageAppService.cs index 6d27aa7d7..fe30a79ca 100644 --- a/aspnet-core/modules/LanguageManagement/src/Lion.AbpPro.LanguageManagement.Application/Languages/LanguageAppService.cs +++ b/aspnet-core/modules/LanguageManagement/src/Lion.AbpPro.LanguageManagement.Application/Languages/LanguageAppService.cs @@ -22,8 +22,7 @@ public virtual async Task> AllListAsync() { var languages = await _languageManager.ListAsync(); var list = ObjectMapper.Map, List>(languages); - // 前端只支持这2种语言,其他语言不显示 - return list.Where(e => e.CultureName == "zh-Hans" || e.CultureName == "en").ToList(); + return list.ToList(); } diff --git a/aspnet-core/modules/LanguageManagement/src/Lion.AbpPro.LanguageManagement.EntityFrameworkCore/EntityFrameworkCore/Languages/EfCoreLanguageRepository.cs b/aspnet-core/modules/LanguageManagement/src/Lion.AbpPro.LanguageManagement.EntityFrameworkCore/EntityFrameworkCore/Languages/EfCoreLanguageRepository.cs index 7b8387c4f..c26ab77df 100644 --- a/aspnet-core/modules/LanguageManagement/src/Lion.AbpPro.LanguageManagement.EntityFrameworkCore/EntityFrameworkCore/Languages/EfCoreLanguageRepository.cs +++ b/aspnet-core/modules/LanguageManagement/src/Lion.AbpPro.LanguageManagement.EntityFrameworkCore/EntityFrameworkCore/Languages/EfCoreLanguageRepository.cs @@ -14,10 +14,11 @@ public EfCoreLanguageRepository(IDbContextProvider public virtual async Task> ListAsync(bool? isEnabled = null) { return await (await GetDbSetAsync()) + .Where(e => e.CultureName == "zh-Hans" || e.CultureName == "en") .WhereIf(isEnabled != null, e => e.IsEnabled == isEnabled) .ToListAsync(); } - + /// /// 查询语言 /// @@ -27,6 +28,7 @@ public virtual async Task> ListAsync(bool? isEnabled = null) public async Task> ListAsync(int maxResultCount = 10, int skipCount = 0, string filter = null) { return await (await GetDbSetAsync()) + .Where(e => e.CultureName == "zh-Hans" || e.CultureName == "en") .WhereIf(filter.IsNotNullOrWhiteSpace(), e => e.CultureName.Contains(filter) || e.UiCultureName.Contains(filter) || e.DisplayName.Contains(filter)) .OrderByDescending(e => e.CreationTime) .PageBy(skipCount, maxResultCount) @@ -37,9 +39,10 @@ public async Task> ListAsync(int maxResultCount = 10, int skipCou /// 获取总条数 /// /// 查询条件 cultureName or uiCultureName or displayName - public async Task CountAsync( string filter = null) + public async Task CountAsync(string filter = null) { return await (await GetDbSetAsync()) + .Where(e => e.CultureName == "zh-Hans" || e.CultureName == "en") .WhereIf(filter.IsNotNullOrWhiteSpace(), e => e.CultureName.Contains(filter) || e.UiCultureName.Contains(filter) || e.DisplayName.Contains(filter)) .CountAsync(); }