mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-23 21:18:09 +00:00
- 更新了多个控制器文件中的函数命名,增加了 _controller 后缀 - 更新了多个服务文件中的函数命名,增加了 _service 后缀 - 统一了命名格式,提高了代码的可读性和可维护性
24 lines
738 B
Python
24 lines
738 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
from typing import Optional
|
|
from fastapi import Query
|
|
|
|
|
|
class OnlineQueryParams:
|
|
"""在线用户查询参数"""
|
|
|
|
def __init__(
|
|
self,
|
|
name: Optional[str] = Query(None, description="登录名称"),
|
|
ipaddr: Optional[str] = Query(None, description="登陆IP地址"),
|
|
login_location: Optional[str] = Query(None, description="登录所属地"),
|
|
) -> None:
|
|
super().__init__()
|
|
|
|
# 模糊查询字段
|
|
self.name = ("like", f"%{name}%") if name else None
|
|
self.login_location = ("like", f"%{login_location}%") if login_location else None
|
|
|
|
# 精确查询字段
|
|
self.ipaddr = ("eq", ipaddr) if ipaddr else None
|