调整更新phhd的写法

This commit is contained in:
2024-07-07 10:47:17 +08:00
parent 14b518f4af
commit ef0a38529d

View File

@@ -430,11 +430,11 @@ def main():
while 1: while 1:
session = MysqlSession() session = MysqlSession()
# 查询需要识别的案子 # 查询需要识别的案子
phhds = session.query(ZxPhhd.pk_phhd, ZxPhhd.exsuccess_flag).filter(ZxPhhd.exsuccess_flag == '1').limit( phhds = session.query(ZxPhhd.pk_phhd).filter(ZxPhhd.exsuccess_flag == '1').limit(PHHD_BATCH_SIZE).all()
PHHD_BATCH_SIZE).all()
# 将状态改为正在识别中 # 将状态改为正在识别中
for phhd in phhds: pk_phhd_values = [phhd.pk_phhd for phhd in phhds]
phhd.exsuccess_flag = '2' update_flag = (update(ZxPhhd).where(ZxPhhd.pk_phhd.in_(pk_phhd_values)).values(exsuccess_flag=2))
session.execute(update_flag)
session.commit() session.commit()
session.close() session.close()
if phhds: if phhds: