diff --git a/db_logic/client.py b/db_logic/client.py index 43f224e..691330f 100644 --- a/db_logic/client.py +++ b/db_logic/client.py @@ -32,7 +32,7 @@ class BllClient(Repository): def get_client_seach(self, seach_word, page_param): filter_base = "" if seach_word: - filter_base += f" client_name like %'{seach_word}'% " + filter_base += f" client_name like '%{seach_word}%' " if filter_base: filter_base = f" where {filter_base} " sql_all = f""" diff --git a/db_logic/medicament.py b/db_logic/medicament.py index 8cddedc..a02e2b7 100644 --- a/db_logic/medicament.py +++ b/db_logic/medicament.py @@ -275,7 +275,7 @@ class BllMedicament(Repository): # 拼接查询条件及分组条件 filter_base = "" if name: - filter_base = f" where `name` LIKE %'{name}'%" + filter_base = f" where `name` LIKE '%{name}%'" filter_base += " GROUP BY `name`, speci, purity" sql_all = sql_all % filter_base @@ -356,7 +356,7 @@ class BllMedicament(Repository): filter_sql = f"WHERE record_type={record_type}" if put_in_user_name: - filter_sql += f" and create_user_name like '{put_in_user_name}'" + filter_sql += f" and create_user_name like '%{put_in_user_name}%'" if start_time and end_time: filter_sql += f" and create_date >= '{start_time}' and create_date <= '{end_time}'" filter_sql_1 = '' diff --git a/db_logic/medicament_record.py b/db_logic/medicament_record.py index a597f47..5aba181 100644 --- a/db_logic/medicament_record.py +++ b/db_logic/medicament_record.py @@ -297,7 +297,8 @@ class BllMedicamentRecord(Repository): # 拼接查询条件 filter_base1 = "" if seach_word: - filter_base1 = f"where `name` like '{seach_word}' or english_name like '%{seach_word}%'" + seach_word = f"%{seach_word}%" + filter_base1 = f"where `name` like '{seach_word}' or english_name like '{seach_word}'" filter_base2 = "" if start_time and end_time: filter_base2 = f" and create_date >= '{start_time}' and create_date <= '{end_time}'" diff --git a/db_logic/user.py b/db_logic/user.py index 92da394..5b53386 100644 --- a/db_logic/user.py +++ b/db_logic/user.py @@ -74,15 +74,15 @@ class BllUser(Repository): def get_seach_user_list(self, user_code, real_name, role_name, is_enabled, page_param): filter_base = "" if user_code: - filter_base += f" user_code like %'{user_code}'%" + filter_base += f" user_code like '%{user_code}%'" if real_name: if filter_base: filter_base += " and " - filter_base += f" real_name like %'{real_name}'% " + filter_base += f" real_name like '%{real_name}%' " if role_name: if filter_base: filter_base += " and " - filter_base += f" role_name like %'{role_name}'%" + filter_base += f" role_name like '%{role_name}%'" if is_enabled: if filter_base: filter_base += " and "