Files
dsProject/dsAiTeachingModel/utils/TranslateUtil.py
2025-08-14 15:45:08 +08:00

30 lines
1.2 KiB
Python

from utils.Database import find_by_sql
async def get_stage_map():
select_stage_sql: str = "select * from t_dm_stage where b_use = 1"
select_stage_result = await find_by_sql(select_stage_sql, ())
stage_map = {}
for stage in select_stage_result:
stage_map[str(stage["stage_id"])] = stage["stage_name"]
return stage_map
async def get_subject_map():
select_subject_sql: str = "select * from t_dm_subject"
select_subject_result = await find_by_sql(select_subject_sql, ())
subject_map = {}
for subject in select_subject_result:
subject_map[str(subject["subject_id"])] = subject["subject_name"]
return subject_map
async def get_person_map(person_ids: str):
person_id_list = person_ids.split(",")
person_ids = ",".join(person_id_list)
select_person_sql: str = f"select person_id, person_name from t_sys_loginperson where person_id in ({person_ids}) and b_use = 1"
select_person_result = await find_by_sql(select_person_sql, ())
person_map = {}
if select_person_result is not None:
for person in select_person_result:
person_map[str(person["person_id"])] = person["person_name"]
return person_map