2024-03-03 20:47:53 +08:00
|
|
|
{
|
|
|
|
"properties" : { },
|
|
|
|
"id" : "c01db2a3b18246c89ef1a6ad6b39342c",
|
|
|
|
"script" : null,
|
|
|
|
"groupId" : "6f106ebdee21489db34b956f7770ff03",
|
|
|
|
"name" : "保存tree",
|
|
|
|
"createTime" : null,
|
2024-04-10 20:35:24 +08:00
|
|
|
"updateTime" : 1712742368621,
|
2024-03-03 20:47:53 +08:00
|
|
|
"lock" : null,
|
|
|
|
"createBy" : null,
|
|
|
|
"updateBy" : null,
|
|
|
|
"path" : "/save/tree",
|
|
|
|
"method" : "POST",
|
|
|
|
"parameters" : [ ],
|
2024-03-10 23:11:35 +08:00
|
|
|
"options" : [ {
|
|
|
|
"name" : "permission",
|
|
|
|
"value" : "component:save:tree",
|
|
|
|
"description" : "允许拥有该权限的访问",
|
|
|
|
"required" : false,
|
|
|
|
"dataType" : "String",
|
|
|
|
"type" : null,
|
|
|
|
"defaultValue" : null,
|
|
|
|
"validateType" : null,
|
|
|
|
"error" : null,
|
|
|
|
"expression" : null,
|
|
|
|
"children" : null
|
|
|
|
} ],
|
2024-03-03 20:47:53 +08:00
|
|
|
"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}
|
2024-04-10 20:35:24 +08:00
|
|
|
if(type == '1'){
|
|
|
|
if(db.selectInt("select count(1) from sys_dynamic_component where is_del = 0 and type = 1 and name = #{name} and id != #{id}") > 0){
|
|
|
|
exit 0, '组件名称不能重复'
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if(
|
|
|
|
db.selectInt("""
|
|
|
|
select count(1) from sys_dynamic_component where is_del = 0 and type = 0
|
|
|
|
and pid = (select pid from sys_dynamic_component where is_del = 0 and id = #{id}) and name = #{name} and id != #{id}
|
|
|
|
""") > 0
|
|
|
|
){
|
|
|
|
exit 0, '当前分组下已存在相同分组名称'
|
|
|
|
}
|
2024-03-05 20:42:12 +08:00
|
|
|
}
|
|
|
|
}else{
|
|
|
|
data = {pid, name}
|
2024-04-10 20:35:24 +08:00
|
|
|
if(type == '1'){
|
|
|
|
if(db.selectInt("select count(1) from sys_dynamic_component where is_del = 0 and type = 1 and name = #{name}") > 0){
|
|
|
|
exit 0, '组件名称不能重复'
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if(db.selectInt("select count(1) from sys_dynamic_component where is_del = 0 and type = 0 and pid = #{pid} and name = #{name}") > 0){
|
|
|
|
exit 0, '当前分组下已存在相同分组名称'
|
|
|
|
}
|
2024-03-05 20:42:12 +08:00
|
|
|
}
|
|
|
|
}
|
2024-04-10 20:35:24 +08:00
|
|
|
data.type = type
|
|
|
|
data.remark = remark
|
2024-05-17 07:35:52 +08:00
|
|
|
return db.table("sys_dynamic_component").primary("id").withBlank().saveOrUpdate(data)
|