fix: 修复 partner-records 缺少 source 参数

CASE 表达式中的 source=? 需要单独的 partner 参数

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
lizhilun
2026-03-19 10:37:23 +08:00
co-authored by Claude Opus 4.6
parent f381f93507
commit 3a4048a29e
+2 -1
View File
@@ -299,6 +299,7 @@ router.get('/partner-records', (req, res) => {
}
// 合并 summary 查询为一次
// 注意: source 在 CASE 和 WHERE 中各出现一次,都需要 partner 值
const summary = db.prepare(`
SELECT
COALESCE(SUM(CASE WHEN category = '派单' THEN quantity ELSE 0 END), 0) as dispatch_count,
@@ -310,7 +311,7 @@ router.get('/partner-records', (req, res) => {
(category = '派单' AND partner = ?) OR
(type = 'income' AND category != '派单' AND category != '接单' AND source = ?)
)${dateFilter}
`).get(partner, req.user.id, partner, ...dateParams);
`).get(partner, req.user.id, partner, partner, ...dateParams);
const records = db.prepare(`
SELECT * FROM records