Files
FastapiAdmin/backend/app/api/v1/params/system/config_param.py
T
zhangtao df2c0a76c5 refactor(api): 统一详情接口使用路径参数替代查询参数
feat(utils): 新增部门树格式化工具函数
style(components): 调整通知组件样式和内容显示
fix(store): 修复通知公告获取逻辑并添加日志
perf(request): 优化请求拦截器仅对非GET请求显示成功消息
refactor(views): 重构多个模块的删除操作确认逻辑
docs(types): 移除未使用的全局类型定义
style(views): 调整表格列顺序和操作按钮样式
fix(components): 修复部门树组件数据加载和格式化
refactor(api): 重构用户、角色等模块的接口参数类型
style(views): 统一表单选择器宽度和布局
2025-07-19 02:19:58 +08:00

36 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
from datetime import datetime
from typing import Optional
from fastapi import Query
from app.core.validator import DateTimeStr
class ConfigQueryParams:
"""配置管理查询参数"""
def __init__(
self,
config_name: Optional[str] = Query(None, description="配置名称"),
config_key: Optional[str] = Query(None, description="配置键名"),
config_type: Optional[bool] = Query(None, description="系统内置((True:是 False:否))"),
start_time: Optional[DateTimeStr] = Query(None, description="开始时间", example="2023-01-01 00:00:00"),
end_time: Optional[DateTimeStr] = Query(None, description="结束时间", example="2023-12-31 23:59:59"),
) -> None:
super().__init__()
# 模糊查询字段
self.config_name = ("like", config_name)
self.config_key = ("like", config_key)
# 精确查询字段
self.config_type = config_type
# 时间范围查询
if start_time and end_time:
start_datetime = datetime.strptime(str(start_time), '%Y-%m-%d %H:%M:%S')
end_datetime = datetime.strptime(str(end_time), '%Y-%m-%d %H:%M:%S')
self.created_at = ("between", (start_datetime, end_datetime))