22 lines
673 B
Python
22 lines
673 B
Python
"""fin_customer_profile 画像仓储:按客户 ID 取画像。
|
|
|
|
注:本表主键为 customer_id(非 id),故不复用 BaseRepository.get 的 id 约定。
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from sqlalchemy import select
|
|
|
|
from model.fin_customer_profile import FinCustomerProfile
|
|
from repositories.base import BaseRepository
|
|
|
|
|
|
class FinCustomerProfileRepo(BaseRepository):
|
|
model = FinCustomerProfile
|
|
|
|
async def get_by_customer_id(self, customer_id: int) -> FinCustomerProfile | None:
|
|
return await self.db.scalar(
|
|
select(FinCustomerProfile).where(
|
|
FinCustomerProfile.customer_id == customer_id
|
|
)
|
|
)
|