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.
46 lines
1.4 KiB
46 lines
1.4 KiB
#!/usr/bin/env python
|
|
# -*- encoding: utf-8 -*-
|
|
'''
|
|
@Date: 2022/12/14 15:15:48
|
|
'''
|
|
import sys
|
|
sys.path.append('.')
|
|
|
|
|
|
from db_logic.db_base import Repository
|
|
from models.power_models import EntityUserApply
|
|
from Common.Utils import Utils
|
|
|
|
class BllUserApply(Repository):
|
|
|
|
def __init__(self, entityType=EntityUserApply):
|
|
super().__init__(entityType)
|
|
|
|
def get_list_info(self, client_id, func_type, page_param):
|
|
fileter_base = ""
|
|
if client_id:
|
|
fileter_base += f" client_id='{client_id}'"
|
|
if func_type:
|
|
if fileter_base:
|
|
fileter_base += " and "
|
|
fileter_base += f" func_type={func_type}"
|
|
if fileter_base:
|
|
fileter_base = f" where {fileter_base}"
|
|
|
|
sql_all = f"""
|
|
select a.*, b.client_name from (
|
|
select * from rms_user_apply {fileter_base}
|
|
) a LEFT JOIN (
|
|
select * from rms_client
|
|
) b on a.client_id=b.client_id
|
|
order by a.create_date desc
|
|
"""
|
|
try:
|
|
count_number = self.execute(f"select count(*) num from rms_user_apply {fileter_base} order by create_date desc").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()
|