18 lines
585 B
Python
18 lines
585 B
Python
from sqlalchemy import select
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.models.credit_ratio import CreditRatio
|
|
|
|
|
|
async def list_all_credit_ratios(db: AsyncSession) -> list[CreditRatio]:
|
|
"""获取全部积分比例规则,供客户端只读展示和后台复用。"""
|
|
result = await db.execute(
|
|
select(CreditRatio).order_by(
|
|
CreditRatio.gen_type.asc(),
|
|
CreditRatio.model_config_id.asc(),
|
|
CreditRatio.resolution.asc(),
|
|
CreditRatio.created_at.desc(),
|
|
)
|
|
)
|
|
return list(result.scalars().all())
|