|
@ -494,6 +494,18 @@ class MetaDao: |
|
|
)).first() |
|
|
)).first() |
|
|
return CamelCaseUtil.transform_result(result) |
|
|
return CamelCaseUtil.transform_result(result) |
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
|
async def get_meta_table_cn_name(cls, db: AsyncSession, sysCode, mdlName, tabEngName): |
|
|
|
|
|
sql = text("select case when a.tab_cn_name is null then b.tab_crrct_name" |
|
|
|
|
|
" when a.tab_cn_name is not null then a.tab_cn_name end as tab_cn_name" |
|
|
|
|
|
" from t_metadata_extract_info a " |
|
|
|
|
|
"left join t_metadata_supp_info b " |
|
|
|
|
|
"on a.ssys_cd = b.ssys_cd and a.mdl_name=b.mdl_name and a.tab_eng_name=b.tab_crrct_name " |
|
|
|
|
|
"where a.ssys_cd = :sysCode and a.mdl_name = :mdlName and a.tab_eng_name = :tabEngName") |
|
|
|
|
|
result = (await db.execute(sql, {"sysCode": sysCode, "mdlName": mdlName, "tabEngName": tabEngName})) |
|
|
|
|
|
|
|
|
|
|
|
return result.first().tab_cn_name |
|
|
|
|
|
|
|
|
@classmethod |
|
|
@classmethod |
|
|
async def get_meta_col_name_list(cls, db: AsyncSession, query_object: MetaColObject): |
|
|
async def get_meta_col_name_list(cls, db: AsyncSession, query_object: MetaColObject): |
|
|
query_result = ( |
|
|
query_result = ( |
|
@ -524,13 +536,13 @@ class MetaDao: |
|
|
"from t_batch_er_relation_step1 a1)select a1.*,'A' AS father from tmp a1 where a1.rn = 1 " |
|
|
"from t_batch_er_relation_step1 a1)select a1.*,'A' AS father from tmp a1 where a1.rn = 1 " |
|
|
" and a1.a_ssys_cd = :sysCode and a1.a_mdl_name = :mdlName and a1.a_tab_eng_name = :tabName") |
|
|
" and a1.a_ssys_cd = :sysCode and a1.a_mdl_name = :mdlName and a1.a_tab_eng_name = :tabName") |
|
|
sql2 = text("with tmp as (select a1.*,row_number()over(partition by b_ssys_cd,b_mdl_name,b_tab_eng_name," |
|
|
sql2 = text("with tmp as (select a1.*,row_number()over(partition by b_ssys_cd,b_mdl_name,b_tab_eng_name," |
|
|
"b_fld_eng_name order by concat(op_relation,',',jd_relation) desc) as rn " |
|
|
"b_fld_eng_name order by concat(op_relation,',',jd_relation) desc) as rn " |
|
|
"from t_batch_er_relation_step1 a1)select a1.*,'A' AS father from tmp a1 where a1.rn = 1 " |
|
|
"from t_batch_er_relation_step1 a1)select a1.*,'A' AS father from tmp a1 where a1.rn = 1 " |
|
|
" and a1.b_ssys_cd = :sysCode and a1.b_mdl_name = :mdlName and a1.b_tab_eng_name = :tabName") |
|
|
" and a1.b_ssys_cd = :sysCode and a1.b_mdl_name = :mdlName and a1.b_tab_eng_name = :tabName") |
|
|
result = (await result_db.execute(sql, {"sysCode": ssys_cd, |
|
|
result = (await result_db.execute(sql, {"sysCode": ssys_cd, |
|
|
"mdlName": mdl_name, "tabName": tab_eng_name})) |
|
|
"mdlName": mdl_name, "tabName": tab_eng_name})) |
|
|
result2 = (await result_db.execute(sql2, {"sysCode": ssys_cd, |
|
|
result2 = (await result_db.execute(sql2, {"sysCode": ssys_cd, |
|
|
"mdlName": mdl_name, "tabName": tab_eng_name})) |
|
|
"mdlName": mdl_name, "tabName": tab_eng_name})) |
|
|
# 获取列名 |
|
|
# 获取列名 |
|
|
columns = result.keys() # 返回列名列表 |
|
|
columns = result.keys() # 返回列名列表 |
|
|
columns2 = result2.keys() # 返回列名列表 |
|
|
columns2 = result2.keys() # 返回列名列表 |
|
|