From c5e8b78a33ad8850ad38120aecaea622f748e1e4 Mon Sep 17 00:00:00 2001 From: yml2213 Date: Sun, 11 Oct 2026 15:25:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(worker):=20=E4=BF=AE=E5=A4=8D=E6=89=93?= =?UTF-8?q?=E6=89=8B=E8=AE=A2=E5=8D=95=E5=8F=AF=E8=A7=81=E8=8C=83=E5=9B=B4?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=B8=AD=E5=8F=82=E6=95=B0=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=8E=A8=E5=AF=BC=E4=B8=8D=E5=85=BC=E5=AE=B9=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 显式类型转换:在 worker_visible 的 4 个 UNION 分支中,为 workerSharePlaceholder 显式补充 ::bigint 与 ::text 类型转换; - 避免类型推导冲突:消除由于 JSON 字符串比较导致的 bigint = text 操作符缺失错误(operator does not exist: text = bigint); - 验证方式:在 PostgreSQL 容器中验证 PREPARE/EXECUTE 与在后端容器内实测 listWorkOrders 正常返回 20 条记录。 --- .../worker-platform/work-order-query-repo.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/backend/src/repositories/worker-platform/work-order-query-repo.ts b/apps/backend/src/repositories/worker-platform/work-order-query-repo.ts index 3825c862..03510641 100644 --- a/apps/backend/src/repositories/worker-platform/work-order-query-repo.ts +++ b/apps/backend/src/repositories/worker-platform/work-order-query-repo.ts @@ -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) {