mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-23 21:18:09 +00:00
2、后端过滤数据权限优化逻辑 3、获取在线用户缓存crud中keys变为*keys 4、前端状态查询修订 5、前端文件管理列表修订icon控制台警告 6、前端布局页面通知公告信息对接后端完成
32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
from fastapi import Query
|
|
|
|
class PositionQueryParams:
|
|
"""岗位管理查询参数"""
|
|
|
|
def __init__(
|
|
self,
|
|
name: Optional[str] = Query(None, description="岗位名称", min_length=2, max_length=20),
|
|
available: Optional[bool] = Query(None, description="是否可用"),
|
|
creator: Optional[int] = Query(None, description="创建人"),
|
|
start_time: Optional[str] = Query(None, description="开始时间", example="2023-01-01 00:00:00"),
|
|
end_time: Optional[str] = Query(None, description="结束时间", example="2023-12-31 23:59:59"),
|
|
) -> None:
|
|
super().__init__()
|
|
|
|
# 模糊查询字段
|
|
self.name = ("like", name)
|
|
|
|
# 精确查询字段
|
|
self.creator_id = creator
|
|
self.available = available
|
|
|
|
# 时间范围查询
|
|
if start_time and end_time:
|
|
start_datetime = datetime.strptime(start_time, '%Y-%m-%d %H:%M:%S')
|
|
end_datetime = datetime.strptime(end_time, '%Y-%m-%d %H:%M:%S')
|
|
self.created_at = ("between", (start_datetime, end_datetime))
|