15 lines
462 B
Python
15 lines
462 B
Python
from app.core.crud import CRUDBase
|
|
from app.models.policy import Policy
|
|
from app.schemas.policy import PolicyCreate, PolicyUpdate
|
|
|
|
|
|
class PolicyController(CRUDBase[Policy, PolicyCreate, PolicyUpdate]):
|
|
def __init__(self):
|
|
super().__init__(model=Policy)
|
|
|
|
async def is_exist(self, code: str) -> bool:
|
|
"""检查行业代码是否已存在"""
|
|
return await self.model.filter(code=code).exists()
|
|
|
|
|
|
policy_controller = PolicyController() |