|
|
@ -105,7 +105,7 @@ class EntityIndexHandler(APIHandler):
|
|
|
|
"industry": consts.industry_map[item["industry"]],
|
|
|
|
"industry": consts.industry_map[item["industry"]],
|
|
|
|
"modelCount": model_count,
|
|
|
|
"modelCount": model_count,
|
|
|
|
"deviceCount": device_count,
|
|
|
|
"deviceCount": device_count,
|
|
|
|
"logo": item["logo"],
|
|
|
|
"logo": str(item["logo"]),
|
|
|
|
"createTime": str(item["create_time"]),
|
|
|
|
"createTime": str(item["create_time"]),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for item, model_count, device_count in zip(
|
|
|
|
for item, model_count, device_count in zip(
|
|
|
@ -303,7 +303,7 @@ class EntityInfoHandler(APIHandler):
|
|
|
|
"contact": row["contact"],
|
|
|
|
"contact": row["contact"],
|
|
|
|
"phone": row["phone"],
|
|
|
|
"phone": row["phone"],
|
|
|
|
"summary": row["summary"],
|
|
|
|
"summary": row["summary"],
|
|
|
|
"logo": row["logo"],
|
|
|
|
"logo": str(row["logo"]),
|
|
|
|
"createTime": str(row["create_time"]),
|
|
|
|
"createTime": str(row["create_time"]),
|
|
|
|
"account": row["account"], # 企业账号
|
|
|
|
"account": row["account"], # 企业账号
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -321,37 +321,39 @@ class ModelsHandler(APIHandler):
|
|
|
|
|
|
|
|
|
|
|
|
model_ids = []
|
|
|
|
model_ids = []
|
|
|
|
with self.app_mysql.connect() as conn:
|
|
|
|
with self.app_mysql.connect() as conn:
|
|
|
|
cur = conn.execute(
|
|
|
|
cur_modelid = conn.execute(
|
|
|
|
text("select base_models from enterprise_busi_model where entity_id=:eid"), {"eid": eid}
|
|
|
|
text("select base_models from enterprise_busi_model where entity_id=:eid"), {"eid": eid}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
rows = db_mysql.to_json_list(cur)
|
|
|
|
rows = db_mysql.to_json_list(cur_modelid)
|
|
|
|
|
|
|
|
|
|
|
|
for row in rows:
|
|
|
|
for row in rows:
|
|
|
|
base_models = json.loads(row["base_models"])
|
|
|
|
base_models = json.loads(row["base_models"])
|
|
|
|
model_ids.extend([item["id"] for item in base_models])
|
|
|
|
model_ids.extend([item["id"] for item in base_models])
|
|
|
|
cur.close()
|
|
|
|
cur_modelid.close()
|
|
|
|
|
|
|
|
|
|
|
|
model_ids = list(set(model_ids))
|
|
|
|
model_ids = list(set(model_ids))
|
|
|
|
|
|
|
|
|
|
|
|
cur = conn.execute(text(
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
select m.name, m.model_type, mc.name as classification_name, m.default_version
|
|
|
|
|
|
|
|
from model m, model_classification mc
|
|
|
|
|
|
|
|
where m.classification=mc.id and m.id in :model_ids
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
), {"model_ids": model_ids})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rows = db_mysql.to_json_list(cur)
|
|
|
|
|
|
|
|
cur.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data = []
|
|
|
|
data = []
|
|
|
|
for row in rows:
|
|
|
|
|
|
|
|
data.append({
|
|
|
|
if len(model_ids) > 0:
|
|
|
|
"name": row["name"],
|
|
|
|
cur = conn.execute(text(
|
|
|
|
"model_type": consts.model_type_map[row["model_type"]],
|
|
|
|
"""
|
|
|
|
"classification_name": row["classification_name"],
|
|
|
|
select m.name, m.model_type, mc.name as classification_name, m.default_version
|
|
|
|
"default_version": row["default_version"]
|
|
|
|
from model m, model_classification mc
|
|
|
|
})
|
|
|
|
where m.classification=mc.id and m.id in :model_ids
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
), {"model_ids": model_ids})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rows = db_mysql.to_json_list(cur)
|
|
|
|
|
|
|
|
cur.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for row in rows:
|
|
|
|
|
|
|
|
data.append({
|
|
|
|
|
|
|
|
"name": row["name"],
|
|
|
|
|
|
|
|
"model_type": consts.model_type_map[row["model_type"]],
|
|
|
|
|
|
|
|
"classification_name": row["classification_name"],
|
|
|
|
|
|
|
|
"default_version": row["default_version"]
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
self.finish({"count": len(model_ids), "data": data})
|
|
|
|
self.finish({"count": len(model_ids), "data": data})
|
|
|
|
|
|
|
|
|
|
|
|