fix(wallet-service): remove invalid nested $queryRaw in getOfflineSettlementSummary
删除使用嵌套 $queryRaw 进行条件拼接的错误查询,保留简化版本。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
49cdeb4aef
commit
c3c15b7880
|
|
@ -3012,25 +3012,7 @@ export class WalletApplicationService {
|
|||
: 0;
|
||||
const totalCount = aggregateResult._count.id || 0;
|
||||
|
||||
// 查询按月统计
|
||||
const monthlyStats = await this.prisma.$queryRaw<Array<{
|
||||
month: string;
|
||||
amount: any;
|
||||
count: any;
|
||||
}>>`
|
||||
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<Array<{
|
||||
month: string;
|
||||
amount: any;
|
||||
|
|
|
|||
Loading…
Reference in New Issue