功能:实现多托盘发货出库
This commit is contained in:
@@ -28,16 +28,22 @@ class AccessDao:
|
||||
return mapped_user_id is not None
|
||||
|
||||
@classmethod
|
||||
async def user_has_site(cls, db: AsyncSession, user_id: int, site_id: int) -> bool:
|
||||
async def user_has_site(
|
||||
cls,
|
||||
db: AsyncSession,
|
||||
user_id: int,
|
||||
site_id: int,
|
||||
*,
|
||||
for_update: bool = False,
|
||||
) -> bool:
|
||||
"""判断用户是否关联指定客户现场。"""
|
||||
mapped_user_id = (
|
||||
await db.execute(
|
||||
select(BizUserSite.user_id).where(
|
||||
BizUserSite.user_id == user_id,
|
||||
BizUserSite.site_id == site_id,
|
||||
)
|
||||
)
|
||||
).scalar_one_or_none()
|
||||
statement = select(BizUserSite.user_id).where(
|
||||
BizUserSite.user_id == user_id,
|
||||
BizUserSite.site_id == site_id,
|
||||
)
|
||||
if for_update:
|
||||
statement = statement.with_for_update()
|
||||
mapped_user_id = (await db.execute(statement)).scalar_one_or_none()
|
||||
|
||||
return mapped_user_id is not None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user