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/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 });
}
/**
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/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";
}
///
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);
}
///
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 @@
-
-
-
+
+
+
-
+