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.

58 lines
1.7 KiB

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Da
te:2022/07/18 16:32:26
'''
import sys
sys.path.append(".")
from Common.Utils import Utils
import os
print(os.getcwd())
from sqlalchemy import asc
from db_logic.db_base import Repository
from models.client_models import EntityClient
#用户操作业务逻辑类
class BllClient(Repository):
def __init__(self, entityType=EntityClient):
return super().__init__(entityType)
# 获取客户端列表
def get_all_client_list(self):
# return self.findList().order_by(asc(EntityClient.client_code)).all()
sql_all = """select * from rms_client order by client_code """
return self.execute(sql_all).fetchall()
def get_client_seach(self, seach_word, page_param):
filter_base = " "
if seach_word:
filter_base += f" client_name like %'{seach_word}'% "
if filter_base:
filter_base = f" where {filter_base} "
sql_all = f"""
select * from rms_client {filter_base} order by client_code
"""
try:
count_number = len(self.execute(sql_all).fetchall())
except Exception:
count_number = 0
page_param.totalRecords=count_number
page_sql = Utils.sql_paging_assemble(sql_all, page_param)
return self.execute(page_sql)
# 根据条件查询客户端信息
def get_filter_client(self, client_id, customer_id):
where_list = []
if client_id:
where_list.append(EntityClient.client_id == client_id)
if customer_id:
where_list.append(EntityClient.customer_id == customer_id)
return self.findEntity(tuple(where_list))