From 2b6ba7b71e3c8bd47446d965a963e94f6972f3b8 Mon Sep 17 00:00:00 2001 From: liuyebo <1515783401@qq.com> Date: Thu, 8 Aug 2024 15:49:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=94=99=E8=AF=AF=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- photo_mask_error_check.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/photo_mask_error_check.py b/photo_mask_error_check.py index 9c57bc6..5c3ae66 100644 --- a/photo_mask_error_check.py +++ b/photo_mask_error_check.py @@ -31,11 +31,13 @@ def auto_check_error(error_ocr): if error_ocr.cfjaddress2: return error_ocr.cfjaddress2 - if error_ocr.cfjaddress[17] == '1': + cfjaddress = error_ocr.cfjaddress + if cfjaddress[17] == "1": return "图片类型错误" session = MysqlSession() - query = select(exists().where(ZxPhrec.cfjaddress == error_ocr.cfjaddress)) + cfjaddress = cfjaddress.rsplit(".", 1)[0] + ".%" + query = select(exists().where(ZxPhrec.cfjaddress.like(cfjaddress))) record_exists = session.execute(query).scalar() session.close() if not record_exists: @@ -58,9 +60,11 @@ if __name__ == '__main__': # ocr_error.cXm = "" # ocr_error.cSfzh = "" # ocr_error.cfjaddress = "" + # ocr_error.cfjaddress2 = "" # 手动选择pk # session = MysqlSession() - # ocr_error = (session.query(ZxIeOcrerror.pk_phrec, ZxIeOcrerror.cXm, ZxIeOcrerror.cSfzh, ZxIeOcrerror.cfjaddress) + # ocr_error = (session.query(ZxIeOcrerror.pk_phrec, ZxIeOcrerror.cXm, ZxIeOcrerror.cSfzh, ZxIeOcrerror.cfjaddress, + # ZxIeOcrerror.cfjaddress2) # .filter(ZxIeOcrerror.pk_phrec == 0).one()) # session.close()