From c3c15b7880ba41155f5d64efa9529d6dd03f54e9 Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 4 Jan 2026 23:37:57 -0800 Subject: [PATCH] fix(wallet-service): remove invalid nested $queryRaw in getOfflineSettlementSummary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 删除使用嵌套 $queryRaw 进行条件拼接的错误查询,保留简化版本。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../services/wallet-application.service.ts | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/backend/services/wallet-service/src/application/services/wallet-application.service.ts b/backend/services/wallet-service/src/application/services/wallet-application.service.ts index cdac58b3..aa36df36 100644 --- a/backend/services/wallet-service/src/application/services/wallet-application.service.ts +++ b/backend/services/wallet-service/src/application/services/wallet-application.service.ts @@ -3012,25 +3012,7 @@ export class WalletApplicationService { : 0; const totalCount = aggregateResult._count.id || 0; - // 查询按月统计 - const monthlyStats = await this.prisma.$queryRaw>` - SELECT - TO_CHAR(created_at, 'YYYY-MM') as month, - SUM(deducted_amount) as amount, - COUNT(*) as count - FROM offline_settlement_deductions - ${params.startDate ? this.prisma.$queryRaw`WHERE created_at >= ${params.startDate}` : this.prisma.$queryRaw``} - ${params.endDate ? this.prisma.$queryRaw`AND created_at <= ${params.endDate}` : this.prisma.$queryRaw``} - GROUP BY TO_CHAR(created_at, 'YYYY-MM') - ORDER BY month DESC - LIMIT 12 - `; - - // 简化查询:不使用条件拼接 + // 查询按月统计(简化版本,不使用日期筛选) const byMonth = await this.prisma.$queryRaw