mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2026-04-26 00:00:04 +08:00
组织机构
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "8295fc13678d4144bf7363c465247a50",
|
||||
"name" : "组织机构",
|
||||
"type" : "1",
|
||||
"parentId" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"path" : "/office",
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "37aaae0a84ce4e00ad4f89d704d3cb51",
|
||||
"script" : null,
|
||||
"groupId" : "8295fc13678d4144bf7363c465247a50",
|
||||
"name" : "上移",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1641732205207,
|
||||
"lock" : "0",
|
||||
"method" : "GET",
|
||||
"path" : "/sort/up",
|
||||
"parameters" : [ ],
|
||||
"option" : "[]",
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null,
|
||||
"optionMap" : { }
|
||||
}
|
||||
================================
|
||||
var top = db.selectOne("""
|
||||
SELECT
|
||||
id,
|
||||
sort
|
||||
FROM
|
||||
sys_office
|
||||
WHERE
|
||||
is_del = 0
|
||||
AND pid = #{pid}
|
||||
AND sort < ( SELECT sort FROM sys_office WHERE is_del = 0 AND id = #{id} )
|
||||
ORDER BY
|
||||
sort DESC
|
||||
LIMIT 1
|
||||
""")
|
||||
if(top){
|
||||
db.update("""
|
||||
update sys_office set sort = #{top.sort} where id = #{id}
|
||||
""")
|
||||
db.update("""
|
||||
update sys_office set sort = #{sort} where id = #{top.id}
|
||||
""")
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "5f8edf5b8045475f92049270bcf0739a",
|
||||
"script" : null,
|
||||
"groupId" : "8295fc13678d4144bf7363c465247a50",
|
||||
"name" : "下移",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1641737498723,
|
||||
"lock" : "0",
|
||||
"method" : "GET",
|
||||
"path" : "/sort/down",
|
||||
"parameters" : [ ],
|
||||
"option" : "[]",
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null,
|
||||
"optionMap" : { }
|
||||
}
|
||||
================================
|
||||
var top = db.selectOne("""
|
||||
SELECT
|
||||
id,
|
||||
sort
|
||||
FROM
|
||||
sys_office
|
||||
WHERE
|
||||
is_del = 0
|
||||
AND pid = #{pid}
|
||||
AND sort > ( SELECT sort FROM sys_office WHERE is_del = 0 AND id = #{id} )
|
||||
ORDER BY
|
||||
sort
|
||||
LIMIT 1
|
||||
""")
|
||||
if(top){
|
||||
db.update("""
|
||||
update sys_office set sort = #{top.sort} where id = #{id}
|
||||
""")
|
||||
db.update("""
|
||||
update sys_office set sort = #{sort} where id = #{top.id}
|
||||
""")
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "03c2c9614e5b47f48f61f4f7759fe353",
|
||||
"script" : null,
|
||||
"groupId" : "8295fc13678d4144bf7363c465247a50",
|
||||
"name" : "保存",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1641732020139,
|
||||
"lock" : "0",
|
||||
"method" : "POST",
|
||||
"path" : "/save",
|
||||
"parameters" : [ ],
|
||||
"option" : "[{\"name\":\"wrap_request_parameter\",\"value\":\"data\",\"description\":\"包装请求参数到一个变量中\"}]",
|
||||
"requestBody" : "{}",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null,
|
||||
"optionMap" : {
|
||||
"wrap_request_parameter" : "data"
|
||||
}
|
||||
}
|
||||
================================
|
||||
return db.table("sys_office").primary("id").saveOrUpdate(data);
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "f7fa03a5d8b64dbaa39387c185a21adb",
|
||||
"script" : null,
|
||||
"groupId" : "8295fc13678d4144bf7363c465247a50",
|
||||
"name" : "列表",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1641731964401,
|
||||
"lock" : "0",
|
||||
"method" : "GET",
|
||||
"path" : "/tree",
|
||||
"parameters" : [ ],
|
||||
"option" : "[]",
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null,
|
||||
"optionMap" : { }
|
||||
}
|
||||
================================
|
||||
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()
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "4f2140a0d177450da2f27e4569afb7b8",
|
||||
"script" : null,
|
||||
"groupId" : "8295fc13678d4144bf7363c465247a50",
|
||||
"name" : "删除",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1641732068899,
|
||||
"lock" : "0",
|
||||
"method" : "POST",
|
||||
"path" : "/delete",
|
||||
"parameters" : [ ],
|
||||
"option" : "[]",
|
||||
"requestBody" : "{\r\n\t\r\n}",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": null,\n \"timestamp\": 1641201245421,\n \"executeTime\": 7\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : {
|
||||
"name" : "",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "code",
|
||||
"value" : "200",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "message",
|
||||
"value" : "success",
|
||||
"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" : "1641201245421",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "7",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
},
|
||||
"optionMap" : { }
|
||||
}
|
||||
================================
|
||||
// db.table('sys_user_office').where().eq("office_id",id).delete();
|
||||
return db.table("sys_office").logic().where().eq("id",id).delete();
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "f6e998eaff2c49be807fcb38a1a7d55b",
|
||||
"script" : null,
|
||||
"groupId" : "8295fc13678d4144bf7363c465247a50",
|
||||
"name" : "获取排序号",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1641732159522,
|
||||
"lock" : "0",
|
||||
"method" : "GET",
|
||||
"path" : "/sort",
|
||||
"parameters" : [ {
|
||||
"name" : "pid",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : true,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"option" : "[]",
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null,
|
||||
"optionMap" : { }
|
||||
}
|
||||
================================
|
||||
return db.selectInt("""
|
||||
select max(sort) + 10 from sys_office where pid = #{pid} and is_del = '0'
|
||||
""") || 10;
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "9817f2dbbc20419298e07bc644387f91",
|
||||
"script" : null,
|
||||
"groupId" : "67b2ce258e24491194b74992958c74aa",
|
||||
"name" : "上移",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1641564601649,
|
||||
"lock" : "0",
|
||||
"method" : "GET",
|
||||
"path" : "/sort/up",
|
||||
"parameters" : [ ],
|
||||
"option" : "[]",
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null,
|
||||
"optionMap" : { }
|
||||
}
|
||||
================================
|
||||
var top = db.selectOne("""
|
||||
SELECT
|
||||
id,
|
||||
sort
|
||||
FROM
|
||||
sys_menu
|
||||
WHERE
|
||||
is_del = 0
|
||||
AND pid = #{pid}
|
||||
AND sort < ( SELECT sort FROM sys_menu WHERE is_del = 0 AND id = #{id} )
|
||||
ORDER BY
|
||||
sort DESC
|
||||
LIMIT 1
|
||||
""")
|
||||
if(top){
|
||||
db.update("""
|
||||
update sys_menu set sort = #{top.sort} where id = #{id}
|
||||
""")
|
||||
db.update("""
|
||||
update sys_menu set sort = #{sort} where id = #{top.id}
|
||||
""")
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "77d393db826d4ba882b7c4b1d32e2e98",
|
||||
"script" : null,
|
||||
"groupId" : "67b2ce258e24491194b74992958c74aa",
|
||||
"name" : "下移",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1641564596885,
|
||||
"lock" : "0",
|
||||
"method" : "GET",
|
||||
"path" : "/sort/down",
|
||||
"parameters" : [ ],
|
||||
"option" : "[]",
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null,
|
||||
"optionMap" : { }
|
||||
}
|
||||
================================
|
||||
var top = db.selectOne("""
|
||||
SELECT
|
||||
id,
|
||||
sort
|
||||
FROM
|
||||
sys_menu
|
||||
WHERE
|
||||
is_del = 0
|
||||
AND pid = #{pid}
|
||||
AND sort > ( SELECT sort FROM sys_menu WHERE is_del = 0 AND id = #{id} )
|
||||
ORDER BY
|
||||
sort
|
||||
LIMIT 1
|
||||
""")
|
||||
if(top){
|
||||
db.update("""
|
||||
update sys_menu set sort = #{top.sort} where id = #{id}
|
||||
""")
|
||||
db.update("""
|
||||
update sys_menu set sort = #{sort} where id = #{top.id}
|
||||
""")
|
||||
}
|
||||
@@ -4,8 +4,8 @@
|
||||
"script" : null,
|
||||
"groupId" : "67b2ce258e24491194b74992958c74aa",
|
||||
"name" : "获取排序号",
|
||||
"createTime" : 1634724871167,
|
||||
"updateTime" : 1634724871167,
|
||||
"createTime" : null,
|
||||
"updateTime" : 1641732167291,
|
||||
"lock" : "0",
|
||||
"method" : "GET",
|
||||
"path" : "/sort",
|
||||
@@ -33,4 +33,6 @@
|
||||
"optionMap" : { }
|
||||
}
|
||||
================================
|
||||
return db.selectInt("""select max(sort) + 10 from sys_menu where pid = #{pid} and is_del = '0'""") || 10;
|
||||
return db.selectInt("""
|
||||
select max(sort) + 10 from sys_menu where pid = #{pid} and is_del = '0'
|
||||
""") || 10;
|
||||
Reference in New Issue
Block a user