like相关修改

duizhaopin
apan_youxiang@163.com 2 years ago
parent 8878b5e8d2
commit 493e8c05a9

@ -32,7 +32,7 @@ class BllClient(Repository):
def get_client_seach(self, seach_word, page_param): def get_client_seach(self, seach_word, page_param):
filter_base = "" filter_base = ""
if seach_word: if seach_word:
filter_base += f" client_name like %'{seach_word}'% " filter_base += f" client_name like '%{seach_word}%' "
if filter_base: if filter_base:
filter_base = f" where {filter_base} " filter_base = f" where {filter_base} "
sql_all = f""" sql_all = f"""

@ -275,7 +275,7 @@ class BllMedicament(Repository):
# 拼接查询条件及分组条件 # 拼接查询条件及分组条件
filter_base = "" filter_base = ""
if name: if name:
filter_base = f" where `name` LIKE %'{name}'%" filter_base = f" where `name` LIKE '%{name}%'"
filter_base += " GROUP BY `name`, speci, purity" filter_base += " GROUP BY `name`, speci, purity"
sql_all = sql_all % filter_base sql_all = sql_all % filter_base
@ -356,7 +356,7 @@ class BllMedicament(Repository):
filter_sql = f"WHERE record_type={record_type}" filter_sql = f"WHERE record_type={record_type}"
if put_in_user_name: 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: if start_time and end_time:
filter_sql += f" and create_date >= '{start_time}' and create_date <= '{end_time}'" filter_sql += f" and create_date >= '{start_time}' and create_date <= '{end_time}'"
filter_sql_1 = '' filter_sql_1 = ''

@ -297,7 +297,8 @@ class BllMedicamentRecord(Repository):
# 拼接查询条件 # 拼接查询条件
filter_base1 = "" filter_base1 = ""
if seach_word: 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 = "" filter_base2 = ""
if start_time and end_time: if start_time and end_time:
filter_base2 = f" and create_date >= '{start_time}' and create_date <= '{end_time}'" filter_base2 = f" and create_date >= '{start_time}' and create_date <= '{end_time}'"

@ -74,15 +74,15 @@ class BllUser(Repository):
def get_seach_user_list(self, user_code, real_name, role_name, is_enabled, page_param): def get_seach_user_list(self, user_code, real_name, role_name, is_enabled, page_param):
filter_base = "" filter_base = ""
if user_code: if user_code:
filter_base += f" user_code like %'{user_code}'%" filter_base += f" user_code like '%{user_code}%'"
if real_name: if real_name:
if filter_base: if filter_base:
filter_base += " and " filter_base += " and "
filter_base += f" real_name like %'{real_name}'% " filter_base += f" real_name like '%{real_name}%' "
if role_name: if role_name:
if filter_base: if filter_base:
filter_base += " and " filter_base += " and "
filter_base += f" role_name like %'{role_name}'%" filter_base += f" role_name like '%{role_name}%'"
if is_enabled: if is_enabled:
if filter_base: if filter_base:
filter_base += " and " filter_base += " and "

Loading…
Cancel
Save