fix(worker): 修复打手订单可见范围查询中参数类型推导不兼容错误

- 显式类型转换:在 worker_visible 的 4 个 UNION 分支中,为 workerSharePlaceholder 显式补充 ::bigint 与 ::text 类型转换;
- 避免类型推导冲突:消除由于 JSON 字符串比较导致的 bigint = text 操作符缺失错误(operator does not exist: text = bigint);
- 验证方式:在 PostgreSQL 容器中验证 PREPARE/EXECUTE 与在后端容器内实测 listWorkOrders 正常返回 20 条记录。
This commit is contained in:
yml2213
2026-10-11 15:25:48 +08:00
parent 9ce29964c7
commit c5e8b78a33
@@ -1123,25 +1123,25 @@ export function buildWorkOrderWhere({
INNER JOIN (
SELECT assigned.id AS work_order_id
FROM work_orders assigned
WHERE assigned.assigned_worker_id = ${workerSharePlaceholder}
WHERE assigned.assigned_worker_id = ${workerSharePlaceholder}::bigint
UNION
SELECT historical.id AS work_order_id
FROM work_orders historical
WHERE ${retainedWorkerOrderPredicate('historical', workerSharePlaceholder)}
WHERE ${retainedWorkerOrderPredicate('historical', `${workerSharePlaceholder}::bigint`)}
UNION
SELECT share_source.work_order_id
FROM work_order_shares share_source
WHERE share_source.worker_id = ${workerSharePlaceholder}
WHERE share_source.worker_id = ${workerSharePlaceholder}::bigint
AND share_source.status != 'cancelled'
UNION
SELECT timeout_ev.work_order_id
FROM work_order_events timeout_ev
WHERE timeout_ev.event_type LIKE 'timeout_%'
AND timeout_ev.payload_json->>'workerId' = ${workerSharePlaceholder}
AND timeout_ev.payload_json->>'workerId' = ${workerSharePlaceholder}::text
) worker_visible ON worker_visible.work_order_id = wo.id
LEFT JOIN work_order_shares worker_share
ON worker_share.work_order_id = wo.id
AND worker_share.worker_id = ${workerSharePlaceholder}`)
AND worker_share.worker_id = ${workerSharePlaceholder}::bigint`)
}
if (useOperationalStatus) {