21 lines
368 B
Python
21 lines
368 B
Python
"""通用 DTO。"""
|
|
from __future__ import annotations
|
|
|
|
from typing import Generic, TypeVar
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
T = TypeVar("T")
|
|
|
|
|
|
class PageQuery(BaseModel):
|
|
page: int = Field(default=1, ge=1)
|
|
size: int = Field(default=20, ge=1, le=200)
|
|
|
|
|
|
class PageResp(BaseModel, Generic[T]):
|
|
list: list[T]
|
|
total: int
|
|
page: int
|
|
size: int
|