修复求和数据页面显示的问题
This commit is contained in:
@@ -234,13 +234,13 @@ def _calculate_charge_degree(history):
|
||||
return None
|
||||
|
||||
|
||||
def get_sum_data_list(page=1, page_size=20, start_date=None, end_date=None, config_id=None,
|
||||
def get_sum_data_list(page=None, page_size=20, start_date=None, end_date=None, config_id=None,
|
||||
config_name=None, sum_field_key=None, data_source=None):
|
||||
"""
|
||||
查询求和数据列表
|
||||
|
||||
Args:
|
||||
page: 页码
|
||||
page: 页码(None表示不分页,返回所有数据)
|
||||
page_size: 每页大小
|
||||
start_date: 开始日期(可选)
|
||||
end_date: 结束日期(可选)
|
||||
@@ -253,8 +253,6 @@ def get_sum_data_list(page=1, page_size=20, start_date=None, end_date=None, conf
|
||||
dict: 查询结果
|
||||
"""
|
||||
try:
|
||||
offset = (page - 1) * page_size
|
||||
|
||||
where_clauses = ['1=1']
|
||||
params = []
|
||||
|
||||
@@ -292,13 +290,23 @@ def get_sum_data_list(page=1, page_size=20, start_date=None, end_date=None, conf
|
||||
total = total_result[0]['total']
|
||||
|
||||
# 查询数据
|
||||
list_result = execute_query(
|
||||
f'''SELECT * FROM t_daily_report_sum_data
|
||||
WHERE {where_sql}
|
||||
ORDER BY report_date DESC, sort_order ASC, config_id ASC, id DESC
|
||||
LIMIT %s OFFSET %s''',
|
||||
tuple(params) + (page_size, offset)
|
||||
)
|
||||
if page is not None:
|
||||
offset = (page - 1) * page_size
|
||||
list_result = execute_query(
|
||||
f'''SELECT * FROM t_daily_report_sum_data
|
||||
WHERE {where_sql}
|
||||
ORDER BY report_date DESC, sort_order ASC, config_id ASC, id DESC
|
||||
LIMIT %s OFFSET %s''',
|
||||
tuple(params) + (page_size, offset)
|
||||
)
|
||||
else:
|
||||
list_result = execute_query(
|
||||
f'''SELECT * FROM t_daily_report_sum_data
|
||||
WHERE {where_sql}
|
||||
ORDER BY report_date DESC, sort_order ASC, config_id ASC, id DESC'''
|
||||
,
|
||||
tuple(params)
|
||||
)
|
||||
|
||||
return {
|
||||
'success': True,
|
||||
|
||||
Reference in New Issue
Block a user