18 lines
537 B
Python
18 lines
537 B
Python
from typing import Iterable, Optional
|
|
|
|
|
|
def assert_sys_user_bind_available(
|
|
*, existing: Iterable, personnel_id: str, sys_user_id: Optional[str]
|
|
) -> None:
|
|
uid = (sys_user_id or "").strip()
|
|
if not uid:
|
|
return
|
|
for row in existing:
|
|
if getattr(row, "del_flag", 0) == 1:
|
|
continue
|
|
if (getattr(row, "sys_user_id", None) or "").strip() != uid:
|
|
continue
|
|
if row.id == personnel_id:
|
|
continue
|
|
raise ValueError("该系统用户已关联其他驾押人员")
|