fix(planting-service): 修复趋势数据查询表名错误

表名应为 planting_orders(复数),不是 planting_order

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-06 10:26:36 -08:00
parent 64bd82b77b
commit fe8e9a9bb6
1 changed files with 2 additions and 1 deletions

View File

@ -461,6 +461,7 @@ export class PlantingOrderRepositoryImpl implements IPlantingOrderRepository {
}
// 使用原生SQL进行分组查询
// 注意:表名是 planting_orders复数参照 @@map("planting_orders")
const results = await this.prisma.$queryRawUnsafe<
Array<{
label: string;
@ -474,7 +475,7 @@ export class PlantingOrderRepositoryImpl implements IPlantingOrderRepository {
COALESCE(SUM(tree_count), 0) as tree_count,
COUNT(*) as order_count,
COALESCE(SUM(total_amount), 0) as total_amount
FROM planting_order
FROM planting_orders
WHERE status IN (${paidStatuses.map(s => `'${s}'`).join(', ')})
AND paid_at >= $1
AND paid_at IS NOT NULL