调整数据库表名,增加催青阶段分析演示模块
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
from sqlalchemy import text
|
||||
|
||||
from sqlalchemy import text
|
||||
from sqlalchemy import text
|
||||
from config.pgDb import pg_pool
|
||||
from config.ssDb import mssql_pool
|
||||
from sqlalchemy import text
|
||||
|
||||
|
||||
def executeSQL(sql: str):
|
||||
"""
|
||||
@@ -14,11 +13,14 @@ def executeSQL(sql: str):
|
||||
# SQLAlchemy 2.x 返回 Row 对象,转成 dict
|
||||
return [dict(row._mapping) for row in result]
|
||||
|
||||
|
||||
def get_company_list(user_id: str):
|
||||
# 1️⃣ 从 PostgreSQL 获取 tenant_id
|
||||
with pg_pool.getConn() as pg_conn:
|
||||
with pg_conn.cursor() as cur:
|
||||
cur.execute("SELECT bbit_tenant_id FROM users WHERE id = %s", (user_id,))
|
||||
cur.execute(
|
||||
"SELECT bbit_tenant_id FROM sys_users WHERE id = %s", (user_id,)
|
||||
)
|
||||
row = cur.fetchone()
|
||||
tenant_id = row[0] if row else None
|
||||
|
||||
@@ -33,5 +35,3 @@ def get_company_list(user_id: str):
|
||||
with mssql_pool.getConn() as mssql_conn:
|
||||
result = mssql_conn.execute(query, params)
|
||||
return [{"id": str(row[0]), "name": row[1]} for row in result.fetchall()]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user