DROP TABLE IF EXISTS `setting_system_config_item`;
CREATE TABLE `setting_system_config_item`
(
    `id`              VARCHAR(32)  NOT NULL,
    `config_key`      VARCHAR(50)  NOT NULL COMMENT '参数值Key',
    `item_name`       VARCHAR(500) NOT NULL COMMENT '参数名字',
    `item_key`        VARCHAR(50)  NOT NULL COMMENT '参数值Key',
    `item_value_type` INT(2) NOT NULL COMMENT '参数值类型',
    `item_value`      VARCHAR(500) NOT NULL COMMENT '参数值',
    `input_remark`    VARCHAR(200) NOT NULL COMMENT '填写说明',
    `sort_value`      INT(11) NOT NULL DEFAULT '0' COMMENT '排序值',
    PRIMARY KEY (`id`),
    INDEX             `config_key_index` (`config_key`),
    INDEX             `item_key_index` (`item_key`)
) COMMENT='系统参数值' ENGINE=InnoDB;

DROP TABLE IF EXISTS `setting_system_config`;
CREATE TABLE `setting_system_config`
(
    `id`         VARCHAR(32)  NOT NULL,
    `config_key` VARCHAR(50)  NOT NULL COMMENT '参数Key',
    `name`       VARCHAR(32)  NOT NULL COMMENT '参数名称',
    `remark`     VARCHAR(255) NOT NULL COMMENT '参数说明',
    PRIMARY KEY (`id`),
    INDEX        `config_key_index` (`config_key`)
) COMMENT='系统参数设置' ENGINE=InnoDB;


REPLACE
INTO `setting_system_config` (`id`, `config_key`, `name`, `remark`)
VALUES (md5('OAUTH2_API_CONFIG'), 'OAUTH2_API_CONFIG', 'Oauth2认证', '第三方Oauth2认证配置');


REPLACE
INTO `setting_system_config_item` (`id`, `config_key`, `item_name`, `item_key`, `item_value_type`, `item_value`, `input_remark`, `sort_value`)
VALUES (md5('OAUTH2_API_CONFIG@hostAddress'), 'OAUTH2_API_CONFIG', '域名地址', 'hostAddress', 1, 'http://apis-dev.smartcity.123cx.com/blade-auth', '', 1),
       (md5('OAUTH2_API_CONFIG@tenantId'), 'OAUTH2_API_CONFIG', '租户ID', 'tenantId', 1, '222712', '', 2),
       (md5('OAUTH2_API_CONFIG@clientSecret'), 'OAUTH2_API_CONFIG', '租户密钥', 'clientSecret', 1, 'c2FiZXI6c2FiZXJfc2VjcmV0', '', 3);

