mismatch_records_service.py 1.1 KB

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. from app.call_center.crud.crud_mismatch_records import mismatch_records_dao
  4. from app.call_center.schema.mismatch_records import GetMismatchRecordsByIdParam, CreateMismatchRecordsParam, \
  5. UpdateMismatchRecordsParam
  6. from database.db_mysql import async_db_session
  7. from model.mismatch_records import MismatchRecords
  8. class MismatchRecordsService:
  9. @staticmethod
  10. async def get_select_by_id(*, obj: GetMismatchRecordsByIdParam) -> MismatchRecords | None:
  11. async with async_db_session.begin() as db:
  12. return await mismatch_records_dao.get(db, obj)
  13. @staticmethod
  14. async def create(*, obj: CreateMismatchRecordsParam) -> None:
  15. async with async_db_session.begin() as db:
  16. await mismatch_records_dao.create(db, obj)
  17. @staticmethod
  18. async def update_ignore(*, obj: UpdateMismatchRecordsParam) -> int:
  19. async with async_db_session.begin() as db:
  20. count = await mismatch_records_dao.update_ignore(db, obj)
  21. return count
  22. mismatch_records_service: MismatchRecordsService = MismatchRecordsService()