-- MySQL Script generated by MySQL Workbench
-- Wed May  8 14:34:45 2019
-- Model: New Model    Version: 1.0
-- MySQL Workbench Forward Engineering

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

-- -----------------------------------------------------
-- Schema aroad
-- -----------------------------------------------------

-- -----------------------------------------------------
-- Schema aroad
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `aroad` DEFAULT CHARACTER SET utf8 ;
USE `aroad` ;

-- -----------------------------------------------------
-- Table `aroad`.`emergency_event`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `aroad`.`emergency_event` ;

CREATE TABLE IF NOT EXISTS `aroad`.`emergency_event`
(
    `event_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '事件id',
    `event_name` varchar(45) NOT NULL COMMENT '事件名称',
    `event_type` varchar(10) NOT NULL COMMENT '事件类型',
    `event_detail` varchar(225) NOT NULL COMMENT '事件详情',
    `influence` varchar(10) NOT NULL COMMENT '受影响程度',
    `road` varchar(45) NOT NULL COMMENT '道路',
    `station_number` varchar(20) NOT NULL COMMENT '桩号',
    `reporting_dept` varchar(45) NOT NULL COMMENT '上报单位',
    `reporting_dept_id` int(11) NOT NULL COMMENT '上报单位id',
    `reporter_id` int(11) NOT NULL COMMENT '上报人id',
    `reporting_time` datetime NOT NULL COMMENT '上报时间',
    `status` varchar(10) NOT NULL DEFAULT '未处理' COMMENT '状态',
    `file_name` varchar(100) DEFAULT NULL COMMENT '评估总结文件名称',
    `file_url` varchar(100) DEFAULT NULL COMMENT '评估总结文件url',
    `is_file` bit(1) DEFAULT b'0' COMMENT '是否归档 0否1是',
    PRIMARY KEY (`event_id`)
)ENGINE = InnoDB
DEFAULT CHARSET=utf8 COMMENT = '应急事件表';

-- -----------------------------------------------------
-- Table `aroad`.`event_deal`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `aroad`.`event_deal` ;

CREATE TABLE IF NOT EXISTS `aroad`.`event_deal` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `event_id` varchar(45) NOT NULL COMMENT '事件id',
  `deal_content` varchar(225) NOT NULL COMMENT '处置内容',
  `deal_type` int(11) NOT NULL COMMENT '处置类型： 0：下达指令 1：处置反馈 2:事件上报',
  `deal_time` datetime NOT NULL COMMENT '处置时间',
  `user_id` int(11) NOT NULL COMMENT '处置人id',
  `user` varchar(10) NOT NULL COMMENT '处置人',
  `dept_id` int(11) NOT NULL COMMENT '处理单位id',
  `dept` varchar(15) NOT NULL COMMENT '处理单位',
  PRIMARY KEY (`id`))
ENGINE = InnoDB DEFAULT CHARSET=utf8
COMMENT = '事件处置表';

SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

-- 应急事件管理
INSERT INTO `sys_menu` (
	`parent_id`,
	`component`,
	`permission`,
	`type`,
	`path`,
	`icon`,
	`menu_id`,
	`del_flag`,
	`create_time`,
	`sort`,
	`update_time`,
	`name`
)
VALUES
	(
		'-1',
		'',
		'',
		'0',
		'/event',
		'icon-bangzhushouji',
		'90000',
		'0',
		'2018-01-20 13:17:19',
		'9',
		'2018-07-29 13:38:19',
		'应急事件管理'
	);

-- 应急事件
INSERT INTO `sys_menu` (
	`parent_id`,
	`component`,
	`permission`,
	`type`,
	`path`,
	`icon`,
	`menu_id`,
	`del_flag`,
	`create_time`,
	`sort`,
	`update_time`,
	`name`
)
VALUES
	(
		'90000',
		'views/emergencyevent/emergencyevent/index',
		'',
		'0',
		'/emergencyevent',
		'icon-bangzhushouji',
		'91000',
		'0',
		'2018-01-20 13:17:19',
		'2',
		'2018-07-29 13:38:19',
		'应急事件'
	);

-- 评估总计
INSERT INTO `sys_menu` (
	`parent_id`,
	`component`,
	`permission`,
	`type`,
	`path`,
	`icon`,
	`menu_id`,
	`del_flag`,
	`create_time`,
	`sort`,
	`update_time`,
	`name`
)
VALUES
	(
		'90000',
		'views/emergencyevent/eventdeal/index',
		'',
		'0',
		'/eventdeal',
		'icon-bangzhushouji',
		'92000',
		'0',
		'2018-01-20 13:17:19',
		'2',
		'2018-07-29 13:38:19',
		'评估总计'
	);

-- 下达指令
insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)
    values ( '91000', null, 'event_down', '1', null, '1', '91001', '0', '2018-05-15 21:35:18', '0', '2018-07-29 13:38:59', '下达指令');
-- 上报事件
insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)
    values ( '91000', null, 'event_report', '1', null, '1', '91002', '0', '2018-05-15 21:35:18', '1', '2018-07-29 13:38:59', '上报事件');
-- 事件反馈
insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)
    values ( '91000', null, 'event_up', '1', null, '1', '91003', '0', '2018-05-15 21:35:18', '2', '2018-07-29 13:38:59', '事件反馈');

-- 编辑
insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)
    values ( '91000', null, 'event_update', '1', null, '1', '91004', '0', '2018-05-15 21:35:18', '2', '2018-07-29 13:38:59', '编辑');
-- 删除
insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)
    values ( '91000', null, 'event_delete', '1', null, '1', '91005', '0', '2018-05-15 21:35:18', '2', '2018-07-29 13:38:59', '删除');