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