magic-boot/data/magic-api/api/系统管理/数据字典/字典项/保存.ms

53 lines
1.5 KiB
Plaintext
Raw Normal View History

2021-10-24 20:09:53 +08:00
{
"properties" : { },
"id" : "695ff3257c314ea4bfa63edeaa511af0",
"script" : null,
"groupId" : "376f26eb43a44a3daeafd27020a96f48",
"name" : "保存",
"createTime" : 1646490239437,
2022-02-06 12:34:56 +08:00
"updateTime" : 1644121691372,
2021-10-24 20:09:53 +08:00
"lock" : "0",
"createBy" : null,
"updateBy" : null,
2021-10-24 20:09:53 +08:00
"path" : "/save",
"method" : "POST",
2021-10-24 20:09:53 +08:00
"parameters" : [ ],
"options" : [ {
"name" : "wrap_request_parameter",
"value" : "data",
"description" : "包装请求参数到一个变量中",
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : null,
"error" : null,
"expression" : null,
"children" : null
}, {
"name" : "permission",
"value" : "dict:items:save",
"description" : "允许拥有该权限的访问",
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : null,
"error" : null,
"expression" : null,
"children" : null
} ],
2022-02-06 12:34:56 +08:00
"requestBody" : "{\n\n}",
2021-10-24 20:09:53 +08:00
"headers" : [ ],
"paths" : [ ],
"responseBody" : null,
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
2021-10-24 20:09:53 +08:00
}
================================
2022-02-05 17:20:12 +08:00
var valueCount = db.selectInt("select count(1) from sys_dict_items where is_del = 0 and dict_id = #{data.dictId} and value = #{data.value} ?{id, and id != #{data.id}}")
if(valueCount > 0){
exit 0,'值已存在'
}
2021-10-24 20:09:53 +08:00
return db.table("sys_dict_items").primary("id").saveOrUpdate(data)