magic-boot/data/magic-api/api/后台/数据字典/保存.ms

31 lines
1.1 KiB
Plaintext
Raw Normal View History

2021-10-24 20:09:53 +08:00
{
"properties" : { },
"id" : "cbf24a795f6441d6af123d6dff065e37",
"script" : null,
"groupId" : "c7ce65f5b3cf4aaa913f6fec7d35d176",
"name" : "保存",
"createTime" : null,
2022-02-06 12:34:56 +08:00
"updateTime" : 1644121671060,
2021-10-24 20:09:53 +08:00
"lock" : "0",
"method" : "POST",
"path" : "/save",
"parameters" : [ ],
2022-02-06 12:34:56 +08:00
"option" : "[{\"name\":\"wrap_request_parameter\",\"value\":\"data\",\"description\":\"包装请求参数到一个变量中\"},{\"name\":\"permission\",\"value\":\"dict:save\",\"description\":\"允许拥有该权限的访问\"}]",
"requestBody" : "{\n\n}",
2021-10-24 20:09:53 +08:00
"headers" : [ ],
"paths" : [ ],
"responseBody" : null,
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null,
"optionMap" : {
2022-02-06 12:34:56 +08:00
"wrap_request_parameter" : "data",
"permission" : "dict:save"
2021-10-24 20:09:53 +08:00
}
}
================================
2022-02-05 17:20:12 +08:00
var typeCount = db.selectInt("select count(1) from sys_dict where is_del = 0 and type = #{data.type} ?{id, and id != #{data.id}}")
if(typeCount > 0){
exit 0,'类型已存在'
}
2021-10-24 20:09:53 +08:00
return db.table("sys_dict").primary("id").saveOrUpdate(data)