SET NAMES utf8 ;
SET FOREIGN_KEY_CHECKS=0;
CREATE TABLE `sys_basekey_cat` (
  `id` varchar(32) NOT NULL COMMENT '主键',
  `name` varchar(255) NOT NULL COMMENT '显示名',
  `description` varchar(255) DEFAULT NULL COMMENT '描述',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


LOCK TABLES `sys_basekey_cat` WRITE;
/*!40000 ALTER TABLE `sys_basekey_cat` DISABLE KEYS */;
INSERT INTO `sys_basekey_cat` (`id`, `name`, `description`) VALUES ('ci_group','ci_group',NULL);
INSERT INTO `sys_basekey_cat` (`id`, `name`, `description`) VALUES ('ci_layer','ci_layer',NULL);
INSERT INTO `sys_basekey_cat` (`id`, `name`, `description`) VALUES ('ref_type','ref_type',NULL);
/*!40000 ALTER TABLE `sys_basekey_cat` ENABLE KEYS */;
UNLOCK TABLES;

CREATE TABLE `sys_basekey_code` (
  `id` varchar(128) NOT NULL COMMENT '主键',
  `cat_id` varchar(32) NOT NULL COMMENT '所属配置组',
  `code` varchar(255) NOT NULL COMMENT '配置key',
  `value` varchar(255) DEFAULT NULL COMMENT '配置value',
  `description` varchar(255) DEFAULT NULL COMMENT '描述',
  `seq_no` int(11) DEFAULT '0' COMMENT '排序号',
  `status` varchar(20) DEFAULT 'active' COMMENT '状态',
  PRIMARY KEY (`id`),
  KEY `sys_basekey_code_cat_id` (`cat_id`),
  CONSTRAINT `sys_basekey_code_cat_id` FOREIGN KEY (`cat_id`) REFERENCES `sys_basekey_cat` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


LOCK TABLES `sys_basekey_code` WRITE;
/*!40000 ALTER TABLE `sys_basekey_code` DISABLE KEYS */;
INSERT INTO `sys_basekey_code` (`id`, `cat_id`, `code`, `value`, `description`, `seq_no`, `status`) VALUES ('ref_type__belong','ref_type','belong','属于',NULL,1,'active');
INSERT INTO `sys_basekey_code` (`id`, `cat_id`, `code`, `value`, `description`, `seq_no`, `status`) VALUES ('ref_type__depend','ref_type','depend','依赖',NULL,2,'active');
INSERT INTO `sys_basekey_code` (`id`, `cat_id`, `code`, `value`, `description`, `seq_no`, `status`) VALUES ('ref_type__realize','ref_type','realize','实现',NULL,3,'active');
INSERT INTO `sys_basekey_code` (`id`, `cat_id`, `code`, `value`, `description`, `seq_no`, `status`) VALUES ('ref_type__relation','ref_type','relation','关联',NULL,5,'active');
INSERT INTO `sys_basekey_code` (`id`, `cat_id`, `code`, `value`, `description`, `seq_no`, `status`) VALUES ('ref_type__use','ref_type','use','使用',NULL,4,'active');
/*!40000 ALTER TABLE `sys_basekey_code` ENABLE KEYS */;
UNLOCK TABLES;

CREATE TABLE `sys_ci_template` (
  `id` varchar(32) NOT NULL COMMENT '主键',
  `description` varchar(255) DEFAULT NULL COMMENT '描述',
  `image_file` varchar(32) DEFAULT NULL COMMENT '图标',
  `state_machine` varchar(32) NOT NULL COMMENT '所属状态机',
  PRIMARY KEY (`id`),
  KEY `sys_ci_template_machine` (`state_machine`),
  KEY `sys_ci_template_image_idx` (`image_file`),
  CONSTRAINT `sys_ci_template_image` FOREIGN KEY (`image_file`) REFERENCES `sys_files` (`guid`),
  CONSTRAINT `sys_ci_template_machine` FOREIGN KEY (`state_machine`) REFERENCES `sys_state_machine` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

LOCK TABLES `sys_ci_template` WRITE;
/*!40000 ALTER TABLE `sys_ci_template` DISABLE KEYS */;
INSERT INTO `sys_ci_template` (`id`, `description`, `image_file`, `state_machine`) VALUES ('create_destroy','创销类模版','60a46b5948a2b249','create_destroy');
INSERT INTO `sys_ci_template` (`id`, `description`, `image_file`, `state_machine`) VALUES ('design','设计类模版','60a46b5948a2b249','design');
INSERT INTO `sys_ci_template` (`id`, `description`, `image_file`, `state_machine`) VALUES ('start_stop','起停类模版','60a46b5948a2b249','start_stop');
/*!40000 ALTER TABLE `sys_ci_template` ENABLE KEYS */;
UNLOCK TABLES;

CREATE TABLE `sys_ci_template_attr` (
  `id` varchar(128) NOT NULL COMMENT 'ci_template.name',
  `ci_template` varchar(32) NOT NULL COMMENT '所属ci模板',
  `name` varchar(32) NOT NULL COMMENT '属性名',
  `display_name` varchar(128) NOT NULL COMMENT '显示名',
  `description` varchar(255) DEFAULT NULL COMMENT '描述',
  `status` varchar(32) DEFAULT 'notCreated' COMMENT '状态',
  `input_type` varchar(32) NOT NULL COMMENT '字段类型',
  `data_type` varchar(32) NOT NULL COMMENT '数据库数据类型',
  `data_length` int(11) DEFAULT '0',
  `text_validate` varchar(1024) DEFAULT NULL COMMENT '正则校验',
  `ref_ci_type` varchar(32) DEFAULT NULL COMMENT '关联ci',
  `ref_name` varchar(64) DEFAULT NULL COMMENT '关联显示名',
  `ref_type` varchar(128) DEFAULT NULL COMMENT '关联类型',
  `ref_filter` varchar(4096) DEFAULT NULL COMMENT '关联过滤规则',
  `ref_update_state_validate` varchar(2048) DEFAULT NULL COMMENT '关联状态映射',
  `ref_confirm_state_validate` varchar(2048) DEFAULT NULL COMMENT '确认状态映射',
  `select_list` varchar(32) DEFAULT NULL COMMENT '枚举列表',
  `ui_search_order` int(11) DEFAULT '0' COMMENT '搜索条件排序',
  `ui_form_order` int(11) DEFAULT '0' COMMENT '字段显示排序',
  `unique_constraint` varchar(16) DEFAULT 'no' COMMENT '唯一约束',
  `ui_nullable` varchar(16) DEFAULT 'no' COMMENT '前端允许为空',
  `nullable` varchar(16) DEFAULT 'no' COMMENT '允许为空',
  `editable` varchar(16) DEFAULT 'yes' COMMENT '是否可编辑',
  `display_by_default` varchar(16) DEFAULT 'yes' COMMENT '默认显示',
  `permission_usage` varchar(16) DEFAULT 'no' COMMENT '允许权限控制',
  `reset_on_edit` varchar(16) DEFAULT 'no' COMMENT '编辑重置',
  `source` varchar(16) NOT NULL DEFAULT 'custom' COMMENT 'template or custom',
  `customizable` varchar(16) NOT NULL DEFAULT 'yes' COMMENT '可以修改',
  `autofillable` varchar(16) DEFAULT 'no' COMMENT '是否自动填充',
  `autofill_rule` varchar(4096) DEFAULT NULL COMMENT '填充规则',
  `autofill_type` varchar(32) DEFAULT NULL COMMENT 'suggest or forced',
  `edit_group_control` varchar(32) DEFAULT 'no',
  `edit_group_value` varchar(1024) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sys_ci_template_attr_ci_template` (`ci_template`),
  KEY `sys_ci_template_attr_ref_ci_type` (`ref_ci_type`),
  KEY `sys_ci_template_attr_ref_type` (`ref_type`),
  CONSTRAINT `sys_ci_template_attr_ci_template` FOREIGN KEY (`ci_template`) REFERENCES `sys_ci_template` (`id`),
  CONSTRAINT `sys_ci_template_attr_ref_ci_type` FOREIGN KEY (`ref_ci_type`) REFERENCES `sys_ci_type` (`id`),
  CONSTRAINT `sys_ci_template_attr_ref_type` FOREIGN KEY (`ref_type`) REFERENCES `sys_basekey_code` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

LOCK TABLES `sys_ci_template_attr` WRITE;
/*!40000 ALTER TABLE `sys_ci_template_attr` DISABLE KEYS */;
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('create_destroy__asset_id','create_destroy','asset_id','资产ID','资产ID','notCreated','text','varchar',1024,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,4,5,'yes','yes','yes','yes','yes','no','no','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('create_destroy__code','create_destroy','code','编码简称','编码简称','notCreated','text','varchar',64,'[0-9a-zA-Z]{2,10}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,3,3,'no','no','no','yes','yes','no','no','template','yes','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('create_destroy__confirm.time','create_destroy','confirm_time','确认时间','确认时间','notCreated','datetime','datetime',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,'no','yes','yes','no','yes','no','yes','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('create_destroy__create_time','create_destroy','create_time','创建时间','创建时间','notCreated','datetime','datetime',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'no','yes','no','no','no','no','yes','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('create_destroy__create_user','create_destroy','create_user','创建人','创建人','notCreated','text','varchar',64,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'no','yes','no','no','no','no','yes','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('create_destroy__guid','create_destroy','guid','全局唯一ID','全局唯一ID','notCreated','text','varchar',64,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'yes','yes','no','no','no','no','no','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('create_destroy__key_name','create_destroy','key_name','唯一名称','唯一名称','notCreated','text','varchar',1024,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,'yes','yes','yes','no','yes','no','no','template','yes','yes',NULL,'force','no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('create_destroy__state','create_destroy','state','状态','状态','notCreated','text','varchar',64,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'no','yes','yes','no','yes','no','no','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('create_destroy__update_time','create_destroy','update_time','修改时间','修改时间','notCreated','datetime','datetime',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'no','yes','no','no','no','no','yes','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('create_destroy__update_user','create_destroy','update_user','修改人','修改人','notCreated','text','varchar',64,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'no','yes','no','no','no','no','yes','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('design__code','design','code','编码简称','编码简称','notCreated','text','varchar',64,'[0-9a-zA-Z]{2,10}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,3,3,'no','no','no','yes','yes','no','no','template','yes','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('design__confirm.time','design','confirm_time','确认时间','确认时间','notCreated','datetime','datetime',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,'no','yes','yes','no','yes','no','yes','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('design__create_time','design','create_time','创建时间','创建时间','notCreated','datetime','datetime',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'no','yes','no','no','no','no','yes','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('design__create_user','design','create_user','创建人','创建人','notCreated','text','varchar',64,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'no','yes','no','no','no','no','yes','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('design__guid','design','guid','全局唯一ID','全局唯一ID','notCreated','text','varchar',64,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'yes','yes','no','no','no','no','no','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('design__key_name','design','key_name','唯一名称','唯一名称','notCreated','text','varchar',1024,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,'yes','yes','yes','no','yes','no','no','template','yes','yes',NULL,'force','no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('design__state','design','state','状态','状态','notCreated','text','varchar',64,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'no','yes','yes','no','yes','no','no','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('design__update_time','design','update_time','修改时间','修改时间','notCreated','datetime','datetime',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'no','yes','no','no','no','no','yes','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('design__update_user','design','update_user','修改人','修改人','notCreated','text','varchar',64,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'no','yes','no','no','no','no','yes','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('start_stop__asset_id','start_stop','asset_id','资产ID','资产ID','notCreated','text','varchar',1024,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,4,5,'yes','yes','yes','yes','yes','no','no','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('start_stop__code','start_stop','code','编码简称','编码简称','notCreated','text','varchar',64,'[0-9a-zA-Z]{2,10}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,3,3,'no','no','no','yes','yes','no','no','template','yes','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('start_stop__confirm.time','start_stop','confirm_time','确认时间','确认时间','notCreated','datetime','datetime',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,'no','yes','yes','no','yes','no','yes','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('start_stop__create_time','start_stop','create_time','创建时间','创建时间','notCreated','datetime','datetime',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'no','yes','no','no','no','no','yes','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('start_stop__create_user','start_stop','create_user','创建人','创建人','notCreated','text','varchar',64,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'no','yes','no','no','no','no','yes','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('start_stop__guid','start_stop','guid','全局唯一ID','全局唯一ID','notCreated','text','varchar',64,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'yes','yes','no','no','no','no','no','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('start_stop__key_name','start_stop','key_name','唯一名称','唯一名称','notCreated','text','varchar',1024,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,'yes','yes','yes','no','yes','no','no','template','yes','yes',NULL,'force','no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('start_stop__state','start_stop','state','状态','状态','notCreated','text','varchar',64,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'no','yes','yes','no','yes','no','no','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('start_stop__update_time','start_stop','update_time','修改时间','修改时间','notCreated','datetime','datetime',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'no','yes','no','no','no','no','yes','template','no','no',NULL,NULL,'no',NULL);
INSERT INTO `sys_ci_template_attr` (`id`, `ci_template`, `name`, `display_name`, `description`, `status`, `input_type`, `data_type`, `data_length`, `text_validate`, `ref_ci_type`, `ref_name`, `ref_type`, `ref_filter`, `ref_update_state_validate`, `ref_confirm_state_validate`, `select_list`, `ui_search_order`, `ui_form_order`, `unique_constraint`, `ui_nullable`, `nullable`, `editable`, `display_by_default`, `permission_usage`, `reset_on_edit`, `source`, `customizable`, `autofillable`, `autofill_rule`, `autofill_type`, `edit_group_control`, `edit_group_value`) VALUES ('start_stop__update_user','start_stop','update_user','修改人','修改人','notCreated','text','varchar',64,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'no','yes','no','no','no','no','yes','template','no','no',NULL,NULL,'no',NULL);
/*!40000 ALTER TABLE `sys_ci_template_attr` ENABLE KEYS */;
UNLOCK TABLES;

CREATE TABLE `sys_ci_type` (
  `id` varchar(32) NOT NULL COMMENT '名称主键',
  `display_name` varchar(32) NOT NULL COMMENT '显示名',
  `description` varchar(255) DEFAULT NULL COMMENT '描述',
  `status` varchar(20) DEFAULT 'notCreated' COMMENT '描述',
  `image_file` varchar(32) NOT NULL COMMENT '图标',
  `ci_group` varchar(128) NOT NULL COMMENT '所属图层',
  `ci_layer` varchar(128) NOT NULL COMMENT '图层层级',
  `ci_template` varchar(32) NOT NULL COMMENT '所属模版',
  `state_machine` varchar(32) NOT NULL COMMENT '关联状态机',
  `seq_no` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sys_ci_type_image` (`image_file`),
  KEY `sys_ci_type_group` (`ci_group`),
  KEY `sys_ci_type_layer` (`ci_layer`),
  KEY `sys_ci_type_template` (`ci_template`),
  KEY `sys_ci_type_machine` (`state_machine`),
  CONSTRAINT `sys_ci_type_group` FOREIGN KEY (`ci_group`) REFERENCES `sys_basekey_code` (`id`),
  CONSTRAINT `sys_ci_type_image` FOREIGN KEY (`image_file`) REFERENCES `sys_files` (`guid`),
  CONSTRAINT `sys_ci_type_layer` FOREIGN KEY (`ci_layer`) REFERENCES `sys_basekey_code` (`id`),
  CONSTRAINT `sys_ci_type_machine` FOREIGN KEY (`state_machine`) REFERENCES `sys_state_machine` (`id`),
  CONSTRAINT `sys_ci_type_template` FOREIGN KEY (`ci_template`) REFERENCES `sys_ci_template` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `sys_ci_type_attr` (
  `id` varchar(128) NOT NULL COMMENT 'ci_type.name',
  `ci_type` varchar(32) NOT NULL COMMENT '所属ci',
  `name` varchar(32) NOT NULL COMMENT '属性名',
  `display_name` varchar(64) NOT NULL COMMENT '显示名',
  `description` varchar(255) DEFAULT NULL COMMENT '描述',
  `status` varchar(32) DEFAULT 'notCreated' COMMENT '状态',
  `input_type` varchar(32) NOT NULL COMMENT '字段类型',
  `data_type` varchar(32) NOT NULL,
  `data_length` int(11) DEFAULT '0',
  `text_validate` varchar(1024) DEFAULT NULL COMMENT '正则校验',
  `ref_ci_type` varchar(32) DEFAULT NULL COMMENT '关联ci',
  `ref_name` varchar(64) DEFAULT NULL COMMENT '关联显示名',
  `ref_type` varchar(128) DEFAULT NULL COMMENT '关联类型',
  `ref_filter` varchar(4096) DEFAULT NULL COMMENT '关联过滤规则',
  `ref_update_state_validate` varchar(2048) DEFAULT NULL COMMENT '关联状态映射',
  `ref_confirm_state_validate` varchar(2048) DEFAULT NULL,
  `select_list` varchar(32) DEFAULT NULL COMMENT '枚举列表',
  `ui_search_order` int(11) DEFAULT '0' COMMENT '搜索条件排序',
  `ui_form_order` int(11) DEFAULT '0' COMMENT '字段显示排序',
  `unique_constraint` varchar(16) DEFAULT 'no' COMMENT '唯一约束',
  `ui_nullable` varchar(16) DEFAULT 'no' COMMENT '前端允许为空',
  `nullable` varchar(16) DEFAULT 'no' COMMENT '允许为空',
  `editable` varchar(16) DEFAULT 'yes' COMMENT '是否可编辑',
  `display_by_default` varchar(16) DEFAULT 'yes' COMMENT '默认显示',
  `permission_usage` varchar(16) DEFAULT 'no' COMMENT '允许权限控制',
  `reset_on_edit` varchar(16) DEFAULT 'no' COMMENT '编辑重置',
  `source` varchar(16) NOT NULL DEFAULT 'custom' COMMENT 'template or custom',
  `customizable` varchar(16) NOT NULL DEFAULT 'yes' COMMENT '可以修改',
  `autofillable` varchar(16) DEFAULT 'no' COMMENT '是否自动填充',
  `autofill_rule` varchar(4096) DEFAULT NULL COMMENT '填充规则',
  `autofill_type` varchar(32) DEFAULT NULL COMMENT 'suggest or forced',
  `edit_group_control` varchar(32) DEFAULT 'no',
  `edit_group_value` varchar(1024) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sys_ci_type_attr_ref_ci_type` (`ref_ci_type`),
  KEY `sys_ci_type_attr_ref_type` (`ref_type`),
  KEY `sys_ci_attr_ci_type_idx` (`ci_type`),
  KEY `sys_ci_type_attr_select_list_idx` (`select_list`),
  CONSTRAINT `sys_ci_type_attr_ci_type` FOREIGN KEY (`ci_type`) REFERENCES `sys_ci_type` (`id`),
  CONSTRAINT `sys_ci_type_attr_ref_ci_type` FOREIGN KEY (`ref_ci_type`) REFERENCES `sys_ci_type` (`id`),
  CONSTRAINT `sys_ci_type_attr_ref_type` FOREIGN KEY (`ref_type`) REFERENCES `sys_basekey_code` (`id`),
  CONSTRAINT `sys_ci_type_attr_select_list` FOREIGN KEY (`select_list`) REFERENCES `sys_basekey_cat` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


CREATE TABLE `sys_files` (
  `guid` varchar(32) NOT NULL COMMENT '随机主键',
  `type` varchar(32) DEFAULT NULL COMMENT '图片类型',
  `content` blob COMMENT '二进制图片',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

LOCK TABLES `sys_files` WRITE;
/*!40000 ALTER TABLE `sys_files` DISABLE KEYS */;
INSERT INTO `sys_files` (`guid`, `type`, `content`, `update_time`) VALUES ('60a46b5948a2b249','png', ,'2021-05-18 01:35:21');
/*!40000 ALTER TABLE `sys_files` ENABLE KEYS */;
UNLOCK TABLES;

CREATE TABLE `sys_graph` (
  `id` varchar(32) NOT NULL,
  `name` varchar(64) DEFAULT NULL,
  `view` varchar(32) NOT NULL,
  `graph_type` varchar(32) NOT NULL,
  `node_groups` varchar(128) DEFAULT NULL COMMENT '图形分组数据,A->B->C',
  `graph_dir` varchar(45) DEFAULT NULL COMMENT '图形方向',
  PRIMARY KEY (`id`),
  KEY `sys_graph_view_idx` (`view`),
  CONSTRAINT `sys_graph_view` FOREIGN KEY (`view`) REFERENCES `sys_view` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


CREATE TABLE `sys_graph_element` (
  `id` varchar(128) NOT NULL,
  `graph` varchar(32) NOT NULL,
  `parent_element` varchar(128) DEFAULT NULL,
  `report_object` varchar(64) NOT NULL,
  `show_table` varchar(32) DEFAULT 'false' COMMENT '是否显示表格数据',
  `display_expression` varchar(128) NOT NULL COMMENT '显示名的表达式',
  `node_group_name` varchar(32) DEFAULT NULL,
  `line_start_data` varchar(32) DEFAULT NULL,
  `line_end_data` varchar(32) DEFAULT NULL,
  `line_display_position` varchar(32) DEFAULT NULL,
  `graph_type` varchar(32) DEFAULT NULL,
  `graph_shape_data` varchar(32) DEFAULT NULL,
  `graph_shapes` varchar(128) DEFAULT NULL,
  `graph_config_data` varchar(32) DEFAULT NULL,
  `graph_configs` varchar(1024) DEFAULT NULL,
  `edit_ref_attr` varchar(64) DEFAULT NULL,
  `graph_filter_data` varchar(64) DEFAULT NULL,
  `graph_filter_values` varchar(128) DEFAULT NULL,
  `editable` varchar(32) DEFAULT NULL,
  `seq_no` int(11) DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `sys_view_node_view_idx` (`graph`),
  KEY `sys_view_node_parent_node_idx` (`parent_element`),
  KEY `sys_graph_node_edit_ref_attr_idx` (`edit_ref_attr`),
  CONSTRAINT `sys_graph_element_edit_ref_attr` FOREIGN KEY (`edit_ref_attr`) REFERENCES `sys_ci_type_attr` (`id`),
  CONSTRAINT `sys_graph_element_graph` FOREIGN KEY (`graph`) REFERENCES `sys_graph` (`id`),
  CONSTRAINT `sys_graph_element_parent_element` FOREIGN KEY (`parent_element`) REFERENCES `sys_graph_element` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


CREATE TABLE `sys_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `log_cat` varchar(64) NOT NULL COMMENT '日志归类',
  `operator` varchar(20) NOT NULL COMMENT '操作用户',
  `operation` varchar(64) NOT NULL COMMENT '操作行为',
  `content` longtext COMMENT '具体内容',
  `request_url` varchar(512) DEFAULT NULL COMMENT '请求url',
  `client_host` varchar(20) DEFAULT NULL COMMENT '请求客户端IP',
  `created_date` varchar(32) NOT NULL COMMENT '日志时间',
  `data_ci_type` varchar(32) DEFAULT NULL COMMENT '数据所属ci',
  `data_guid` varchar(64) DEFAULT NULL COMMENT '数据guid',
  `data_key_name` varchar(32) DEFAULT NULL COMMENT '数据名称',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=656 DEFAULT CHARSET=utf8mb4;


CREATE TABLE `sys_menu` (
  `id` varchar(32) NOT NULL COMMENT '名称主键',
  `display_name` varchar(64) DEFAULT NULL COMMENT '显示名',
  `url` varchar(255) DEFAULT NULL COMMENT '访问路径',
  `seq_no` int(11) DEFAULT '0' COMMENT '排序号',
  `parent` varchar(32) DEFAULT NULL COMMENT '父菜单',
  `is_active` varchar(8) DEFAULT 'yes' COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


LOCK TABLES `sys_menu` WRITE;
/*!40000 ALTER TABLE `sys_menu` DISABLE KEYS */;
INSERT INTO `sys_menu` (`id`, `display_name`, `url`, `seq_no`, `parent`, `is_active`) VALUES ('configuration','配置管理',NULL,3,NULL,'yes');
INSERT INTO `sys_menu` (`id`, `display_name`, `url`, `seq_no`, `parent`, `is_active`) VALUES ('data_mgmt','数据管理',NULL,2,NULL,'yes');
INSERT INTO `sys_menu` (`id`, `display_name`, `url`, `seq_no`, `parent`, `is_active`) VALUES ('data_mgmt_ci','数据管理(CI)',NULL,1,'data_mgmt','yes');
INSERT INTO `sys_menu` (`id`, `display_name`, `url`, `seq_no`, `parent`, `is_active`) VALUES ('data_mgmt_view','数据管理(视图)',NULL,2,'data_mgmt','yes');
INSERT INTO `sys_menu` (`id`, `display_name`, `url`, `seq_no`, `parent`, `is_active`) VALUES ('data_query','数据查询',NULL,1,NULL,'yes');
INSERT INTO `sys_menu` (`id`, `display_name`, `url`, `seq_no`, `parent`, `is_active`) VALUES ('data_query_ci','数据查询(CI)',NULL,1,'data_query','yes');
INSERT INTO `sys_menu` (`id`, `display_name`, `url`, `seq_no`, `parent`, `is_active`) VALUES ('data_query_report','数据查询(报表)',NULL,2,'data_query','yes');
INSERT INTO `sys_menu` (`id`, `display_name`, `url`, `seq_no`, `parent`, `is_active`) VALUES ('data_query_view','数据查询(视图)',NULL,3,'data_query','yes');
INSERT INTO `sys_menu` (`id`, `display_name`, `url`, `seq_no`, `parent`, `is_active`) VALUES ('model_configuration','模型配置',NULL,1,'configuration','yes');
INSERT INTO `sys_menu` (`id`, `display_name`, `url`, `seq_no`, `parent`, `is_active`) VALUES ('report_configuration','报表配置',NULL,2,'configuration','yes');
INSERT INTO `sys_menu` (`id`, `display_name`, `url`, `seq_no`, `parent`, `is_active`) VALUES ('system','系统',NULL,4,NULL,'yes');
INSERT INTO `sys_menu` (`id`, `display_name`, `url`, `seq_no`, `parent`, `is_active`) VALUES ('system_authority','授权',NULL,2,'system','yes');
INSERT INTO `sys_menu` (`id`, `display_name`, `url`, `seq_no`, `parent`, `is_active`) VALUES ('system_basekey','基础数据',NULL,1,'system','yes');
INSERT INTO `sys_menu` (`id`, `display_name`, `url`, `seq_no`, `parent`, `is_active`) VALUES ('system_operation_log','操作日志',NULL,3,'system','yes');
/*!40000 ALTER TABLE `sys_menu` ENABLE KEYS */;
UNLOCK TABLES;

CREATE TABLE `sys_report` (
  `id` varchar(32) NOT NULL COMMENT '主键',
  `name` varchar(32) NOT NULL,
  `ci_type` varchar(32) NOT NULL,
  `create_time` datetime DEFAULT NULL,
  `create_user` varchar(32) DEFAULT NULL,
  `update_time` datetime DEFAULT NULL,
  `update_user` varchar(32) DEFAULT NULL,
  `sql_cache` text,
  PRIMARY KEY (`id`),
  KEY `sys_report_ci_type_idx` (`ci_type`),
  CONSTRAINT `sys_report_ci_type` FOREIGN KEY (`ci_type`) REFERENCES `sys_ci_type` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


CREATE TABLE `sys_report_object` (
  `id` varchar(64) NOT NULL,
  `report` varchar(32) NOT NULL,
  `parent_object` varchar(64) DEFAULT NULL,
  `parent_attr` varchar(128) DEFAULT NULL,
  `ci_type` varchar(32) NOT NULL,
  `my_attr` varchar(128) DEFAULT NULL,
  `data_name` varchar(64) DEFAULT NULL,
  `data_title_name` varchar(64) DEFAULT NULL,
  `seq_no` int(11) DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `sys_report_object_report_idx` (`report`),
  KEY `sys_report_object_parent_object_idx` (`parent_object`),
  KEY `sys_report_object_ci_type_idx` (`ci_type`),
  KEY `sys_report_object_my_attr_idx` (`my_attr`),
  KEY `sys_report_object_parent_attr_idx` (`parent_attr`),
  CONSTRAINT `sys_report_object_my_attr` FOREIGN KEY (`my_attr`) REFERENCES `sys_ci_type_attr` (`id`),
  CONSTRAINT `sys_report_object_parent_attr` FOREIGN KEY (`parent_attr`) REFERENCES `sys_ci_type_attr` (`id`),
  CONSTRAINT `sys_report_object_parent_object` FOREIGN KEY (`parent_object`) REFERENCES `sys_report_object` (`id`),
  CONSTRAINT `sys_report_object_report` FOREIGN KEY (`report`) REFERENCES `sys_report` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


CREATE TABLE `sys_report_object_attr` (
  `id` varchar(128) NOT NULL,
  `report_object` varchar(64) NOT NULL,
  `ci_type_attr` varchar(128) NOT NULL,
  `data_name` varchar(64) NOT NULL,
  `data_title_name` varchar(64) NOT NULL,
  `querialbe` varchar(32) DEFAULT 'false',
  PRIMARY KEY (`id`),
  KEY `sys_report_object_attr_report_object_idx` (`report_object`),
  KEY `sys_report_object_attr_ci_type_attr_idx` (`ci_type_attr`),
  CONSTRAINT `sys_report_object_attr_ci_type_attr` FOREIGN KEY (`ci_type_attr`) REFERENCES `sys_ci_type_attr` (`id`),
  CONSTRAINT `sys_report_object_attr_report_object` FOREIGN KEY (`report_object`) REFERENCES `sys_report_object` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `sys_report_object_filter` (
  `id` varchar(128) NOT NULL,
  `filter_name` varchar(64) NOT NULL,
  `filter_ci_type` varchar(32) NOT NULL,
  `filter_rule` varchar(2096) NOT NULL,
  `sys_report_object` varchar(128) NOT NULL,
  `multiple` varchar(32) DEFAULT NULL,
  `filter_display_name` varchar(64) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `sys_report_object_filter_ci_type_idx` (`filter_ci_type`),
  KEY `sys_report_object_filter_report_object_idx` (`sys_report_object`),
  CONSTRAINT `sys_report_object_filter_ci_type` FOREIGN KEY (`filter_ci_type`) REFERENCES `sys_ci_type` (`id`),
  CONSTRAINT `sys_report_object_filter_report_object` FOREIGN KEY (`sys_report_object`) REFERENCES `sys_report_object` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `sys_role` (
  `id` varchar(32) NOT NULL COMMENT '名称主键',
  `description` varchar(255) DEFAULT NULL COMMENT '描述',
  `role_type` varchar(32) DEFAULT NULL COMMENT '角色类型',
  `is_system` varchar(8) DEFAULT 'no' COMMENT '是否系统角色',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

LOCK TABLES `sys_role` WRITE;
/*!40000 ALTER TABLE `sys_role` DISABLE KEYS */;
INSERT INTO `sys_role` (`id`, `description`, `role_type`, `is_system`) VALUES ('APP_ARC','应用架构师',NULL,'no');
INSERT INTO `sys_role` (`id`, `description`, `role_type`, `is_system`) VALUES ('APP_DEV','应用开发人员',NULL,'no');
INSERT INTO `sys_role` (`id`, `description`, `role_type`, `is_system`) VALUES ('CMDB_ADMIN','CMDB管理员',NULL,'no');
INSERT INTO `sys_role` (`id`, `description`, `role_type`, `is_system`) VALUES ('COBFIG_USER','配置管理员',NULL,'yes');
INSERT INTO `sys_role` (`id`, `description`, `role_type`, `is_system`) VALUES ('EDIT_USER','编辑用户',NULL,'yes');
INSERT INTO `sys_role` (`id`, `description`, `role_type`, `is_system`) VALUES ('IFA_ARC','基础架构师',NULL,'no');
INSERT INTO `sys_role` (`id`, `description`, `role_type`, `is_system`) VALUES ('IFA_OPS','基础架构运维人员',NULL,'no');
INSERT INTO `sys_role` (`id`, `description`, `role_type`, `is_system`) VALUES ('MONITOR_ADMIN','监控管理员',NULL,'no');
INSERT INTO `sys_role` (`id`, `description`, `role_type`, `is_system`) VALUES ('PRD_OPS','生产运维',NULL,'no');
INSERT INTO `sys_role` (`id`, `description`, `role_type`, `is_system`) VALUES ('QUERY_USER','查询用户',NULL,'yes');
INSERT INTO `sys_role` (`id`, `description`, `role_type`, `is_system`) VALUES ('STG_OPS','测试运维',NULL,'no');
INSERT INTO `sys_role` (`id`, `description`, `role_type`, `is_system`) VALUES ('SUB_SYSTEM','后台系统',NULL,'yes');
INSERT INTO `sys_role` (`id`, `description`, `role_type`, `is_system`) VALUES ('SUPER_ADMIN','超级管理员',NULL,'yes');
/*!40000 ALTER TABLE `sys_role` ENABLE KEYS */;
UNLOCK TABLES;

CREATE TABLE `sys_role_ci_type` (
  `guid` varchar(32) NOT NULL COMMENT '主键',
  `role_id` varchar(32) DEFAULT NULL COMMENT '角色guid',
  `ci_type` varchar(32) DEFAULT NULL COMMENT 'ci类型',
  `insert` varchar(4) DEFAULT 'N' COMMENT '创建权限',
  `delete` varchar(4) DEFAULT 'N' COMMENT '删除权限',
  `update` varchar(4) DEFAULT 'N' COMMENT '修改权限',
  `query` varchar(4) DEFAULT 'N' COMMENT '查询权限',
  `execute` varchar(4) DEFAULT 'N' COMMENT '授权权限',
  PRIMARY KEY (`guid`),
  KEY `sys_role_ci_type_ref_role` (`role_id`),
  KEY `sys_role_ci_type_ref_ci_type` (`ci_type`),
  CONSTRAINT `sys_role_ci_type_ref_ci_type` FOREIGN KEY (`ci_type`) REFERENCES `sys_ci_type` (`id`),
  CONSTRAINT `sys_role_ci_type_ref_role` FOREIGN KEY (`role_id`) REFERENCES `sys_role` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `sys_role_ci_type_condition` (
  `guid` varchar(32) NOT NULL COMMENT '随机主键',
  `role_ci_type` varchar(32) DEFAULT NULL COMMENT '所属角色ci关联',
  `insert` varchar(4) DEFAULT 'N' COMMENT '创建权限',
  `delete` varchar(4) DEFAULT 'N' COMMENT '删除权限',
  `update` varchar(4) DEFAULT 'N' COMMENT '修改权限',
  `query` varchar(4) DEFAULT 'N' COMMENT '查询权限',
  `execute` varchar(4) DEFAULT 'N' COMMENT '授权权限',
  PRIMARY KEY (`guid`),
  KEY `sys_role_ci_type_attr_owner` (`role_ci_type`),
  CONSTRAINT `sys_role_ci_type_attr_owner` FOREIGN KEY (`role_ci_type`) REFERENCES `sys_role_ci_type` (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `sys_role_ci_type_condition_filter` (
  `guid` varchar(32) NOT NULL COMMENT '随机主键',
  `role_ci_type_condition` varchar(32) DEFAULT NULL COMMENT '所属ci属性关联',
  `ci_type_attr` varchar(64) DEFAULT NULL COMMENT 'ci属性(条件对象)',
  `ci_type_attr_name` varchar(64) DEFAULT NULL COMMENT 'ci属性显示名',
  `expression` varchar(500) DEFAULT NULL COMMENT '条件表达式',
  PRIMARY KEY (`guid`),
  KEY `sys_role_ci_type_cond_owner` (`role_ci_type_condition`),
  KEY `sys_role_ci_type_cond_attr_idx` (`ci_type_attr`),
  CONSTRAINT `sys_role_ci_type_cond_attr` FOREIGN KEY (`ci_type_attr`) REFERENCES `sys_ci_type_attr` (`id`),
  CONSTRAINT `sys_role_ci_type_cond_owner` FOREIGN KEY (`role_ci_type_condition`) REFERENCES `sys_role_ci_type_condition` (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `sys_role_ci_type_list` (
  `guid` varchar(32) NOT NULL,
  `role_ci_type` varchar(32) NOT NULL,
  `list` text,
  `insert` varchar(4) DEFAULT 'N',
  `delete` varchar(4) DEFAULT 'N',
  `update` varchar(4) DEFAULT 'N',
  `query` varchar(4) DEFAULT 'N',
  `execute` varchar(4) DEFAULT 'N',
  PRIMARY KEY (`guid`),
  KEY `sys_role_ci_type_list_role_ci_type_idx` (`role_ci_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `sys_role_menu` (
  `id` varchar(128) NOT NULL COMMENT '主键',
  `role_guid` varchar(32) DEFAULT NULL COMMENT '角色guid',
  `menu_guid` varchar(32) DEFAULT NULL COMMENT '菜单guid',
  PRIMARY KEY (`id`),
  KEY `sys_role_menu_ref_role` (`role_guid`),
  KEY `sys_role_menu_ref_menu` (`menu_guid`),
  CONSTRAINT `sys_role_menu_ref_menu` FOREIGN KEY (`menu_guid`) REFERENCES `sys_menu` (`id`),
  CONSTRAINT `sys_role_menu_ref_role` FOREIGN KEY (`role_guid`) REFERENCES `sys_role` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


LOCK TABLES `sys_role_menu` WRITE;
/*!40000 ALTER TABLE `sys_role_menu` DISABLE KEYS */;
INSERT INTO `sys_role_menu` (`id`, `role_guid`, `menu_guid`) VALUES ('SUPER_ADMIN__system','SUPER_ADMIN','system');
INSERT INTO `sys_role_menu` (`id`, `role_guid`, `menu_guid`) VALUES ('SUPER_ADMIN__system_authority','SUPER_ADMIN','system_authority');
/*!40000 ALTER TABLE `sys_role_menu` ENABLE KEYS */;
UNLOCK TABLES;

CREATE TABLE `sys_role_report` (
  `id` varchar(128) NOT NULL,
  `role` varchar(32) NOT NULL,
  `report` varchar(32) NOT NULL,
  `permission` varchar(32) NOT NULL COMMENT 'USE,MGMT',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `sys_role_user` (
  `id` varchar(128) NOT NULL COMMENT '主键',
  `role_id` varchar(32) DEFAULT NULL COMMENT '角色guid',
  `user_id` varchar(32) DEFAULT NULL COMMENT '用户guid',
  PRIMARY KEY (`id`),
  KEY `sys_role_user_ref_role` (`role_id`),
  KEY `sys_role_user_ref_user` (`user_id`),
  CONSTRAINT `sys_role_user_ref_role` FOREIGN KEY (`role_id`) REFERENCES `sys_role` (`id`),
  CONSTRAINT `sys_role_user_ref_user` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

LOCK TABLES `sys_role_user` WRITE;
/*!40000 ALTER TABLE `sys_role_user` DISABLE KEYS */;
INSERT INTO `sys_role_user` (`id`, `role_id`, `user_id`) VALUES ('SUPER_ADMIN___super_admin','SUPER_ADMIN','super_admin');
/*!40000 ALTER TABLE `sys_role_user` ENABLE KEYS */;
UNLOCK TABLES;

CREATE TABLE `sys_role_view` (
  `id` varchar(128) NOT NULL,
  `role` varchar(32) NOT NULL,
  `view` varchar(32) NOT NULL,
  `permission` varchar(32) NOT NULL COMMENT 'USE,MGMT',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `sys_state` (
  `id` varchar(32) NOT NULL COMMENT '主键',
  `name` varchar(255) NOT NULL COMMENT '名称',
  `description` varchar(255) DEFAULT NULL COMMENT '描述',
  `state_machine` varchar(32) DEFAULT NULL COMMENT '外键关联状态机',
  `unique_path_trigger` varchar(8) DEFAULT 'no' COMMENT '唯一路径触发',
  `is_confirm` varchar(8) DEFAULT 'no' COMMENT '是否是确认状态',
  PRIMARY KEY (`id`),
  KEY `sys_state_machine` (`state_machine`),
  CONSTRAINT `sys_state_machine` FOREIGN KEY (`state_machine`) REFERENCES `sys_state_machine` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


LOCK TABLES `sys_state` WRITE;
/*!40000 ALTER TABLE `sys_state` DISABLE KEYS */;
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('create_destroy__changed_0','changed_0',NULL,'create_destroy','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('create_destroy__changed_1','changed_1',NULL,'create_destroy','no','yes');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('create_destroy__created_0','created_0',NULL,'create_destroy','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('create_destroy__created_1','created_1',NULL,'create_destroy','no','yes');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('create_destroy__destroyed_0','destroyed_0',NULL,'create_destroy','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('create_destroy__destroyed_1','destroyed_1',NULL,'create_destroy','yes','yes');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('create_destroy__null_0','null_0','初始空','create_destroy','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('create_destroy__null_1','null_1','终止空','create_destroy','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('design__added_0','added_0',NULL,'design','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('design__added_1','added_1',NULL,'design','no','yes');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('design__deleted_0','deleted_0',NULL,'design','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('design__deleted_1','deleted_1',NULL,'design','yes','yes');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('design__null_0','null_0','初始空','design','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('design__null_1','null_1','终止空','design','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('design__updated_0','updated_0',NULL,'design','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('design__updated_1','updated_1',NULL,'design','no','yes');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('start_stop__changed_0','changed_0',NULL,'start_stop','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('start_stop__changed_1','changed_1',NULL,'start_stop','no','yes');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('start_stop__created_0','created_0',NULL,'start_stop','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('start_stop__created_1','created_1',NULL,'start_stop','no','yes');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('start_stop__destroyed_0','destroyed_0',NULL,'start_stop','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('start_stop__destroyed_1','destroyed_1',NULL,'start_stop','yes','yes');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('start_stop__null_0','null_0','初始空','start_stop','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('start_stop__null_1','null_1','终止空','start_stop','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('start_stop__started_0','started_0',NULL,'start_stop','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('start_stop__started_1','started_1',NULL,'start_stop','no','yes');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('start_stop__stoped_0','stoped_0',NULL,'start_stop','no','no');
INSERT INTO `sys_state` (`id`, `name`, `description`, `state_machine`, `unique_path_trigger`, `is_confirm`) VALUES ('start_stop__stoped_1','stoped_1',NULL,'start_stop','no','yes');
/*!40000 ALTER TABLE `sys_state` ENABLE KEYS */;
UNLOCK TABLES;

CREATE TABLE `sys_state_machine` (
  `id` varchar(32) NOT NULL COMMENT '名称主键',
  `description` varchar(255) DEFAULT NULL COMMENT '描述',
  `start_state` varchar(32) DEFAULT NULL COMMENT '开始状态',
  `final_state` varchar(32) DEFAULT NULL COMMENT '终止状态',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


LOCK TABLES `sys_state_machine` WRITE;
/*!40000 ALTER TABLE `sys_state_machine` DISABLE KEYS */;
INSERT INTO `sys_state_machine` (`id`, `description`, `start_state`, `final_state`) VALUES ('create_destroy','创销类状态机','create_destroy__null_0','create_destroy__null_1');
INSERT INTO `sys_state_machine` (`id`, `description`, `start_state`, `final_state`) VALUES ('design','设计类状态机','design__null_0','design__null_1');
INSERT INTO `sys_state_machine` (`id`, `description`, `start_state`, `final_state`) VALUES ('start_stop','启停类状态机','start_stop__null_0','start__stop_null_1');
/*!40000 ALTER TABLE `sys_state_machine` ENABLE KEYS */;
UNLOCK TABLES;

CREATE TABLE `sys_state_transition` (
  `guid` varchar(64) NOT NULL COMMENT '唯一主键',
  `state_machine` varchar(32) DEFAULT NULL COMMENT '所属状态机',
  `current_state` varchar(32) DEFAULT NULL COMMENT '当前状态',
  `target_state` varchar(32) DEFAULT NULL COMMENT '目标状态',
  `operation` varchar(64) DEFAULT NULL COMMENT '前端操作',
  `operation_en` varchar(45) DEFAULT NULL,
  `permission` varchar(32) DEFAULT NULL,
  `action` varchar(64) DEFAULT NULL COMMENT '后端处理',
  `operation_form_type` varchar(32) DEFAULT 'edit' COMMENT '前端表单操作类型',
  `operation_multiple` varchar(32) DEFAULT 'yes',
  PRIMARY KEY (`guid`),
  KEY `sys_transition_machine` (`state_machine`),
  KEY `sys_transition_current` (`current_state`),
  KEY `sys_transition_target` (`target_state`),
  CONSTRAINT `sys_transition_current` FOREIGN KEY (`current_state`) REFERENCES `sys_state` (`id`),
  CONSTRAINT `sys_transition_machine` FOREIGN KEY (`state_machine`) REFERENCES `sys_state_machine` (`id`),
  CONSTRAINT `sys_transition_target` FOREIGN KEY (`target_state`) REFERENCES `sys_state` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

LOCK TABLES `sys_state_transition` WRITE;
/*!40000 ALTER TABLE `sys_state_transition` DISABLE KEYS */;
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-029ebea8','design','design__null_0','design__added_0','添加','Add','insert','insert','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-04b5b578','design','design__added_0','design__null_0','删除','Delete','delete','delete','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-06081023','design','design__added_0','design__added_0','更新','Update','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-0cd93755','design','design__added_0','design__added_0','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-179d8572','design','design__added_0','design__added_1','确认','Confirm','update','confirm','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-19a80b6c','design','design__added_1','design__updated_0','更新','Update','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-1b946b07','design','design__updated_0','design__added_1','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-1da593d3','design','design__updated_0','design__updated_0','更新','Update','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-22704a96','design','design__updated_0','design__updated_1','确认','Confirm','update','confirm','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-2402c9ca','design','design__updated_0','design__updated_1','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-24aebc5f','design','design__updated_1','design__updated_0','更新','Update','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-2bb81d80','design','design__updated_0','design__updated_0','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-300d167b','design','design__added_1','design__deleted_0','删除','Delete','delete','update','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-33627426','design','design__deleted_0','design__added_1','回退','Rollback','delete','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-36aa4863','design','design__updated_1','design__deleted_0','删除','Delete','delete','update','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-381a7050','design','design__deleted_0','design__updated_1','回退','Rollback','delete','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-387b3304','design','design__deleted_0','design__deleted_1','确认','Confirm','delete','confirm','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-3c832526','design','design__deleted_1','design__null_1','删除','Delete','delete','delete','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-3c832ytj','design','design__added_1','design__added_1','确认','Confirm','insert','confirm','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-3c8jugv6','design','design__updated_1','design__updated_1','确认','Confirm','update','confirm','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-3e31b129','create_destroy','create_destroy__null_0','create_destroy__created_0','新增','Add','insert','insert','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-3f7ae442','create_destroy','create_destroy__created_0','create_destroy__null_0','删除','Delete','delete','delete','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-41db2c39','create_destroy','create_destroy__created_0','create_destroy__created_0','变更','Change','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-420e8bcd','create_destroy','create_destroy__created_0','create_destroy__created_0','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-441b1c06','create_destroy','create_destroy__created_0','create_destroy__created_1','确认','Confirm','update','confirm','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-4c07adc1','create_destroy','create_destroy__created_1','create_destroy__changed_0','变更','Change','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-52dc02cc','create_destroy','create_destroy__changed_0','create_destroy__created_1','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-5e297171','create_destroy','create_destroy__changed_0','create_destroy__changed_0','变更','Change','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-5e7732a3','create_destroy','create_destroy__changed_0','create_destroy__changed_1','确认','Confirm','update','confirm','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-5fe97859','create_destroy','create_destroy__changed_0','create_destroy__changed_1','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-6683f94c','create_destroy','create_destroy__changed_1','create_destroy__changed_0','变更','Change','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-6db35ef2','create_destroy','create_destroy__changed_0','create_destroy__changed_0','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-74b8c816','create_destroy','create_destroy__created_1','create_destroy__destroyed_0','销毁','Destroy','delete','update','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-767d331a','create_destroy','create_destroy__destroyed_0','create_destroy__created_1','回退','Rollback','delete','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-782009f0','create_destroy','create_destroy__changed_1','create_destroy__destroyed_0','销毁','Destroy','delete','update','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-7b5f63ff','create_destroy','create_destroy__destroyed_0','create_destroy__changed_1','回退','Rollback','delete','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-7d0813fa','create_destroy','create_destroy__destroyed_0','create_destroy__destroyed_1','确认','Confirm','delete','confirm','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-7d1e59d6','create_destroy','create_destroy__destroyed_1','create_destroy__null_1','删除','delete','delete','delete','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-7f423166','start_stop','start_stop__null_0','start_stop__created_0','新增','Add','insert','insert','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-86c4431e','start_stop','start_stop__created_0','start_stop__null_0','删除','Delete','insert','delete','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-86c4db3e','start_stop','start_stop__created_0','start_stop__created_0','变更','Change','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-8a0db99f','start_stop','start_stop__created_0','start_stop__created_0','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-8df7f247','start_stop','start_stop__created_0','start_stop__created_1','确认','Confirm','update','confirm','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-8eda60cd','start_stop','start_stop__created_1','start_stop__changed_0','变更','Change','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-9237efd8','start_stop','start_stop__changed_0','start_stop__created_1','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-92a5e691','start_stop','start_stop__changed_0','start_stop__changed_0','变更','Change','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-92c068b0','start_stop','start_stop__changed_0','start_stop__changed_1','确认','Confirm','update','confirm','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-942508b3','start_stop','start_stop__changed_0','start_stop__changed_1','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-94ccffe7','start_stop','start_stop__changed_1','start_stop__changed_0','变更','Change','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-980f9730','start_stop','start_stop__changed_0','start_stop__changed_0','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-984618c2','start_stop','start_stop__created_1','start_stop__started_0','启动','start','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-9a31e964','start_stop','start_stop__started_0','start_stop__created_1','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-9a6fc0e6','start_stop','start_stop__created_1','start_stop__stoped_0','停止','stop','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-9c9bd4d2','start_stop','start_stop__stoped_0','start_stop__created_1','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-9e23239a','start_stop','start_stop__changed_1','start_stop__started_0','启动','start','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-9ec54e2b','start_stop','start_stop__started_0','start_stop__changed_1','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-9f9c3743','start_stop','start_stop__changed_1','start_stop__stoped_0','停止','stop','update','update','editable_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-9fc08a90','start_stop','start_stop__stoped_0','start_stop__changed_1','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-a1ad3f70','start_stop','start_stop__started_0','start_stop__started_1','确认','Confirm','update','confirm','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-a1dd71c2','start_stop','start_stop__stoped_0','start_stop__stoped_1','确认','Confirm','update','confirm','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-a30d2917','start_stop','start_stop__started_0','start_stop__stoped_1','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-a374c7d8','start_stop','start_stop__stoped_0','start_stop__started_1','回退','Rollback','update','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-a3ccdb94','start_stop','start_stop__stoped_1','start_stop__destroyed_0','销毁','Destroy','delete','update','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-a474f20b','start_stop','start_stop__destroyed_0','start_stop__stoped_1','回退','Rollback','delete','update','select_form','no');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-a602802a','start_stop','start_stop__destroyed_0','start_stop__destroyed_1','确认','Confirm','delete','confirm','confirm_form','yes');
INSERT INTO `sys_state_transition` (`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) VALUES ('609a4bdf-adb84587','start_stop','start_stop__destroyed_1','start_stop__null_1','删除','delete','delete','delete','confirm_form','yes');
/*!40000 ALTER TABLE `sys_state_transition` ENABLE KEYS */;
UNLOCK TABLES;

CREATE TABLE `sys_user` (
  `id` varchar(32) NOT NULL COMMENT '主键',
  `display_name` varchar(64) DEFAULT NULL COMMENT '显示名',
  `encrypted_password` varchar(255) DEFAULT NULL COMMENT '加密密钥',
  `description` varchar(255) DEFAULT NULL COMMENT '描述',
  `is_system` varchar(8) DEFAULT 'no' COMMENT '是否系统用户',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

LOCK TABLES `sys_user` WRITE;
/*!40000 ALTER TABLE `sys_user` DISABLE KEYS */;
INSERT INTO `sys_user` (`id`, `display_name`, `encrypted_password`, `description`, `is_system`) VALUES ('super_admin','超级管理员','0f7c4c2c7b619959be930b1cf0a18bd2',NULL,'yes');
/*!40000 ALTER TABLE `sys_user` ENABLE KEYS */;
UNLOCK TABLES;

CREATE TABLE `sys_view` (
  `id` varchar(32) NOT NULL,
  `name` varchar(64) NOT NULL,
  `report` varchar(32) NOT NULL,
  `editable` varchar(32) DEFAULT NULL,
  `suport_version` varchar(32) DEFAULT NULL,
  `multiple` varchar(32) DEFAULT NULL,
  `create_time` datetime DEFAULT NULL,
  `create_user` varchar(32) DEFAULT NULL,
  `update_time` datetime DEFAULT NULL,
  `update_user` varchar(32) DEFAULT NULL,
  `filter_attr` varchar(64) DEFAULT NULL,
  `filter_value` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sys_view_report_idx` (`report`),
  KEY `sys_view_filter_attr_idx` (`filter_attr`),
  CONSTRAINT `sys_view_filter_attr` FOREIGN KEY (`filter_attr`) REFERENCES `sys_ci_type_attr` (`id`),
  CONSTRAINT `sys_view_report` FOREIGN KEY (`report`) REFERENCES `sys_report` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `sys_wecube_process` (
  `guid` varchar(32) NOT NULL COMMENT '随机主键',
  `ci_data_guid` varchar(64) DEFAULT NULL COMMENT '数据行id',
  `wecube_proc_instance_tmp` varchar(64) DEFAULT NULL COMMENT '临时流程号',
  `wecube_proc_instance` varchar(64) DEFAULT NULL COMMENT '实例流程号',
  `wecube_proc_define` varchar(64) DEFAULT NULL COMMENT '流程选择',
  `status` varchar(64) DEFAULT 'start' COMMENT '状态',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


SET FOREIGN_KEY_CHECKS=1;

#@v2.0.2.1-begin@;
insert into sys_state_transition(`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) value ('609a4bdf-420e8bde','create_destroy','create_destroy__created_0','create_destroy__created_0','执行','Execute','execute','execute','select_form','no');
insert into sys_state_transition(`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) value ('609a4bdf-5e297272','create_destroy','create_destroy__changed_0','create_destroy__changed_0','执行','Execute','execute','execute','select_form','no');
insert into sys_state_transition(`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) value ('609a4bdf-86c4db4e','start_stop','start_stop__created_0','start_stop__created_0','执行','Execute','execute','execute','select_form','no');
insert into sys_state_transition(`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) value ('609a4bdf-92a5e791','start_stop','start_stop__changed_0','start_stop__changed_0','执行','Execute','execute','execute','select_form','no');
insert into sys_state_transition(`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) value ('609a4bdf-9ec54e3b','start_stop','start_stop__started_0','start_stop__started_0','执行','Execute','execute','execute','select_form','no');
insert into sys_state_transition(`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) value ('609a4bdf-a374c8d8','start_stop','start_stop__stoped_0','start_stop__stoped_0','执行','Execute','execute','execute','select_form','no');
insert into sys_state_transition(`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) value ('611f56a80c232a5a','start_stop','start_stop__destroyed_0','start_stop__destroyed_0','执行','Execute','execute','execute','select_form','no');

insert into sys_state_transition(`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) value ('611f4650b3dc0bbc','start_stop','start_stop__started_1','start_stop__stoped_0','停止','stop','update','update','editable_form','yes');
insert into sys_state_transition(`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) value ('611f4699133f2da3','start_stop','start_stop__started_1','start_stop__changed_0','变更','Change','update','update','editable_form','yes');
insert into sys_state_transition(`guid`, `state_machine`, `current_state`, `target_state`, `operation`, `operation_en`, `permission`, `action`, `operation_form_type`, `operation_multiple`) value ('611f46f1ffcc11f5','start_stop','start_stop__changed_0','start_stop__started_1','回退','Rollback','update','update','select_form','no');
#@v2.0.2.1-end@;

#@v2.0.3-begin@;
alter table sys_log add column response longtext;
#@v2.0.3-end@;

#@v2.0.6.1-begin@;
alter table sys_graph_element add column order_data varchar(128) default '';
alter table sys_graph_element add column update_operation varchar(64) default '';
#@v2.0.6.1-end@;

#@v2.0.9.12-begin@;
alter table sys_role_ci_type_condition_filter add column filter_type varchar(32) default 'expression';
alter table sys_role_ci_type_condition_filter add column select_list varchar(500) default null;
#@v2.0.9.12-end@;

#@v2.0.9.24-begin@;
CREATE TABLE `sys_ci_import_guid_map` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `source` varchar(64) DEFAULT NULL COMMENT '原纪录id',
  `target` varchar(64) DEFAULT NULL COMMENT '目标纪录id',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
alter table sys_basekey_code modify column `id` varchar(128) NOT NULL COMMENT '主键';
#@v2.0.9.24-end@;

#@v2.0.26.1-begin@;
alter table sys_graph add column graph_node_config varchar(1024) default null;
alter table sys_graph add column graph_edge_config varchar(1024) default null;
alter table sys_ci_type_attr add column ext_ref_entity varchar(255) default null;
alter table sys_role_ci_type add column `confirm` varchar(4) default 'N';
alter table sys_role_ci_type_condition add column `confirm` varchar(4) default 'N';
alter table sys_role_ci_type_list add column `confirm` varchar(4) default 'N';
alter table sys_ci_type_attr add column confirm_nullable varchar(16) default 'yes';
alter table sys_ci_template_attr add column ext_ref_entity varchar(255) default null;
alter table sys_ci_template_attr add column confirm_nullable varchar(16) default 'yes';
#@v2.0.26.1-end@;

#@v2.0.26.2-begin@;
ALTER TABLE `sys_ci_template_attr`
DROP FOREIGN KEY `sys_ci_template_attr_ref_type`;


ALTER TABLE `sys_ci_type`
DROP FOREIGN KEY `sys_ci_type_group`,
DROP FOREIGN KEY `sys_ci_type_layer`;

ALTER TABLE `sys_ci_type_attr`
DROP FOREIGN KEY `sys_ci_type_attr_ref_type`;



ALTER TABLE `sys_basekey_code`
    CHANGE COLUMN `id` `id` VARCHAR(128) NOT NULL COMMENT '主键' ;


ALTER TABLE `sys_ci_template_attr`
    CHANGE COLUMN `ref_type` `ref_type` VARCHAR(128) NULL DEFAULT NULL COMMENT '关联类型' ;
ALTER TABLE `sys_ci_template_attr`
    ADD CONSTRAINT `sys_ci_template_attr_ref_type`
        FOREIGN KEY (`ref_type`)
            REFERENCES `sys_basekey_code` (`id`);

ALTER TABLE `sys_ci_type_attr`
    CHANGE COLUMN `ref_type` `ref_type` VARCHAR(128) NULL DEFAULT NULL COMMENT '关联类型' ;
ALTER TABLE `sys_ci_type_attr`
    ADD CONSTRAINT `sys_ci_type_attr_ref_type`
        FOREIGN KEY (`ref_type`)
            REFERENCES `sys_basekey_code` (`id`);

ALTER TABLE `sys_ci_type`
    CHANGE COLUMN `ci_group` `ci_group` VARCHAR(128) NOT NULL COMMENT '所属图层' ,
    CHANGE COLUMN `ci_layer` `ci_layer` VARCHAR(128) NOT NULL COMMENT '图层层级' ;
ALTER TABLE `sys_ci_type`
    ADD CONSTRAINT `sys_ci_type_group`
        FOREIGN KEY (`ci_group`)
            REFERENCES `sys_basekey_code` (`id`),
ADD CONSTRAINT `sys_ci_type_layer`
  FOREIGN KEY (`ci_layer`)
  REFERENCES `sys_basekey_code` (`id`);


ALTER TABLE `sys_graph_element`
    CHANGE COLUMN `graph_configs` `graph_configs` TEXT NULL DEFAULT NULL ;
ALTER TABLE `sys_graph_element`
    CHANGE COLUMN `graph_config_data` `graph_config_data` VARCHAR(255) NULL DEFAULT NULL ;
ALTER TABLE `sys_graph_element`
    CHANGE COLUMN `graph_shapes` `graph_shapes` VARCHAR(1024) NULL DEFAULT NULL ;
#@v2.0.26.2-end@;

#@v2.0.26.3-begin@;
CREATE TABLE `sys_report_import_history` (
                                             `guid` varchar(64) NOT NULL COMMENT '导入guid',
                                             `report` varchar(64) NOT NULL COMMENT '关联报告',
                                             `root_ci_type` varchar(32) NOT NULL COMMENT '根关联ci',
                                             `key_names` varchar(512) NOT NULL COMMENT '数据名称',
                                             `total_count` int(10) DEFAULT 0 COMMENT '导入数据条数',
                                             `status` varchar(20) NOT NULL COMMENT '状态',
                                             `confirm_time` datetime NULL COMMENT '确认时间',
                                             `create_user` varchar(32) NOT NULL COMMENT '创建人',
                                             `create_time` datetime NOT NULL COMMENT '创建时间',
                                             `update_user` varchar(32) NOT NULL COMMENT '更新人',
                                             `update_time` datetime NOT NULL COMMENT '更新时间',
                                             PRIMARY KEY (`guid`),
                                             KEY `sys_report_attr_report_idx` (`report`),
                                             KEY `sys_ci_type_attr_root_ci_type_idx` (`root_ci_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

alter table `sys_ci_import_guid_map` add column `report_import_guid` varchar(64) null default null COMMENT '报告导入guid';
alter table `sys_ci_import_guid_map` add column `ci_type` varchar(32) null default null COMMENT '关联ci';
alter table `sys_ci_import_guid_map` add column `is_unique` int(1) null default 1 COMMENT '是否唯一';
alter table `sys_ci_import_guid_map` add column `is_not_empty` int(1) null default 1 COMMENT '是否不为空';
#@v2.0.26.3-end@;

#@v2.0.27.2-begin@;
INSERT INTO sys_menu (id,display_name,url,seq_no,parent,is_active) values ('data_management_import','数据管理(导入)',NULL,3,'data_mgmt','yes');
#@v2.0.27.2-end@;

#@v2.1.0.2-begin@;
alter table sys_ci_template_attr add column `sensitive` varchar(16) default 'no' comment '是否敏感';
alter table sys_ci_type_attr add column `sensitive` varchar(16) default 'no' comment '是否敏感';
alter table sys_role_ci_type_condition_filter modify column ci_type_attr varchar(128) DEFAULT NULL COMMENT 'ci属性(条件对象)';
alter table sys_role_ci_type add column ci_type_attr varchar(128) default null comment '敏感属性';
#@v2.1.0.2-end@;

#@v2.1.0.3-begin@;
alter table sys_report add column `used_by_view` varchar(16) default 'yes' comment '能被视图使用,枚举值 yes|no';
alter table sys_report add column `used_by_export` varchar(16) default 'yes' comment '能被导出,枚举值 yes|no';
#@v2.1.0.3-end@;

#@v2.2.0.1-begin@;
CREATE TABLE `sys_permission_tpl` (
       `id` varchar(32) NOT NULL COMMENT '随机主键',
       `name` varchar(255) DEFAULT NULL COMMENT '模版名称',
       `create_user` varchar(64) DEFAULT NULL COMMENT '创建人',
       `create_time` datetime DEFAULT NULL COMMENT '创建时间',
       `update_user` varchar(64) DEFAULT NULL COMMENT '更新人',
       `update_time` datetime DEFAULT NULL COMMENT '更新时间',
       PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `sys_role_tpl_permission` (
        `id` varchar(64) NOT NULL COMMENT '主键',
        `role_id` varchar(32) NOT NULL COMMENT '角色',
        `permission_tpl` varchar(32) NOT NULL COMMENT 'ci权限模版id',
        `param_config` text DEFAULT NULL COMMENT '参数配置',
        PRIMARY KEY (`id`),
        CONSTRAINT `ref_role_tpl_permission` FOREIGN KEY (`permission_tpl`) REFERENCES `sys_permission_tpl` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `sys_permission_ci_tpl` (
          `guid` varchar(32) NOT NULL COMMENT '随机主键',
          `permission_tpl` varchar(32) NOT NULL COMMENT '权限模版',
          `ci_type` varchar(32) NOT NULL COMMENT '关联ci',
          `insert` varchar(4) DEFAULT 'N' COMMENT '创建权限',
          `delete` varchar(4) DEFAULT 'N' COMMENT '删除权限',
          `update` varchar(4) DEFAULT 'N' COMMENT '修改权限',
          `query` varchar(4) DEFAULT 'N' COMMENT '查询权限',
          `execute` varchar(4) DEFAULT 'N' COMMENT '执行权限',
          `confirm` varchar(4) DEFAULT 'N' COMMENT '确认权限',
          `ci_type_attr` varchar(128) DEFAULT NULL COMMENT '敏感属性',
          PRIMARY KEY (`guid`),
          CONSTRAINT `ref_permission_ci_tpl` FOREIGN KEY (`permission_tpl`) REFERENCES `sys_permission_tpl` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `sys_permission_condition_tpl` (
        `guid` varchar(32) NOT NULL COMMENT '随机主键',
        `permission_ci_tpl` varchar(32) NOT NULL COMMENT 'ci权限模版',
        `insert` varchar(4) DEFAULT 'N' COMMENT '创建权限',
        `delete` varchar(4) DEFAULT 'N' COMMENT '删除权限',
        `update` varchar(4) DEFAULT 'N' COMMENT '修改权限',
        `query` varchar(4) DEFAULT 'N' COMMENT '查询权限',
        `execute` varchar(4) DEFAULT 'N' COMMENT '授权权限',
        `confirm` varchar(4) DEFAULT 'N' COMMENT '确认权限',
        PRIMARY KEY (`guid`),
        CONSTRAINT `ref_permission_condition_ci` FOREIGN KEY (`permission_ci_tpl`) REFERENCES `sys_permission_ci_tpl` (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


CREATE TABLE `sys_permission_condition_filter_tpl` (
       `guid` varchar(96) NOT NULL COMMENT '组合主键(condition+attr)',
       `permission_condition_tpl` varchar(32) NOT NULL COMMENT '所属ci属性关联',
       `ci_type_attr` varchar(128) NOT NULL COMMENT 'ci属性(条件对象)',
       `ci_type_attr_name` varchar(64) DEFAULT NULL COMMENT 'ci属性显示名',
       `expression` varchar(500) DEFAULT NULL COMMENT '条件表达式',
       `filter_type` varchar(32) DEFAULT 'expression',
       `select_list` varchar(500) DEFAULT NULL,
       `param_list` text DEFAULT NULL,
       PRIMARY KEY (`guid`),
       CONSTRAINT `ref_permission_cond_attr` FOREIGN KEY (`ci_type_attr`) REFERENCES `sys_ci_type_attr` (`id`),
       CONSTRAINT `ref_permission_cond_owner` FOREIGN KEY (`permission_condition_tpl`) REFERENCES `sys_permission_condition_tpl` (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `sys_permission_list_tpl` (
       `guid` varchar(32) NOT NULL,
       `permission_ci_tpl` varchar(32) NOT NULL COMMENT 'ci权限模版',
       `list` text,
       `insert` varchar(4) DEFAULT 'N',
       `delete` varchar(4) DEFAULT 'N',
       `update` varchar(4) DEFAULT 'N',
       `query` varchar(4) DEFAULT 'N',
       `execute` varchar(4) DEFAULT 'N',
       `confirm` varchar(4) DEFAULT 'N',
       PRIMARY KEY (`guid`),
       CONSTRAINT `ref_permission_list_ci` FOREIGN KEY (`permission_ci_tpl`) REFERENCES `sys_permission_ci_tpl` (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
#@v2.2.0.1-end@;

#@v2.3.1.7-begin@;
alter table sys_ci_type add column `sync_enable` varchar(8) default 'no' comment '是否同步,yes/no';

CREATE TABLE `sys_sync_record` (
    `id` VARCHAR(64) PRIMARY KEY COMMENT '记录主键',
    `sync_type` VARCHAR(32) NOT NULL COMMENT '推送/接收',
    `remote_repo` TEXT DEFAULT NULL COMMENT '远程仓库信息',
    `action_func` VARCHAR(64) NOT NULL COMMENT '函数行为',
    `data_category` VARCHAR(64) DEFAULT NULL COMMENT '数据类别',
    `data_type` VARCHAR(128) DEFAULT NULL COMMENT '数据类型',
    `content` TEXT DEFAULT NULL COMMENT '内容',
    `source` VARCHAR(64) DEFAULT NULL COMMENT '来源ip',
    `source_id` VARCHAR(128) DEFAULT NULL COMMENT '原记录id',
    `target` VARCHAR(255) DEFAULT NULL COMMENT '目标ip列表',
    `status` VARCHAR(32) NOT NULL COMMENT '状态: ok/fail/wait',
    `retry_count` INT(11) DEFAULT 0 COMMENT '重试次数',
    `error_msg` TEXT DEFAULT NULL COMMENT '错误信息',
    `create_time` DATETIME DEFAULT NULL COMMENT '开始时间',
    `update_time` DATETIME DEFAULT NULL COMMENT '结束时间',
    `operator` VARCHAR(64) DEFAULT NULL COMMENT '操作人'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `sys_sync_data` (
    `id` int unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT COMMENT '自增主键',
    `sync_record` VARCHAR(64) DEFAULT NULL COMMENT '同步纪录',
    `data_id` VARCHAR(64) NOT NULL COMMENT '数据guid',
    `data_content` TEXT DEFAULT NULL COMMENT '数据json',
    `action` VARCHAR(32) DEFAULT NULL COMMENT '数据行为',
    `operation` VARCHAR(32) DEFAULT NULL COMMENT '操作行为',
    `handle_time` DATETIME DEFAULT NULL COMMENT '处理时间',
    `status` VARCHAR(32) NOT NULL COMMENT '状态: ok/fail/wait',
    `retry_count` INT DEFAULT 0 COMMENT '重试次数',
    `error_msg` TEXT DEFAULT NULL COMMENT '错误信息',
    `create_time` DATETIME DEFAULT NULL COMMENT '开始时间',
    `update_time` DATETIME DEFAULT NULL COMMENT '结束时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
#@v2.3.1.7-end@;