|
|
|
@ -108,6 +108,28 @@ class ClassificationDeleteHandler(APIHandler):
|
|
|
|
|
self.finish()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ClassificationEditHandler(APIHandler):
|
|
|
|
|
"""
|
|
|
|
|
编辑模型分类
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
@authenticated
|
|
|
|
|
@operation_log("模型管理", "模型列表", consts.op_type_edit_str, "编辑模型分类", "")
|
|
|
|
|
def post(self):
|
|
|
|
|
classification_id = self.get_int_argument("id")
|
|
|
|
|
name = self.get_escaped_argument("name", "")
|
|
|
|
|
if not classification_id or not name:
|
|
|
|
|
raise errors.HTTPAPIError(errors.ERROR_BAD_REQUEST, "参数缺失")
|
|
|
|
|
with self.app_mysql.connect() as conn:
|
|
|
|
|
conn.execute(
|
|
|
|
|
text("""update model_classification set name=:name where id=:id"""),
|
|
|
|
|
{"name": name, "id": classification_id},
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
conn.commit()
|
|
|
|
|
|
|
|
|
|
self.finish()
|
|
|
|
|
|
|
|
|
|
class ListHandler(APIHandler):
|
|
|
|
|
"""
|
|
|
|
|
模型列表
|
|
|
|
@ -279,8 +301,10 @@ class InfoHandler(APIHandler):
|
|
|
|
|
select
|
|
|
|
|
m.name, m.model_type, m.default_version, m.comment, m.update_time,
|
|
|
|
|
mc.id as classification_id, mc.name as classification_name
|
|
|
|
|
from model m, model_classification mc
|
|
|
|
|
where m.id=:id and m.classification=mc.id
|
|
|
|
|
from model m
|
|
|
|
|
left join model_classification mc
|
|
|
|
|
on m.classification=mc.id
|
|
|
|
|
where m.id=:id
|
|
|
|
|
"""
|
|
|
|
|
),
|
|
|
|
|
{"id": mid},
|
|
|
|
|