-- 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 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 NOT NULL COMMENT '上报单位id',
  `reporter_id` INT NOT NULL COMMENT '上报人id',
  `reporting_time` DATETIME NOT NULL COMMENT '上报时间',
  `status` VARCHAR(10) NOT NULL DEFAULT '未处理' COMMENT '状态',
  PRIMARY KEY (`event_id`))
ENGINE = InnoDB
COMMENT = '应急事件表';


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

CREATE TABLE IF NOT EXISTS `aroad`.`event_deal` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `event_id` VARCHAR(45) NOT NULL COMMENT '事件id',
  `deal_content` VARCHAR(225) NOT NULL COMMENT '处置内容',
  `deal_type` BIT NOT NULL COMMENT '处置类型： 0：下达指令 1：处置反馈',
  `deal_time` DATETIME NOT NULL COMMENT '处置时间',
  `user_id` INT NOT NULL COMMENT '处置人id',
  `user` VARCHAR(10) NOT NULL COMMENT '处置人',
  PRIMARY KEY (`id`))
ENGINE = InnoDB
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_up', '1', null, '1', '91002', '0', '2018-05-15 21:35:18', '1', '2018-07-29 13:38:59', '上报事件');
