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 = ''