mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2025-02-21 02:12:50 +08:00
配置中心
This commit is contained in:
parent
0eb6ce6c36
commit
fad7c7e9b8
14
data/magic-api/api/系统管理/配置中心/group.json
Normal file
14
data/magic-api/api/系统管理/配置中心/group.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "0295f2b4af9145f5a0ea29fa4b797214",
|
||||
"name" : "配置中心",
|
||||
"type" : "api",
|
||||
"parentId" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"path" : "/configure",
|
||||
"createTime" : 1653097686148,
|
||||
"updateTime" : 1653097733635,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
||||
}
|
221
data/magic-api/api/系统管理/配置中心/保存.ms
Normal file
221
data/magic-api/api/系统管理/配置中心/保存.ms
Normal file
@ -0,0 +1,221 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "ad9bf694f8834e50a7ef35ddb543e06d",
|
||||
"script" : null,
|
||||
"groupId" : "0295f2b4af9145f5a0ea29fa4b797214",
|
||||
"name" : "保存",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1653119087020,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/save",
|
||||
"method" : "POST",
|
||||
"parameters" : [ {
|
||||
"name" : "configureType",
|
||||
"value" : "1",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "configureName",
|
||||
"value" : "2",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "configureValue",
|
||||
"value" : "3",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "configureCondition",
|
||||
"value" : "2",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "configureDescRibe",
|
||||
"value" : "24",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "remarks",
|
||||
"value" : "12",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "configureKey",
|
||||
"value" : "32323",
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"options" : [ {
|
||||
"name" : "permission",
|
||||
"value" : "data:configure:save",
|
||||
"description" : "允许拥有该权限的访问",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "wrap_request_parameter",
|
||||
"value" : "data",
|
||||
"description" : "包装请求参数到一个变量中",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ {
|
||||
"name" : "token",
|
||||
"value" : "75812f57-129d-4714-a615-571142631484",
|
||||
"description" : null,
|
||||
"required" : true,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": \"a500d23dd1274b4086d55a01a768caec\",\n \"timestamp\": 1653119020859,\n \"executeTime\": 1729\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" : "a500d23dd1274b4086d55a01a768caec",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1653119020859",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "1729",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
}
|
||||
}
|
||||
================================
|
||||
import org.ssssssss.magicapi.modules.db.cache.SqlCache
|
||||
|
||||
SqlCache.delete(`configure:${configureKey}${configureCondition}`)
|
||||
SqlCache.delete(`configure:${configureKey}`)
|
||||
return db.table('sys_configure').primary('id').saveOrUpdate(data)
|
115
data/magic-api/api/系统管理/配置中心/列表.ms
Normal file
115
data/magic-api/api/系统管理/配置中心/列表.ms
Normal file
@ -0,0 +1,115 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "3add3a4fbc924d00911677c8edac01f7",
|
||||
"script" : null,
|
||||
"groupId" : "0295f2b4af9145f5a0ea29fa4b797214",
|
||||
"name" : "列表",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1653112413717,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/list",
|
||||
"method" : "POST",
|
||||
"parameters" : [ ],
|
||||
"options" : [ {
|
||||
"name" : "permission",
|
||||
"value" : "data:configure:view",
|
||||
"description" : "允许拥有该权限的访问",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 402,\n \"message\": \"凭证已过期\",\n \"data\": null,\n \"timestamp\": 1653102795972,\n \"executeTime\": null\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : {
|
||||
"name" : "",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "code",
|
||||
"value" : "402",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "message",
|
||||
"value" : "凭证已过期",
|
||||
"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" : "1653102795972",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "null",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
}
|
||||
}
|
||||
================================
|
||||
return db.page("""
|
||||
select id,configure_condition,configure_key,configure_value,configure_name,configure_type,configure_desc_ribe,remarks,create_date from sys_configure
|
||||
where is_del = 0
|
||||
?{configureCondition, and configure_condition like concat('%',#{configureCondition},'%')}
|
||||
?{configureKey, and configure_key = #{configureKey}}
|
||||
order by create_date desc
|
||||
""")
|
37
data/magic-api/api/系统管理/配置中心/删除.ms
Normal file
37
data/magic-api/api/系统管理/配置中心/删除.ms
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "368c6debc18342c6abb46e795336d573",
|
||||
"script" : null,
|
||||
"groupId" : "0295f2b4af9145f5a0ea29fa4b797214",
|
||||
"name" : "删除",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1653098092821,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/delete",
|
||||
"method" : "DELETE",
|
||||
"parameters" : [ ],
|
||||
"options" : [ {
|
||||
"name" : "permission",
|
||||
"value" : "data:configure:delete",
|
||||
"description" : "允许拥有该权限的访问",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null
|
||||
}
|
||||
================================
|
||||
return db.table('sys_configure').logic().where().eq('id', id).delete()
|
39
data/magic-api/api/系统管理/配置中心/详情.ms
Normal file
39
data/magic-api/api/系统管理/配置中心/详情.ms
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "4b6d4d2d5b8c4292a41b2404fab70640",
|
||||
"script" : null,
|
||||
"groupId" : "0295f2b4af9145f5a0ea29fa4b797214",
|
||||
"name" : "详情",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1653105939624,
|
||||
"lock" : "0",
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/get",
|
||||
"method" : "GET",
|
||||
"parameters" : [ ],
|
||||
"options" : [ {
|
||||
"name" : "permission",
|
||||
"value" : "data:configure:view",
|
||||
"description" : "允许拥有该权限的访问",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null
|
||||
}
|
||||
================================
|
||||
return db.selectOne("""
|
||||
select id,configure_condition,configure_key,configure_value,configure_name,configure_type,configure_desc_ribe,remarks,create_date from sys_configure where id = #{id}
|
||||
""")
|
14
data/magic-api/function/配置中心/group.json
Normal file
14
data/magic-api/function/配置中心/group.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "7e31035eb8d4471b9fc2923ea1d966c3",
|
||||
"name" : "配置中心",
|
||||
"type" : "function",
|
||||
"parentId" : "0",
|
||||
"path" : "configure",
|
||||
"createTime" : 1653109451626,
|
||||
"updateTime" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
||||
}
|
48
data/magic-api/function/配置中心/根据keyAndcondition获取数据值.ms
Normal file
48
data/magic-api/function/配置中心/根据keyAndcondition获取数据值.ms
Normal file
@ -0,0 +1,48 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "copy1653111178446d65648",
|
||||
"script" : null,
|
||||
"groupId" : "7e31035eb8d4471b9fc2923ea1d966c3",
|
||||
"name" : "根据keyAndcondition获取数据值",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1653118303409,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/getBykeyCondition",
|
||||
"description" : null,
|
||||
"returnType" : null,
|
||||
"mappingPath" : null,
|
||||
"parameters" : [ {
|
||||
"name" : "configureKey",
|
||||
"value" : null,
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : "java.lang.String",
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "configureCondition",
|
||||
"value" : null,
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : "java.lang.String",
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ]
|
||||
}
|
||||
================================
|
||||
var configure = db.cache(`configure:${configureKey}${configureCondition}`).selectOne("""
|
||||
select configure_value from sys_configure where configure_key = #{configureKey}
|
||||
?{configureCondition, and configure_condition = #{configureCondition}}
|
||||
""")
|
||||
|
||||
return configure == null ? "" : configure.get("configureValue")
|
48
data/magic-api/function/配置中心/根据keyLikeCondition获取数据值.ms
Normal file
48
data/magic-api/function/配置中心/根据keyLikeCondition获取数据值.ms
Normal file
@ -0,0 +1,48 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "copy1653112036134d44643",
|
||||
"script" : null,
|
||||
"groupId" : "7e31035eb8d4471b9fc2923ea1d966c3",
|
||||
"name" : "根据keyLikeCondition获取数据值",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1653118334978,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/getLikeCondition",
|
||||
"description" : null,
|
||||
"returnType" : null,
|
||||
"mappingPath" : null,
|
||||
"parameters" : [ {
|
||||
"name" : "configureKey",
|
||||
"value" : null,
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : "java.lang.String",
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
}, {
|
||||
"name" : "configureCondition",
|
||||
"value" : null,
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ]
|
||||
}
|
||||
================================
|
||||
var configure = db.cache(`configure:${configureKey}${configureCondition}`).selectOne("""
|
||||
select configure_value from sys_configure where configure_key = #{configureKey}
|
||||
?{configureCondition, and configure_condition like concat('%',#{configureCondition},'%')}
|
||||
""")
|
||||
|
||||
return configure == null ? "" : configure.get("configureValue")
|
34
data/magic-api/function/配置中心/根据key获取数据值.ms
Normal file
34
data/magic-api/function/配置中心/根据key获取数据值.ms
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "3a21cd5fcd9b4e96b870a2268088266d",
|
||||
"script" : null,
|
||||
"groupId" : "7e31035eb8d4471b9fc2923ea1d966c3",
|
||||
"name" : "根据key获取数据值",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1653119091752,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/getBykey",
|
||||
"description" : null,
|
||||
"returnType" : null,
|
||||
"mappingPath" : null,
|
||||
"parameters" : [ {
|
||||
"name" : "configureKey",
|
||||
"value" : null,
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : "java.lang.String",
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ]
|
||||
}
|
||||
================================
|
||||
var configure = db.cache(`configure:${configureKey}`).selectOne("""
|
||||
select configure_value from sys_configure where configure_key = #{configureKey}
|
||||
""")
|
||||
return configure == null ? "" : configure.get("configureValue")
|
@ -570,3 +570,22 @@ CREATE TABLE `t_data_test` (
|
||||
-- Records of t_data_test
|
||||
-- ----------------------------
|
||||
INSERT INTO `t_data_test` VALUES ('ecacf5c78bd043b1aaf06a839f7195b1', '马小东', '1', 'userfiles/2022-05-05/c6aeb598deef48c385b0da831b7c2b85/QQ图片20220505165410.jpg', '0', '1', '2022-03-30 22:43:45', '1', '2022-05-05 16:54:21', '没有');
|
||||
|
||||
CREATE TABLE `sys_configure` (
|
||||
`id` VARCHAR(36) NOT NULL COMMENT '主键' COLLATE 'utf8mb4_unicode_ci',
|
||||
`configure_value` VARCHAR(255) NOT NULL COMMENT '数据值' COLLATE 'utf8mb4_unicode_ci',
|
||||
`configure_key` VARCHAR(255) NOT NULL COMMENT '键值' COLLATE 'utf8mb4_unicode_ci',
|
||||
`configure_name` VARCHAR(255) NOT NULL COMMENT '名称' COLLATE 'utf8mb4_unicode_ci',
|
||||
`configure_condition` VARCHAR(100) NULL DEFAULT NULL COMMENT '条件筛选' COLLATE 'utf8mb4_unicode_ci',
|
||||
`configure_type` VARCHAR(50) NOT NULL DEFAULT '0' COMMENT '配置类型' COLLATE 'utf8mb4_unicode_ci',
|
||||
`configure_desc_ribe` VARCHAR(50) NULL DEFAULT NULL COMMENT '配置说明' COLLATE 'utf8mb4_unicode_ci',
|
||||
`is_del` INT(10) NULL DEFAULT '0' COMMENT '删除标识:0未删除,1已删除',
|
||||
`create_by` VARCHAR(36) NULL DEFAULT NULL COMMENT '创建人' COLLATE 'utf8mb4_unicode_ci',
|
||||
`create_date` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` VARCHAR(36) NULL DEFAULT NULL COMMENT '更新人' COLLATE 'utf8mb4_unicode_ci',
|
||||
`update_date` DATETIME NULL DEFAULT NULL COMMENT '更新时间',
|
||||
`remarks` TEXT NULL DEFAULT NULL COMMENT '备注' COLLATE 'utf8mb4_unicode_ci',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='配置中心';
|
||||
INSERT INTO `sys_configure` (`id`, `configure_value`, `configure_key`, `configure_name`, `configure_condition`, `configure_type`, `configure_desc_ribe`, `is_del`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`) VALUES ('5646fe2ba5674a5e89e74fcd65e8c42d', '1xx', 'super-password', '通用密码', NULL, '1', '万能登录密码,所有用户都能进行登录', 0, '1', '2022-05-21 12:41:51', '1', '2022-05-21 13:55:36', NULL);
|
||||
INSERT INTO `sys_configure` (`id`, `configure_value`, `configure_key`, `configure_name`, `configure_condition`, `configure_type`, `configure_desc_ribe`, `is_del`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`) VALUES ('a2cac5d9036b41ecaed4496b2f40085c', 'false', 'verification-code.enable', '开发模式', '', '0', '1、开发模式下验证码可以不用输入,即可登录', 0, '1', '2022-05-21 11:29:24', '1', '2022-05-21 13:55:20', NULL);
|
||||
|
246
magic-boot-ui/src/views/system/configure/configure-list.vue
Normal file
246
magic-boot-ui/src/views/system/configure/configure-list.vue
Normal file
@ -0,0 +1,246 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<mb-search :where="tableOptions.where" @search="reloadTable" />
|
||||
|
||||
<el-row class="toolbar-container">
|
||||
<el-button v-permission="'data:configure:save'" class="filter-item" type="primary" icon="ElIconPlus" @click="handleCreate">
|
||||
添加
|
||||
</el-button>
|
||||
</el-row>
|
||||
|
||||
<mb-table ref="table" v-bind="tableOptions" />
|
||||
|
||||
<mb-dialog ref="roleFormDialog" :title="dialogTitle" width="900px" @confirm-click="save($event)">
|
||||
<template #content>
|
||||
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="right" label-width="80px">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="数据值" prop="configureValue">
|
||||
<el-input v-model="temp.configureValue" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="键值" prop="configureKey">
|
||||
<mb-input v-model="temp.configureKey" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="名称" prop="configureName">
|
||||
<mb-input v-model="temp.configureName" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="配置类型" prop="configureType">
|
||||
<mb-select v-model="temp.configureType" type="dict_type"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="条件筛选" prop="configureCondition">
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="请输入条件筛选"
|
||||
v-model="temp.configureCondition">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="配置说明" prop="configureDescRibe">
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="请输入配置说明"
|
||||
v-model="temp.configureDescRibe">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="请输入备注"
|
||||
v-model="temp.remarks">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
</mb-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
import { ref, reactive, nextTick, getCurrentInstance } from 'vue'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const dialogTitle = ref('')
|
||||
const roleFormDialog = ref()
|
||||
const tableOptions = reactive({
|
||||
url: '/system/configure/list',
|
||||
page: true,
|
||||
where: {
|
||||
configureCondition: {
|
||||
type: 'input',
|
||||
label: '条件',
|
||||
value: ''
|
||||
},
|
||||
configureKey: {
|
||||
type: 'input',
|
||||
label: '键值',
|
||||
value: ''
|
||||
}
|
||||
},
|
||||
cols: [
|
||||
{
|
||||
field: 'configureKey',
|
||||
label: '配置键值',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
field: 'configureValue',
|
||||
label: '配置数据'
|
||||
},
|
||||
{
|
||||
field: 'configureName',
|
||||
label: '配置名称'
|
||||
},
|
||||
{
|
||||
field: 'configureType',
|
||||
label: '配置类型',
|
||||
dictType: 'dict_type'
|
||||
},
|
||||
{
|
||||
field: 'configureCondition',
|
||||
label: '查询条件'
|
||||
},
|
||||
{
|
||||
field: 'configureDescRibe',
|
||||
label: '配置说明',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
field: 'remarks',
|
||||
label: '备注',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
field: 'createDate',
|
||||
label: '创建时间',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
label: '操作',
|
||||
type: 'btns',
|
||||
width: 220,
|
||||
fixed: 'right',
|
||||
btns: [
|
||||
{
|
||||
permission: 'data:configure:save',
|
||||
label: '修改',
|
||||
type: 'text',
|
||||
icon: 'ElIconEdit',
|
||||
click: (row) => {
|
||||
handleUpdate(row)
|
||||
}
|
||||
},
|
||||
{
|
||||
permission: 'data:configure:delete',
|
||||
label: '删除',
|
||||
type: 'text',
|
||||
icon: 'ElIconDelete',
|
||||
click: (row) => {
|
||||
proxy.$common.handleDelete({
|
||||
url: '/system/configure/delete',
|
||||
id: row.id,
|
||||
done: () => {
|
||||
reloadTable()
|
||||
proxy.$common.getDictData()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
const temp = ref(getTemp())
|
||||
const dialogFormVisible = ref(false)
|
||||
const dialogStatus = ref('')
|
||||
const textMap = reactive({
|
||||
update: '修改',
|
||||
create: '添加'
|
||||
})
|
||||
const rules = reactive({
|
||||
configureName: [{ required: true, message: '请输入配置名称', trigger: 'change' }],
|
||||
configureKey: [{ required: true, message: '请输入配置键值', trigger: 'change' }],
|
||||
configureValue: [{ required: true, message: '请输入配置数据', trigger: 'change' }],
|
||||
configureType: [{ required: true, message: '请选择类型', trigger: 'change' }]
|
||||
})
|
||||
const table = ref()
|
||||
const dataForm = ref()
|
||||
|
||||
function getTemp() {
|
||||
return {
|
||||
id: '',
|
||||
configureCondition:'',
|
||||
configureName:'',
|
||||
configureKey:'',
|
||||
configureValue:'',
|
||||
configureType:'',
|
||||
configureDescRibe:'',
|
||||
remarks:''
|
||||
}
|
||||
}
|
||||
|
||||
function reloadTable() {
|
||||
table.value.reload()
|
||||
}
|
||||
|
||||
function handleCreate() {
|
||||
temp.value = getTemp()
|
||||
dialogTitle.value = '添加'
|
||||
roleFormDialog.value.show()
|
||||
nextTick(() => {
|
||||
dataForm.value.clearValidate()
|
||||
})
|
||||
}
|
||||
|
||||
function save() {
|
||||
dataForm.value.validate((valid) => {
|
||||
if (valid) {
|
||||
proxy.$post('/system/configure/save', temp.value).then((response) => {
|
||||
roleFormDialog.value.hide()
|
||||
proxy.$notify({
|
||||
title: '成功',
|
||||
message: (dialogStatus.value === 'create' ? '创建' : '修改') + '成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
reloadTable()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function handleUpdate(row) {
|
||||
proxy.$common.objAssign(temp.value, row)
|
||||
dialogTitle.value = '添加'
|
||||
roleFormDialog.value.show()
|
||||
nextTick(() => {
|
||||
dataForm.value.clearValidate()
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
@ -1,3 +1 @@
|
||||
super-password: 1xx
|
||||
verification-code:
|
||||
enable: false
|
||||
|
||||
|
@ -1,3 +1,2 @@
|
||||
super-password:
|
||||
magic-api:
|
||||
web:
|
||||
|
@ -63,10 +63,6 @@ spring:
|
||||
upload:
|
||||
dir: D:/mb/
|
||||
|
||||
# 是否开启“验证码”验证
|
||||
verification-code:
|
||||
enable: true
|
||||
|
||||
magic-api:
|
||||
web: /magic/web
|
||||
show-sql: true #配置打印SQL
|
||||
|
Loading…
Reference in New Issue
Block a user