from app.core.crud import CRUDBase
from app.models.esg import ESG
from app.schemas.esg import ESGCreate, ESGUpdate


class ESGController(CRUDBase[ESG, ESGCreate, ESGUpdate]):
    def __init__(self):
        super().__init__(model=ESG)

    async def is_exist(self, code: str) -> bool:
        """检查行业代码是否已存在"""
        return await self.model.filter(code=code).exists()


esg_controller = ESGController()