完善中间件自动更新逻辑
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user