535d97a70c
17-table PostgreSQL schema with full Chinese column comments, FastAPI project structure (admin/common/modules), DSL rule files, and schema migration scripts.
21 lines
504 B
Python
21 lines
504 B
Python
"""BaseController —— 所有控制器继承此类。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from fastapi import APIRouter
|
|
|
|
|
|
class BaseController:
|
|
"""控制器基类。
|
|
|
|
子类在 __init__ 中用 @self.router.get/post 注册路由。
|
|
"""
|
|
|
|
def __init__(self, prefix: str = "", tags: list[str] | None = None):
|
|
self.router = APIRouter(prefix=prefix, tags=tags or [])
|
|
self.Init()
|
|
|
|
def Init(self) -> None:
|
|
"""子类重写此方法注册路由。"""
|
|
pass
|