mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-21 12:52:26 +00:00
refactor: 重构查询参数模块,将param.py合并到schema.py中
feat: 为模型添加租户配额字段和字典表关联关系 fix: 修复部门树查询未应用租户隔离的问题 perf: 优化操作日志中间件的拦截逻辑和日志记录 style: 清理无用导入和重复代码 test: 添加基础测试文件 docs: 更新模型注释和字段说明
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
||||
from fastapi import Query
|
||||
|
||||
from app.core.validator import DateTimeStr
|
||||
from app.core.base_schema import BaseSchema
|
||||
|
||||
|
||||
@@ -34,3 +36,29 @@ class ParamsUpdateSchema(ParamsCreateSchema):
|
||||
class ParamsOutSchema(ParamsCreateSchema, BaseSchema):
|
||||
"""配置响应模型"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
class ParamsQueryParam:
|
||||
"""配置管理查询参数"""
|
||||
|
||||
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="2025-01-01 00:00:00"),
|
||||
end_time: Optional[DateTimeStr] = Query(None, description="结束时间", example="2025-12-31 23:59:59"),
|
||||
) -> None:
|
||||
|
||||
# 模糊查询字段
|
||||
self.config_name = ("like", config_name)
|
||||
self.config_key = ("like", config_key)
|
||||
|
||||
# 精确查询字段
|
||||
self.config_type = config_type
|
||||
|
||||
# 时间范围查询
|
||||
if start_time and end_time:
|
||||
self.created_time = ("between", (start_time, end_time))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user