"""通用 schema:游标分页响应 + 通用 ok 响应。""" from __future__ import annotations from typing import Generic, TypeVar from pydantic import BaseModel T = TypeVar("T") class CursorPage(BaseModel, Generic[T]): """分页响应:items + 下一页游标(next_cursor=None 表示末页)+ 可选 total。 next_cursor:offset 分页时即下一页 offset,「加载更多」用;末页为 None。 total:符合筛选条件的总条数,页码分页(antd pagination)用;不需要总数的接口可不传(None)。 """ items: list[T] next_cursor: int | None = None total: int | None = None class OkResponse(BaseModel): ok: bool = True