fix: db.py SQL (<>ALL, escape %% in LIKE) + incremental_sync tz-aware compare

This commit is contained in:
yeuimu
2026-07-23 08:43:27 +00:00
parent d48034f27a
commit 53ff943ac3
3 changed files with 6 additions and 2 deletions
+2 -2
View File
@@ -46,7 +46,7 @@ class SyncDB:
with conn.cursor() as cur:
cur.execute(
'SELECT DISTINCT "orderNo" FROM "Orders" WHERE "systemName"=%s '
'AND "systemStatus" IS DISTINCT FROM ALL %s',
'AND ("systemStatus" IS NULL OR "systemStatus" <> ALL %s)',
(system_name, exclude_statuses),
)
rows = cur.fetchall()
@@ -92,7 +92,7 @@ class SyncDB:
cur.execute(
'SELECT DISTINCT o."orderNo", o."createdAt" FROM "Orders" o '
'JOIN "Goods" g ON g."orderNo"=o."orderNo" AND g."createdAt"=o."createdAt" '
'WHERE o."systemName"=%s AND o."systemStatus"=ANY(%s) AND g."productionNo" LIKE \'100%\'',
'WHERE o."systemName"=%s AND o."systemStatus"=ANY(%s) AND g."productionNo" LIKE \'100%%\'',
(system_name, statuses),
)
rows = cur.fetchall()