feat(user): 新增用户信息(访问者)返回是否关注is_follow CRUD同步新增exists方法

This commit is contained in:
xingc
2025-04-29 16:49:37 +08:00
parent 2611ab7587
commit a85df3c6e0
3 changed files with 31 additions and 5 deletions

View File

@@ -152,6 +152,15 @@ class CRUD:
await self.session.commit()
return result.rowcount > 0
async def exists(self, filters: dict, model: Model = None) -> bool:
model = model or self.model
result = await self.session.execute(select(model).filter(
*self.build_filter_conditions(filters, model))
)
state = True if result.scalars().first() else False
return state
async def total(self, filters: dict, model: Model = None) -> int:
model = model or self.model