diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.EntityFrameworkCore/LINGYUN/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.EntityFrameworkCore/LINGYUN/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs index ccbfb55a8..ee24032c2 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.EntityFrameworkCore/LINGYUN/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.EntityFrameworkCore/LINGYUN/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs @@ -1,4 +1,5 @@ using Microsoft.EntityFrameworkCore; +using System; using System.Collections.Generic; using System.Linq; using System.Linq.Dynamic.Core; @@ -36,6 +37,10 @@ public class EfCoreOrganizationUnitRepository : Volo.Abp.Identity.EntityFramewor bool includeDetails = false, CancellationToken cancellationToken = default) { + if (sorting.IsNullOrWhiteSpace()) + { + sorting = nameof(OrganizationUnit.Code); + } return await (await GetDbSetAsync()) .IncludeDetails(includeDetails) .Where(specification.ToExpression()) diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.EntityFrameworkCore/LINGYUN/Abp/IdentityServer/Grants/EfCorePersistentGrantRepository.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.EntityFrameworkCore/LINGYUN/Abp/IdentityServer/Grants/EfCorePersistentGrantRepository.cs index 50dbcfbc9..47248469a 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.EntityFrameworkCore/LINGYUN/Abp/IdentityServer/Grants/EfCorePersistentGrantRepository.cs +++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.EntityFrameworkCore/LINGYUN/Abp/IdentityServer/Grants/EfCorePersistentGrantRepository.cs @@ -36,11 +36,14 @@ namespace LINGYUN.Abp.IdentityServer.Grants public async virtual Task> GetListAsync(string subjectId = null, string filter = null, string sorting = "CreationTime", int skipCount = 1, int maxResultCount = 10, CancellationToken cancellation = default) { + if (sorting.IsNullOrWhiteSpace()) + { + sorting = nameof(PersistedGrant.CreationTime); + } return await (await GetDbSetAsync()) .WhereIf(!subjectId.IsNullOrWhiteSpace(), x => x.SubjectId.Equals(subjectId)) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Type.Contains(filter) || x.ClientId.Contains(filter) || x.Key.Contains(filter)) - .OrderBy(sorting ?? nameof(PersistedGrant.CreationTime)) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellation)); } diff --git a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreTextRepository.cs b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreTextRepository.cs index 4d058022b..43ca744e7 100644 --- a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreTextRepository.cs +++ b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreTextRepository.cs @@ -121,11 +121,16 @@ namespace LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore string filter = null, string sorting = nameof(TextDifference.Key)) { + if (sorting.IsNullOrWhiteSpace()) + { + sorting = nameof(TextDifference.Key); + } + var textQuery = (await GetDbSetAsync()) .Where(x => x.CultureName.Equals(cultureName)) .WhereIf(!resourceName.IsNullOrWhiteSpace(), x => x.ResourceName.Equals(resourceName)) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Key.Contains(filter)) - .OrderBy(sorting ?? nameof(TextDifference.Key)); + .OrderBy(sorting); var targetTextQuery = (await GetDbSetAsync()) .Where(x => x.CultureName.Equals(targetCultureName)) diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/GetLayoutListInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/GetLayoutListInput.cs index eb7889a83..080d341c0 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/GetLayoutListInput.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/GetLayoutListInput.cs @@ -8,8 +8,6 @@ namespace LINGYUN.Platform.Layouts { public string Filter { get; set; } - public bool Reverse { get; set; } - [DynamicStringLength(typeof(LayoutConsts), nameof(LayoutConsts.MaxFrameworkLength))] public string Framework { get; set; } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs index 958a1db0b..c9b847857 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs @@ -12,8 +12,6 @@ namespace LINGYUN.Platform.Menus public string Filter { get; set; } - public bool Reverse { get; set; } - public Guid? ParentId { get; set; } public Guid? LayoutId { get; set; } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs index 4db785ea5..528809a90 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs @@ -86,7 +86,7 @@ namespace LINGYUN.Platform.Menus public async virtual Task> GetAllAsync(MenuGetAllInput input) { var menus = await MenuRepository.GetAllAsync( - input.Filter, input.Sorting, input.Reverse, + input.Filter, input.Sorting, input.Framework, input.ParentId, input.LayoutId); return new ListResultDto( @@ -99,7 +99,7 @@ namespace LINGYUN.Platform.Menus var count = await MenuRepository.GetCountAsync(input.Filter, input.Framework, input.ParentId, input.LayoutId); var menus = await MenuRepository.GetListAsync( - input.Filter, input.Sorting, input.Reverse, + input.Filter, input.Sorting, input.Framework, input.ParentId, input.LayoutId, input.SkipCount, input.MaxResultCount); diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/IDataRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/IDataRepository.cs index 22bcc8020..5526eb14c 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/IDataRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/IDataRepository.cs @@ -25,7 +25,7 @@ namespace LINGYUN.Platform.Datas Task> GetPagedListAsync( string filter = "", - string sotring = nameof(Data.Code), + string sorting = nameof(Data.Code), bool includeDetails = false, int skipCount = 0, int maxResultCount = 10, diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs index b1b0fd867..58571b70b 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs @@ -29,7 +29,6 @@ namespace LINGYUN.Platform.Layouts string framework = "", string filter = "", string sorting = nameof(Layout.Name), - bool reverse = false, bool includeDetails = false, int skipCount = 0, int maxResultCount = 10, diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs index 445f93d82..d7af723ca 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs @@ -95,7 +95,6 @@ namespace LINGYUN.Platform.Menus Task> GetListAsync( string filter = "", string sorting = nameof(Menu.Code), - bool reverse = false, string framework = "", Guid? parentId = null, Guid? layoutId = null, @@ -106,7 +105,6 @@ namespace LINGYUN.Platform.Menus Task> GetAllAsync( string filter = "", string sorting = nameof(Menu.Code), - bool reverse = false, string framework = "", Guid? parentId = null, Guid? layoutId = null, diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Datas/EfCoreDataRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Datas/EfCoreDataRepository.cs index 9ee61afac..85ec18867 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Datas/EfCoreDataRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Datas/EfCoreDataRepository.cs @@ -8,6 +8,7 @@ using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; +using static System.Runtime.InteropServices.JavaScript.JSType; namespace LINGYUN.Platform.Datas { @@ -56,13 +57,16 @@ namespace LINGYUN.Platform.Datas public async virtual Task> GetPagedListAsync( string filter = "", - string sotring = "Code", + string sorting = "Code", bool includeDetails = false, int skipCount = 0, int maxResultCount = 10, CancellationToken cancellationToken = default) { - sotring ??= nameof(Data.Code); + if (sorting.IsNullOrWhiteSpace()) + { + sorting = nameof(Data.Code); + } var dbSet = await GetDbSetAsync(); return await dbSet @@ -70,7 +74,7 @@ namespace LINGYUN.Platform.Datas .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Code.Contains(filter) || x.Description.Contains(filter) || x.DisplayName.Contains(filter) || x.Name.Contains(filter)) - .OrderBy(sotring) + .OrderBy(sorting) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs index 916046e59..233a08c25 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs @@ -46,14 +46,15 @@ namespace LINGYUN.Platform.Layouts string framework = "", string filter = "", string sorting = nameof(Layout.Name), - bool reverse = false, bool includeDetails = false, int skipCount = 0, int maxResultCount = 10, CancellationToken cancellationToken = default) { - sorting ??= nameof(Layout.Name); - sorting = reverse ? sorting + " DESC" : sorting; + if (sorting.IsNullOrWhiteSpace()) + { + sorting = nameof(Layout.Name); + } return await (await GetDbSetAsync()) .IncludeDetails(includeDetails) diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs index 4ec99db2b..7ba83815f 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs @@ -165,14 +165,15 @@ namespace LINGYUN.Platform.Menus public async virtual Task> GetAllAsync( string filter = "", string sorting = nameof(Menu.Code), - bool reverse = false, string framework = "", Guid? parentId = null, Guid? layoutId = null, CancellationToken cancellationToken = default) { - sorting ??= nameof(Menu.Code); - sorting = reverse ? sorting + " DESC" : sorting; + if (sorting.IsNullOrWhiteSpace()) + { + sorting = nameof(Menu.Code); + } return await (await GetDbSetAsync()) .WhereIf(parentId.HasValue, x => x.ParentId == parentId) @@ -182,7 +183,7 @@ namespace LINGYUN.Platform.Menus menu.Path.Contains(filter) || menu.Name.Contains(filter) || menu.DisplayName.Contains(filter) || menu.Description.Contains(filter) || menu.Redirect.Contains(filter)) - .OrderBy(sorting) + .rting) .ToListAsync(GetCancellationToken(cancellationToken)); } @@ -207,7 +208,6 @@ namespace LINGYUN.Platform.Menus public async virtual Task> GetListAsync( string filter = "", string sorting = nameof(Menu.Code), - bool reverse = false, string framework = "", Guid? parentId = null, Guid? layoutId = null, @@ -215,8 +215,10 @@ namespace LINGYUN.Platform.Menus int maxResultCount = 10, CancellationToken cancellationToken = default) { - sorting ??= nameof(Menu.Code); - sorting = reverse ? sorting + " DESC" : sorting; + if (sorting.IsNullOrWhiteSpace()) + { + sorting = nameof(Menu.Code); + } return await (await GetDbSetAsync()) .WhereIf(parentId.HasValue, x => x.ParentId == parentId) diff --git a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs index 485518f5d..99b9833d9 100644 --- a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs +++ b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs @@ -49,13 +49,17 @@ namespace LINGYUN.Abp.MessageService.Chat int maxResultCount = 10, CancellationToken cancellationToken = default) { + if (sorting.IsNullOrWhiteSpace()) + { + sorting = nameof(GroupMessage.MessageId); + } var groupMessages = await (await GetDbContextAsync()).Set() .Distinct() .Where(x => x.GroupId.Equals(groupId)) .Where(x => x.State == MessageState.Send || x.State == MessageState.Read) .WhereIf(type.HasValue, x => x.Type.Equals(type)) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Content.Contains(filter) || x.SendUserName.Contains(filter)) - .OrderBy(sorting ?? nameof(GroupMessage.MessageId)) + .OrderBy(sorting) .PageBy(skipCount, maxResultCount) .AsNoTracking() .ToListAsync(GetCancellationToken(cancellationToken)); @@ -89,12 +93,16 @@ namespace LINGYUN.Abp.MessageService.Chat int maxResultCount = 10, CancellationToken cancellationToken = default) { + if (sorting.IsNullOrWhiteSpace()) + { + sorting = nameof(GroupMessage.MessageId); + } var groupMessages = await (await GetDbContextAsync()).Set() .Distinct() .Where(x => x.GroupId.Equals(groupId) && x.CreatorId.Equals(sendUserId)) .WhereIf(type != null, x => x.Type.Equals(type)) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Content.Contains(filter) || x.SendUserName.Contains(filter)) - .OrderBy(sorting ?? nameof(GroupMessage.MessageId)) + .OrderBy(sorting) .PageBy(skipCount, maxResultCount) .AsNoTracking() .ToListAsync(GetCancellationToken(cancellationToken)); @@ -162,7 +170,10 @@ namespace LINGYUN.Abp.MessageService.Chat int maxResultCount = 10, CancellationToken cancellationToken = default) { - sorting ??= $"{nameof(LastChatMessage.SendTime)} DESC"; + if (sorting.IsNullOrWhiteSpace()) + { + sorting = $"{nameof(LastChatMessage.SendTime)} DESC"; + } var dbContext = await GetDbContextAsync(); #region SQL 原型 @@ -439,13 +450,17 @@ namespace LINGYUN.Abp.MessageService.Chat int maxResultCount = 10, CancellationToken cancellationToken = default) { + if (sorting.IsNullOrWhiteSpace()) + { + sorting = nameof(UserMessage.MessageId); + } var userMessages = await (await GetDbContextAsync()).Set() .Where(x => (x.CreatorId.Equals(sendUserId) && x.ReceiveUserId.Equals(receiveUserId)) || x.CreatorId.Equals(receiveUserId) && x.ReceiveUserId.Equals(sendUserId)) .WhereIf(type.HasValue, x => x.Type.Equals(type)) .Where(x => x.State == MessageState.Send || x.State == MessageState.Read) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Content.Contains(filter) || x.SendUserName.Contains(filter)) - .OrderBy(sorting ?? nameof(UserMessage.MessageId)) + .OrderBy(sorting) .PageBy(skipCount, maxResultCount) .AsNoTracking() .ToListAsync(GetCancellationToken(cancellationToken)); diff --git a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatCardRepository.cs b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatCardRepository.cs index 2f3eb0129..1b3e890d3 100644 --- a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatCardRepository.cs +++ b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatCardRepository.cs @@ -69,12 +69,16 @@ namespace LINGYUN.Abp.MessageService.Chat int maxResultCount = 10, CancellationToken cancellationToken = default) { + if (sorting.IsNullOrWhiteSpace()) + { + sorting = nameof(UserChatCard.UserId); + } return await (await GetDbSetAsync()) .WhereIf(!findUserName.IsNullOrWhiteSpace(), ucc => ucc.UserName.Contains(findUserName)) .WhereIf(startAge.HasValue, ucc => ucc.Age >= startAge.Value) .WhereIf(endAge.HasValue, ucc => ucc.Age <= endAge.Value) .WhereIf(sex.HasValue, ucc => ucc.Sex == sex) - .OrderBy(sorting ?? nameof(UserChatCard.UserId)) + .OrderBy(sorting) .PageBy(skipCount, maxResultCount) .Select(ucc => ucc.ToUserCard()) .ToListAsync(GetCancellationToken(cancellationToken)); diff --git a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs index aa26b633e..d3ff0c5fe 100644 --- a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs +++ b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreUserChatFriendRepository.cs @@ -33,6 +33,10 @@ namespace LINGYUN.Abp.MessageService.Chat string sorting = nameof(UserChatFriend.RemarkName), CancellationToken cancellationToken = default) { + if (sorting.IsNullOrWhiteSpace()) + { + sorting = nameof(UserChatFriend.RemarkName); + } var dbContext = await GetDbContextAsync(); var userFriendQuery = from ucf in dbContext.Set() join ucc in dbContext.Set() @@ -60,7 +64,7 @@ namespace LINGYUN.Abp.MessageService.Chat }; return await userFriendQuery - .OrderBy(sorting ?? nameof(UserChatFriend.RemarkName)) + .OrderBy(sorting) .ToListAsync(GetCancellationToken(cancellationToken)); } @@ -103,6 +107,10 @@ namespace LINGYUN.Abp.MessageService.Chat int maxResultCount = 10, CancellationToken cancellationToken = default) { + if (sorting.IsNullOrWhiteSpace()) + { + sorting = nameof(UserChatFriend.UserId); + } var dbContext = await GetDbContextAsync(); // 过滤用户资料 var userChatCardQuery = dbContext.Set() @@ -139,7 +147,7 @@ namespace LINGYUN.Abp.MessageService.Chat }; return await userFriendQuery - .OrderBy(sorting ?? nameof(UserChatFriend.UserId)) + .OrderBy(sorting) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); } diff --git a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Groups/EfCoreGroupRepository.cs b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Groups/EfCoreGroupRepository.cs index 6dbc291f5..1f5b2b625 100644 --- a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Groups/EfCoreGroupRepository.cs +++ b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Groups/EfCoreGroupRepository.cs @@ -1,4 +1,5 @@ -using LINGYUN.Abp.MessageService.EntityFrameworkCore; +using LINGYUN.Abp.MessageService.Chat; +using LINGYUN.Abp.MessageService.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; @@ -38,10 +39,14 @@ namespace LINGYUN.Abp.MessageService.Groups int maxResultCount = 10, CancellationToken cancellationToken = default) { + if (sorting.IsNullOrWhiteSpace()) + { + sorting = nameof(ChatGroup.Name); + } return await (await GetDbSetAsync()) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Name.Contains(filter) || x.Tag.Contains(filter)) - .OrderBy(sorting ?? nameof(ChatGroup.Name)) + .OrderBy(sorting) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); } diff --git a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Groups/EfCoreUserChatGroupRepository.cs b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Groups/EfCoreUserChatGroupRepository.cs index 7744e64b8..c62722ce9 100644 --- a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Groups/EfCoreUserChatGroupRepository.cs +++ b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Groups/EfCoreUserChatGroupRepository.cs @@ -64,6 +64,10 @@ namespace LINGYUN.Abp.MessageService.Groups int maxResultCount = 10, CancellationToken cancellationToken = default) { + if (sorting.IsNullOrWhiteSpace()) + { + sorting = nameof(UserChatCard.UserId); + } var dbContext = await GetDbContextAsync(); var cardQuery = from gp in dbContext.Set() join ucg in dbContext.Set() @@ -91,7 +95,7 @@ namespace LINGYUN.Abp.MessageService.Groups }; return await cardQuery - .OrderBy(sorting ?? nameof(UserChatCard.UserId)) + .OrderBy(sorting) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); } diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/EfCoreUserNotificationRepository.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/EfCoreUserNotificationRepository.cs index aa3445ce1..8e9c8a85b 100644 --- a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/EfCoreUserNotificationRepository.cs +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/EfCoreUserNotificationRepository.cs @@ -150,7 +150,10 @@ public class EfCoreUserNotificationRepository : EfCoreRepository() // .Where(x => x.UserId == userId) diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/EfCoreUserSubscribeRepository.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/EfCoreUserSubscribeRepository.cs index 4688af010..5fe29f548 100644 --- a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/EfCoreUserSubscribeRepository.cs +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/EfCoreUserSubscribeRepository.cs @@ -137,10 +137,14 @@ public class EfCoreUserSubscribeRepository : EfCoreRepository x.UserId.Equals(userId)) - .OrderBy(sorting ?? nameof(UserSubscribe.Id)) + .OrderBy(sorting) .Page(skipCount, maxResultCount) .AsNoTracking() .ToListAsync(GetCancellationToken(cancellationToken)); diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.EntityFrameworkCore/LINGYUN/Abp/Saas/EntityFrameworkCore/EfCoreEditionRepository.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.EntityFrameworkCore/LINGYUN/Abp/Saas/EntityFrameworkCore/EfCoreEditionRepository.cs index 47f842214..0c4949caf 100644 --- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.EntityFrameworkCore/LINGYUN/Abp/Saas/EntityFrameworkCore/EfCoreEditionRepository.cs +++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.EntityFrameworkCore/LINGYUN/Abp/Saas/EntityFrameworkCore/EfCoreEditionRepository.cs @@ -75,9 +75,13 @@ public class EfCoreEditionRepository : EfCoreRepository x.DisplayName.Contains(filter)) - .OrderBy(sorting.IsNullOrEmpty() ? nameof(Edition.DisplayName) : sorting) + .OrderBy(sorting) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); } diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.EntityFrameworkCore/LINGYUN/Abp/Saas/EntityFrameworkCore/EfCoreTenantRepository.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.EntityFrameworkCore/LINGYUN/Abp/Saas/EntityFrameworkCore/EfCoreTenantRepository.cs index 345999820..5e96affb5 100644 --- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.EntityFrameworkCore/LINGYUN/Abp/Saas/EntityFrameworkCore/EfCoreTenantRepository.cs +++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.EntityFrameworkCore/LINGYUN/Abp/Saas/EntityFrameworkCore/EfCoreTenantRepository.cs @@ -168,6 +168,10 @@ public class EfCoreTenantRepository : EfCoreRepository u.Name.Contains(filter)) - .OrderBy(sorting.IsNullOrEmpty() ? nameof(Tenant.Name) : sorting); + .OrderBy(sorting); var combinedResult = await (from tenant in tenantDbSet join edition in editionDbSet on tenant.EditionId equals edition.Id @@ -210,7 +214,7 @@ public class EfCoreTenantRepository : EfCoreRepository u.Name.Contains(filter)) - .OrderBy(sorting.IsNullOrEmpty() ? nameof(Tenant.Name) : sorting) + .OrderBy(sorting) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); } diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobInfoRepository.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobInfoRepository.cs index 04a60f349..672ff068e 100644 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobInfoRepository.cs +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobInfoRepository.cs @@ -81,9 +81,13 @@ public class EfCoreBackgroundJobInfoRepository : public async virtual Task> GetListAsync(ISpecification specification, string sorting = "Name", int maxResultCount = 10, int skipCount = 0, CancellationToken cancellationToken = default) { + if (sorting.IsNullOrWhiteSpace()) + { + sorting = $"{nameof(BackgroundJobInfo.CreationTime)} DESC"; + } return await (await GetDbSetAsync()) .Where(specification.ToExpression()) - .OrderBy(sorting ?? $"{nameof(BackgroundJobInfo.CreationTime)} DESC") + .OrderBy(sorting) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); } diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobLogRepository.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobLogRepository.cs index a03621788..94e35ce0d 100644 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobLogRepository.cs +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobLogRepository.cs @@ -46,6 +46,10 @@ public class EfCoreBackgroundJobLogRepository : int skipCount = 0, CancellationToken cancellationToken = default) { + if (sorting.IsNullOrWhiteSpace()) + { + sorting = $"{nameof(BackgroundJobLog.RunTime)}"; + } return await (await GetDbSetAsync()) .WhereIf(!jobId.IsNullOrWhiteSpace(), x => x.JobId.Equals(jobId)) .WhereIf(!filter.Type.IsNullOrWhiteSpace(), x => x.JobType.Contains(filter.Type)) @@ -56,7 +60,7 @@ public class EfCoreBackgroundJobLogRepository : .WhereIf(filter.HasExceptions.HasValue, x => !string.IsNullOrWhiteSpace(x.Exception)) .WhereIf(filter.BeginRunTime.HasValue, x => x.RunTime.CompareTo(filter.BeginRunTime.Value) >= 0) .WhereIf(filter.EndRunTime.HasValue, x => x.RunTime.CompareTo(filter.EndRunTime.Value) <= 0) - .OrderBy(sorting ?? $"{nameof(BackgroundJobLog.RunTime)} DESC") + .OrderBy(sorting) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/EfCoreWebhookSubscriptionRepository.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/EfCoreWebhookSubscriptionRepository.cs index 9fb358158..435fa2c89 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/EfCoreWebhookSubscriptionRepository.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/EfCoreWebhookSubscriptionRepository.cs @@ -50,9 +50,13 @@ public class EfCoreWebhookSubscriptionRepository : int skipCount = 0, CancellationToken cancellationToken = default) { + if (sorting.IsNullOrWhiteSpace()) + { + sorting = $"{nameof(WebhookSubscription.CreationTime)} DESC"; + } return await (await GetDbSetAsync()) .Where(specification.ToExpression()) - .OrderBy(sorting ?? $"{nameof(WebhookSubscription.CreationTime)} DESC") + .OrderBy(sorting) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); }