from app.core.crud import CRUDBase from app.models.index import Index from app.schemas.index import IndexCreate, IndexUpdate class IndexController(CRUDBase[Index, IndexCreate, IndexUpdate]): def __init__(self): super().__init__(model=Index) async def is_exist(self, code: str) -> bool: """检查行业代码是否已存在""" return await self.model.filter(code=code).exists() index_controller = IndexController()