guzhi/app/controllers/industry.py
2025-09-30 22:26:02 +08:00

15 lines
486 B
Python

from app.core.crud import CRUDBase
from app.models.industry import Industry
from app.schemas.industry import IndustryCreate, IndustryUpdate
class IndustryController(CRUDBase[Industry, IndustryCreate, IndustryUpdate]):
def __init__(self):
super().__init__(model=Industry)
async def is_exist(self, code: str) -> bool:
"""检查行业代码是否已存在"""
return await self.model.filter(code=code).exists()
industry_controller = IndustryController()