完善中间件自动更新逻辑

This commit is contained in:
BBIT-Kai
2025-12-30 17:55:43 +08:00
parent 62e8ecb7d6
commit 3c1128b356
8 changed files with 74 additions and 26 deletions
+12 -2
View File
@@ -952,16 +952,26 @@ def get_dept_id_by_user_id(user_id: str) -> str:
return str(dept_id)
def get_dept_id_by_iot_user_name(user_id: UUID) -> str:
def get_dept_id_by_iot_user_name(user_id: str) -> str:
# 通过 iot_user_id 查找其所属的 dept_id
with pg_pool.getConn() as conn:
with conn.cursor() as cursor:
cursor.execute("SELECT dept_id FROM iot_users WHERE name = %s", (user_id,))
dept_id = cursor.fetchone()
dept_id = dept_id[0]
dept_id = str(dept_id[0])
return dept_id
def get_device_type_by_iot_user_name(user_id: str) -> str:
# 通过 iot_user_id 查找其所属的 type
with pg_pool.getConn() as conn:
with conn.cursor() as cursor:
cursor.execute("SELECT type FROM iot_users WHERE name = %s", (user_id,))
type = cursor.fetchone()
type = str(type[0])
return type
from typing import List