From 2a519a371420a21f5942774817ed7723fb444443 Mon Sep 17 00:00:00 2001 From: wangziqi Date: Wed, 5 Aug 2026 17:53:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BB=AA=E8=A1=A8=E7=9B=98=20totalCapac?= =?UTF-8?q?ity=20=E8=81=9A=E5=90=88=E5=80=BC=E8=BD=AC=E4=B8=BA=E6=95=B0?= =?UTF-8?q?=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/server/src/dashboard/dashboard.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/server/src/dashboard/dashboard.service.ts b/apps/server/src/dashboard/dashboard.service.ts index dbaae9b..b7309aa 100644 --- a/apps/server/src/dashboard/dashboard.service.ts +++ b/apps/server/src/dashboard/dashboard.service.ts @@ -101,7 +101,8 @@ export class DashboardService { .select('SUM(r.capacity)', 'total') .where('r.status != :archived', { archived: 'archived' }); const totalCapacity = await capQb.getRawOne(); - const cap = totalCapacity?.total || 0; + // MySQL 的 SUM() 聚合默认以字符串返回,需显式转成 number + const cap = Number(totalCapacity?.total ?? 0) || 0; const occupancyRate = cap > 0 ? ((occupiedBeds / cap) * 100).toFixed(1) : 0; const billStatsQb = this.billRepo