From 50c49d592e0e92e8014c812bb5aaefb56c963ee9 Mon Sep 17 00:00:00 2001 From: 13507605001 Date: Tue, 3 Jan 2023 13:05:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E9=99=85=E7=AE=A1=E7=90=86=EF=BC=8Cba?= =?UTF-8?q?rcode=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db_logic/medicament.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/db_logic/medicament.py b/db_logic/medicament.py index 838f614..578bb07 100644 --- a/db_logic/medicament.py +++ b/db_logic/medicament.py @@ -177,17 +177,17 @@ class BllMedicament(Repository): filter_base += " and " filter_base += f" (`name` like '{seach_word}' or english_name like '{seach_word}') " # 搜索bar_code - # if b_code: - # if len(b_code) > 10: - # new_code = '' - # for i in range(int(len(b_code) / 2)): - # new_code = b_code[i*2:(i+1)*2] + new_code - # else: - # new_code = b_code - # new_code = f"%{new_code}%" - # if filter_base: - # filter_base += " and " - # filter_base += f" bar_code like '{new_code}' " + if b_code: + if len(b_code) > 10: + new_code = '' + for i in range(int(len(b_code) / 2)): + new_code = b_code[i*2:(i+1)*2] + new_code + else: + new_code = b_code + new_code = f"%{new_code}%" + if filter_base: + filter_base += " and " + filter_base += f" bar_code like '{new_code}' " if filter_base: if len(seach_word) > 10: new_code = ''