组件tree

This commit is contained in:
zegezy 2024-03-03 20:47:53 +08:00
parent 5aab9d96c2
commit 70be66fd66
3 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,28 @@
{
"properties" : { },
"id" : "c01db2a3b18246c89ef1a6ad6b39342c",
"script" : null,
"groupId" : "6f106ebdee21489db34b956f7770ff03",
"name" : "保存tree",
"createTime" : null,
"updateTime" : 1709468623502,
"lock" : null,
"createBy" : null,
"updateBy" : null,
"path" : "/save/tree",
"method" : "POST",
"parameters" : [ ],
"options" : [ ],
"requestBody" : "",
"headers" : [ ],
"paths" : [ ],
"responseBody" : null,
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
}
================================
return db.table("sys_dynamic_component").primary("id").saveOrUpdate({
pid,
name
})

View File

@ -0,0 +1,27 @@
{
"properties" : { },
"id" : "2e3a230acf004dcdb679ff3a46a8a20a",
"script" : null,
"groupId" : "6f106ebdee21489db34b956f7770ff03",
"name" : "获取源码",
"createTime" : 1709459380012,
"updateTime" : null,
"lock" : null,
"createBy" : null,
"updateBy" : null,
"path" : "/getSourceCode",
"method" : "GET",
"parameters" : [ ],
"options" : [ ],
"requestBody" : "",
"headers" : [ ],
"paths" : [ ],
"responseBody" : null,
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
}
================================
return db.selectValue("""
select source_code from sys_dynamic_component where is_del=0 and name = #{name}
""")

View File

@ -0,0 +1,31 @@
{
"properties" : { },
"id" : "8ba14d61082e4ba69324fdc9de080f38",
"script" : null,
"groupId" : "6f106ebdee21489db34b956f7770ff03",
"name" : "获取组件tree",
"createTime" : null,
"updateTime" : 1709459290517,
"lock" : null,
"createBy" : null,
"updateBy" : null,
"path" : "/tree",
"method" : "GET",
"parameters" : [ ],
"options" : [ ],
"requestBody" : "",
"headers" : [ ],
"paths" : [ ],
"responseBody" : null,
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
}
================================
var toTree = (list,pid) => select t.*,toTree(list,t.id) children from list t where t.pid = pid
var list = toTree(db.select('select id,name,pid from sys_dynamic_component where is_del = 0 order by name'),'0')
return {
list: list,
total: list.getLength()
}