历史记录中,增加按配置名称搜索

This commit is contained in:
2026-08-02 09:14:59 +08:00
parent c04b3b6b5d
commit 9516078b1d
4 changed files with 208 additions and 1 deletions

View File

@@ -54,7 +54,8 @@ def get_report_history():
start_date = request.args.get('start_date')
end_date = request.args.get('end_date')
status = request.args.get('status')
log_info(f'[报表API] 获取历史记录,第{page}页,状态: {status or "全部"},日期范围: {start_date or "开始"} ~ {end_date or "结束"}', 'api')
config_name = request.args.get('config_name')
log_info(f'[报表API] 获取历史记录,第{page}页,状态: {status or "全部"},配置名称: {config_name or "全部"},日期范围: {start_date or "开始"} ~ {end_date or "结束"}', 'api')
offset = (page - 1) * page_size
@@ -74,6 +75,11 @@ def get_report_history():
where_clauses.append('status = %s')
params.append(int(status))
# 支持按配置名称模糊搜索
if config_name is not None and config_name.strip() != '':
where_clauses.append('config_name LIKE %s')
params.append(f'%{config_name.strip()}%')
where_sql = ' AND '.join(where_clauses) if where_clauses else '1=1'
# 查询总数