You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
#!/usr/bin/env python
|
|
# -*- encoding: utf-8 -*-
|
|
'''
|
|
@Date: 2023/01/05 14:09:40
|
|
'''
|
|
import sys
|
|
sys.path.append('.')
|
|
|
|
|
|
from db_logic.db_base import Repository
|
|
from Common.Utils import Utils
|
|
from models.medicament_models import EntityMedicamntShenGou
|
|
|
|
|
|
|
|
class BllMedicamntShenGou(Repository):
|
|
def __init__(self, entityType=EntityMedicamntShenGou):
|
|
return super().__init__(entityType)
|
|
|
|
def get_list(self, user, page_param):
|
|
filter_base = ""
|
|
if "管理员" not in user.role_name:
|
|
filter_base += f" user_id='{user.user_id}'"
|
|
if filter_base:
|
|
filter_base = f" where {filter_base}"
|
|
|
|
sql_all = f"""
|
|
select * from rms_medicamnt_shengou {filter_base}
|
|
"""
|
|
try:
|
|
count_number = self.execute(f"select count(*) num from ({sql_all})a ").fetchone().num
|
|
except Exception:
|
|
count_number = 0
|
|
if page_param:
|
|
page_param.totalRecords = count_number
|
|
sql_all = Utils.sql_paging_assemble(sql_all, page_param)
|
|
return self.execute(sql_all).fetchall()
|