{ "properties" : { }, "id" : "f7fa03a5d8b64dbaa39387c185a21adb", "script" : null, "groupId" : "8295fc13678d4144bf7363c465247a50", "name" : "列表", "createTime" : 1646490239494, "updateTime" : 1645694064991, "lock" : "0", "createBy" : null, "updateBy" : null, "path" : "/tree", "method" : "GET", "parameters" : [ ], "options" : [ { "name" : "permission", "value" : "office:view", "description" : "允许拥有该权限的访问", "required" : false, "dataType" : "String", "type" : null, "defaultValue" : null, "validateType" : null, "error" : null, "expression" : null, "children" : null } ], "requestBody" : "{\n\n}", "headers" : [ ], "paths" : [ ], "responseBody" : "{\n \"code\": 402,\n \"message\": \"凭证已过期\",\n \"data\": null,\n \"timestamp\": 1645694060610,\n \"executeTime\": null\n}", "description" : null, "requestBodyDefinition" : null, "responseBodyDefinition" : { "name" : "", "value" : "", "description" : "", "required" : false, "dataType" : "Object", "type" : null, "defaultValue" : null, "validateType" : "", "error" : "", "expression" : "", "children" : [ { "name" : "code", "value" : "402", "description" : "", "required" : false, "dataType" : "Integer", "type" : null, "defaultValue" : null, "validateType" : "", "error" : "", "expression" : "", "children" : [ ] }, { "name" : "message", "value" : "凭证已过期", "description" : "", "required" : false, "dataType" : "String", "type" : null, "defaultValue" : null, "validateType" : "", "error" : "", "expression" : "", "children" : [ ] }, { "name" : "data", "value" : "null", "description" : "", "required" : false, "dataType" : "Object", "type" : null, "defaultValue" : null, "validateType" : "", "error" : "", "expression" : "", "children" : [ ] }, { "name" : "timestamp", "value" : "1645694060610", "description" : "", "required" : false, "dataType" : "Long", "type" : null, "defaultValue" : null, "validateType" : "", "error" : "", "expression" : "", "children" : [ ] }, { "name" : "executeTime", "value" : "null", "description" : "", "required" : false, "dataType" : "Object", "type" : null, "defaultValue" : null, "validateType" : "", "error" : "", "expression" : "", "children" : [ ] } ] } } ================================ 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,type,sort,code from sys_office where is_del = 0 order by sort'),'0') return { list: list, total: list.getLength() }