From 48a8a36b4021a14c38f355d5244dd3bd02035804 Mon Sep 17 00:00:00 2001 From: df123 Date: Sun, 26 Apr 2026 20:19:46 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E5=A4=9A=E4=B8=AA?= =?UTF-8?q?=20NuGet=20=E5=8C=85=E7=89=88=E6=9C=AC=E4=BB=A5=E6=8F=90?= =?UTF-8?q?=E5=8D=87=E4=BE=9D=E8=B5=96=E9=A1=B9=E7=9A=84=E7=A8=B3=E5=AE=9A?= =?UTF-8?q?=E6=80=A7=E5=92=8C=E5=AE=89=E5=85=A8=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DFApp.LotteryProxy/DFApp.LotteryProxy.csproj | 11 ++++----- src/DFApp.Web/DFApp.Web.csproj | 26 ++++++++++---------- src/DFApp.Web/Program.cs | 16 ++++-------- test/DFApp.Web.Tests/DFApp.Web.Tests.csproj | 8 +++--- 4 files changed, 27 insertions(+), 34 deletions(-) diff --git a/DFApp.LotteryProxy/DFApp.LotteryProxy.csproj b/DFApp.LotteryProxy/DFApp.LotteryProxy.csproj index 5f1499b1..444eaaf4 100644 --- a/DFApp.LotteryProxy/DFApp.LotteryProxy.csproj +++ b/DFApp.LotteryProxy/DFApp.LotteryProxy.csproj @@ -9,12 +9,11 @@ - - - - - - + + + + + diff --git a/src/DFApp.Web/DFApp.Web.csproj b/src/DFApp.Web/DFApp.Web.csproj index 66e8a139..6499108c 100644 --- a/src/DFApp.Web/DFApp.Web.csproj +++ b/src/DFApp.Web/DFApp.Web.csproj @@ -16,24 +16,24 @@ - - + + - - - - - - - - - + + + + + + + + + - - + + diff --git a/src/DFApp.Web/Program.cs b/src/DFApp.Web/Program.cs index 92dd7da2..7530dfd4 100644 --- a/src/DFApp.Web/Program.cs +++ b/src/DFApp.Web/Program.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading.Tasks; using System.Text; using System.Text.Json; @@ -10,7 +11,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.IdentityModel.Tokens; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using Quartz; using Serilog; using Serilog.Events; @@ -222,18 +223,11 @@ public async static Task Main(string[] args) Scheme = "Bearer" }); - options.AddSecurityRequirement(new OpenApiSecurityRequirement + options.AddSecurityRequirement(document => new OpenApiSecurityRequirement { { - new OpenApiSecurityScheme - { - Reference = new OpenApiReference - { - Type = ReferenceType.SecurityScheme, - Id = "Bearer" - } - }, - Array.Empty() + new OpenApiSecuritySchemeReference("Bearer", document), + new List() } }); }); diff --git a/test/DFApp.Web.Tests/DFApp.Web.Tests.csproj b/test/DFApp.Web.Tests/DFApp.Web.Tests.csproj index 2b6fb7b0..c523332e 100644 --- a/test/DFApp.Web.Tests/DFApp.Web.Tests.csproj +++ b/test/DFApp.Web.Tests/DFApp.Web.Tests.csproj @@ -8,12 +8,12 @@ - - - + + + - + From 9b31a687466146376181e001379552c74357953e Mon Sep 17 00:00:00 2001 From: df123 Date: Sun, 26 Apr 2026 20:31:48 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=89=A9=E4=BD=99=E7=A3=81=E7=9B=98=E7=A9=BA=E9=97=B4=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E7=A7=BB=E9=99=A4=E4=B8=8D=E5=BF=85?= =?UTF-8?q?=E8=A6=81=E7=9A=84=E5=AD=97=E8=8A=82=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Configuration/ConfigurationInfoService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DFApp.Web/Services/Configuration/ConfigurationInfoService.cs b/src/DFApp.Web/Services/Configuration/ConfigurationInfoService.cs index d565dcb4..d131c2cd 100644 --- a/src/DFApp.Web/Services/Configuration/ConfigurationInfoService.cs +++ b/src/DFApp.Web/Services/Configuration/ConfigurationInfoService.cs @@ -84,7 +84,7 @@ public async Task> GetAllParametersInModule(string mo public async Task GetRemainingDiskSpaceAsync() { string saveDrive = await _configurationInfoRepository.GetConfigurationInfoValue("SaveDrive", string.Empty); - return StorageUnitConversionHelper.ByteToGB(SpaceHelper.GetAnyDriveAvailable(saveDrive)).ToString("F2") + "GB"; + return SpaceHelper.GetAnyDriveAvailable(saveDrive).ToString("F2") + "GB"; } /// From e2964189affff403e6149072e622ddd5aeba863e Mon Sep 17 00:00:00 2001 From: df123 Date: Sun, 26 Apr 2026 20:52:50 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=94=AF=E5=87=BA=E5=88=97=E8=A1=A8=E7=9A=84=20API=20=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=EF=BC=8C=E4=BB=8E=20/paged=20=E6=94=B9=E4=B8=BA=20/fi?= =?UTF-8?q?ltered?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/api/bookkeeping.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/api/bookkeeping.ts b/client/src/api/bookkeeping.ts index 364c8d14..812deebd 100644 --- a/client/src/api/bookkeeping.ts +++ b/client/src/api/bookkeeping.ts @@ -60,7 +60,7 @@ class BookkeepingExpenditureApi { async getExpenditures( params?: GetExpendituresRequestDto ): Promise> { - return http.get(`${this.baseUrl}/paged`, { params }); + return http.get(`${this.baseUrl}/filtered`, { params }); } /** From 376cea281ed6611d2be98e44090fbe382fdcc0d1 Mon Sep 17 00:00:00 2001 From: df123 Date: Sun, 26 Apr 2026 21:12:21 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=96=B9=E6=B3=95=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=8C=89=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4=E5=80=92=E5=BA=8F?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DFApp.Web/Services/CrudServiceBase.cs | 56 +++++++++++++++++++---- 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/src/DFApp.Web/Services/CrudServiceBase.cs b/src/DFApp.Web/Services/CrudServiceBase.cs index a2752120..97d1c79c 100644 --- a/src/DFApp.Web/Services/CrudServiceBase.cs +++ b/src/DFApp.Web/Services/CrudServiceBase.cs @@ -7,6 +7,7 @@ using DFApp.Web.Domain; using DFApp.Web.Infrastructure; using DFApp.Web.Permissions; +using SqlSugar; namespace DFApp.Web.Services; @@ -75,20 +76,30 @@ public virtual async Task> GetListAsync(Expression - /// 分页查询 + /// 分页查询(默认按创建时间倒序) /// /// 页码(从 1 开始) /// 每页大小 /// 分页结果 public virtual async Task<(List Items, int TotalCount)> GetPagedListAsync(int pageIndex, int pageSize) { - var (items, totalCount) = await Repository.GetPagedListAsync(pageIndex, pageSize); - var dtos = await MapToGetOutputDtoAsync(items); - return (dtos, totalCount); + if (HasCreationTimeProperty()) + { + var (items, totalCount) = await Repository.GetPagedListAsync( + pageIndex, pageSize, + BuildCreationTimeOrderExpression(), + OrderByType.Desc); + var dtos = await MapToGetOutputDtoAsync(items); + return (dtos, totalCount); + } + + var (defaultItems, defaultTotalCount) = await Repository.GetPagedListAsync(pageIndex, pageSize); + var defaultDtos = await MapToGetOutputDtoAsync(defaultItems); + return (defaultDtos, defaultTotalCount); } /// - /// 根据条件分页查询 + /// 根据条件分页查询(默认按创建时间倒序) /// /// 查询条件 /// 页码(从 1 开始) @@ -99,9 +110,38 @@ public virtual async Task> GetListAsync(Expression + /// 检查实体是否有 CreationTime 属性 + /// + private static bool HasCreationTimeProperty() + { + return typeof(TEntity).GetProperty("CreationTime") != null; + } + + /// + /// 构建 CreationTime 排序表达式 + /// + private static Expression> BuildCreationTimeOrderExpression() + { + var parameter = Expression.Parameter(typeof(TEntity), "x"); + var property = Expression.PropertyOrField(parameter, "CreationTime"); + var converted = Expression.Convert(property, typeof(object)); + return Expression.Lambda>(converted, parameter); } ///