magic-boot/data/magic-api/api/系统管理/组件/保存tree.ms

37 lines
1.0 KiB
Plaintext
Raw Normal View History

2024-03-03 20:47:53 +08:00
{
"properties" : { },
"id" : "c01db2a3b18246c89ef1a6ad6b39342c",
"script" : null,
"groupId" : "6f106ebdee21489db34b956f7770ff03",
"name" : "保存tree",
"createTime" : null,
2024-03-05 20:42:12 +08:00
"updateTime" : 1709539934808,
2024-03-03 20:47:53 +08:00
"lock" : null,
"createBy" : null,
"updateBy" : null,
"path" : "/save/tree",
"method" : "POST",
"parameters" : [ ],
"options" : [ ],
"requestBody" : "",
"headers" : [ ],
"paths" : [ ],
"responseBody" : null,
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
}
================================
2024-03-05 20:42:12 +08:00
let data
if(id){
data = {id, name}
if(db.selectInt("select count(1) from sys_dynamic_component where is_del = 0 and name = #{name} and id != #{id}") > 0){
exit 0, '名称不能重复'
}
}else{
data = {pid, name}
if(db.selectInt("select count(1) from sys_dynamic_component where is_del = 0 and name = #{name}") > 0){
exit 0, '名称不能重复'
}
}
return db.table("sys_dynamic_component").primary("id").saveOrUpdate(data)