fix: 修复重复岗位/团队导致的同步失败问题
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
yuliang_guo
2026-01-29 15:30:31 +08:00
parent 9701bd4fd9
commit 1e189e79b5

View File

@@ -153,11 +153,11 @@ class EmployeeSyncService:
department_name = department_name.strip()
# 检查团队是否已存在
# 检查团队是否已存在使用limit(1)避免重复数据报错)
stmt = select(Team).where(
Team.name == department_name,
Team.is_deleted == False
)
).limit(1)
result = await self.db.execute(stmt)
team = result.scalar_one_or_none()
@@ -202,11 +202,11 @@ class EmployeeSyncService:
position_name = position_name.strip()
# 检查岗位是否已存在
# 检查岗位是否已存在使用first()避免重复数据报错)
stmt = select(Position).where(
Position.name == position_name,
Position.is_deleted == False
)
).limit(1)
result = await self.db.execute(stmt)
position = result.scalar_one_or_none()