18 lines
493 B
Python
18 lines
493 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
import logging
|
|
from website.db import get_session, to_json
|
|
from sqlalchemy import text
|
|
|
|
class EnterpriseEntityDB(object):
|
|
def __init__(self):
|
|
pass
|
|
|
|
|
|
def get_entity_suid(self, entity_id: int) -> str:
|
|
with get_session() as session:
|
|
res = session.execute(text("select suid from enterprise where id=:id"),
|
|
{"id": entity_id})
|
|
entity = to_json(res)
|
|
|
|
return entity["suid"] if entity else "" |