
SET FOREIGN_KEY_CHECKS=0;


DROP TABLE IF EXISTS sys_config_info;
CREATE TABLE sys_config_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  name varchar(50) NOT NULL,
  value varchar(200) DEFAULT NULL,
  remark varchar(100) DEFAULT NULL,
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for contact_user_info
-- ----------------------------
DROP TABLE IF EXISTS contact_user_info;
CREATE TABLE contact_user_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  name varchar(50) NOT NULL,
  sex varchar(5) DEFAULT NULL,
  phone varchar(20) DEFAULT NULL,
  email varchar(50) DEFAULT NULL,
  address varchar(100) DEFAULT NULL,
  user_id int(11) DEFAULT NULL,
  delete_flag int(4) DEFAULT '0',
  wx_key varchar(50) DEFAULT null COMMENT '微信openid' ,
  wx_img varchar(300) DEFAULT null COMMENT '微信头像' ,
  aid int(11) DEFAULT '-1',
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  mid int(11) DEFAULT '-1',
  mtime datetime default null ,
  PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for file_info
-- ----------------------------
DROP TABLE IF EXISTS file_info;
CREATE TABLE file_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  name varchar(50) DEFAULT NULL,
  fix varchar(50) DEFAULT NULL,
  size int(10) DEFAULT '0',
  file_path varchar(100) DEFAULT '' ,
  delete_flag int(4) DEFAULT '0',
  add_id int(11) DEFAULT '0',
  add_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for hk_account_info
-- ----------------------------
DROP TABLE IF EXISTS hk_account_info;
CREATE TABLE hk_account_info (
  id int(11) NOT NULL AUTO_INCREMENT COMMENT 'pk',
  appKey varchar(100) DEFAULT NULL,
  secret varchar(100) DEFAULT NULL,
  accessToken varchar(100) DEFAULT NULL,
  aid int(11) DEFAULT NULL,
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  mid int(11) DEFAULT NULL,
  mtime datetime DEFAULT NULL,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='海康开放平台信息表';

-- ----------------------------
-- Table structure for iot_alarm_info
-- ----------------------------
DROP TABLE IF EXISTS iot_alarm_info;
CREATE TABLE iot_alarm_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  name varchar(100) DEFAULT NULL,
  description varchar(100) DEFAULT NULL,
  sensor_id int(11) DEFAULT NULL,
  iot_trigger_alarm_level int(11) DEFAULT NULL COMMENT '报警级别',
  alarm_sdata float DEFAULT NULL,
  sdata float DEFAULT NULL,
  iot_alarm_process_status int(11) DEFAULT NULL COMMENT '处理标志',
  contact_names varchar(100) COMMENT '报警联系人' ,
  aid int(11) DEFAULT '-1',
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  mid int(11) DEFAULT '-1',
  delete_flag int(4) DEFAULT '0',
  mtime datetime default null ,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for iot_history_sensor_data
-- ----------------------------
DROP TABLE IF EXISTS iot_history_sensor_data_1;
CREATE TABLE iot_history_sensor_data_1 (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  sensor_id int(11) DEFAULT NULL,
  sdata varchar(60) DEFAULT NULL,
  aid int(11) DEFAULT '-1',
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  index index_sensor_id_atime (sensor_id,atime) ,
  PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS iot_history_sensor_data;
CREATE TABLE iot_history_sensor_data (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  sensor_id int(11) DEFAULT NULL,
  sdata varchar(60) DEFAULT NULL,
  aid int(11) DEFAULT '-1',
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  index index_sensor_id_atime (sensor_id,atime) ,
  PRIMARY KEY (id)
) ENGINE=MERGE DEFAULT CHARSET=utf8 
	INSERT_METHOD=LAST 
	UNION=(iot_history_sensor_data_1);
	
-- DROP TABLE IF EXISTS iot_history_sensor_data;
-- CREATE TABLE iot_history_sensor_data (
--  id bigint(20) NOT NULL AUTO_INCREMENT,
--  sensor_id int(11) DEFAULT NULL,
--  sdata varchar(60) DEFAULT NULL,
--  aid int(11) DEFAULT '-1',
--  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
--  index index_sensor_id_atime (sensor_id,atime) ,
--  PRIMARY KEY (id)
--  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;

-- ----------------------------
-- Table structure for iot_history_node_data 按设备储存数据
-- ----------------------------
DROP TABLE IF EXISTS iot_history_node_data_1;
CREATE TABLE iot_history_node_data_1 (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  node_id int(11) DEFAULT NULL,
  sensor_ids varchar(100)  ,
  sdatas varchar(300) DEFAULT NULL,
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  index index_sensor_id_atime (node_id,atime) ,
  PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS iot_history_node_data;
CREATE TABLE iot_history_node_data (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  node_id int(11) DEFAULT NULL,
  sensor_ids varchar(100)  ,
  sdatas varchar(300) DEFAULT NULL,
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  index index_sensor_id_atime (node_id,atime) ,
  PRIMARY KEY (id)
) ENGINE=MERGE DEFAULT CHARSET=utf8 
	INSERT_METHOD=LAST 
	UNION=(iot_history_node_data_1);
	
-- ----------------------------
-- Table structure for iot_history_trigger_info
-- ----------------------------
DROP TABLE IF EXISTS iot_history_trigger_info;
CREATE TABLE iot_history_trigger_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  sdata float DEFAULT NULL,
  description varchar(100) DEFAULT NULL,
  name varchar(50) DEFAULT NULL,
  from_sensor_id int(11) NOT NULL COMMENT '源传感器ID',
  to_sensor_id int(11) DEFAULT NULL COMMENT '目标传感器ID',
  iot_trigger_condition_type int(11) DEFAULT NULL COMMENT '触发条件类型',
  trigger_value varchar(30) DEFAULT NULL,
  iot_trigger_action_type varchar(50) DEFAULT NULL COMMENT '触发动作类型',
  action_params varchar(150) DEFAULT NULL COMMENT '触发动作参数',
  condition_params varchar(100) DEFAULT NULL COMMENT '条件参数',
  iot_trigger_alarm_level int(11) DEFAULT NULL COMMENT '报警级别',
  iot_trigger_alarm_flag int(11) DEFAULT NULL COMMENT '是否报警标志',
  trigger_inteval_time int(6) DEFAULT NULL COMMENT '触发间隔',
  aid int(11) DEFAULT '-1',
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for iot_lpm_info
-- ----------------------------
DROP TABLE IF EXISTS iot_lpm_info;
CREATE TABLE iot_lpm_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  name varchar(50) NOT NULL,
  ip varchar(50) DEFAULT NULL,
  port varchar(20) DEFAULT NULL,
  lpm_key varchar(50) DEFAULT NULL,
  delete_flag int(4) DEFAULT '0',
  aid int(11) DEFAULT '-1',
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  mid int(11) DEFAULT '-1',
  mtime datetime default null ,
  PRIMARY KEY (id),
  UNIQUE KEY lpm_key (lpm_key)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for iot_node_info
-- ----------------------------
DROP TABLE IF EXISTS iot_node_info;
CREATE TABLE iot_node_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  name varchar(50) NOT NULL,
  device_code varchar(50) NOT NULL,
  iot_node_type int(4) DEFAULT '0' COMMENT '节点类型:数据节点,视频、门禁',
  iot_protocal_category varchar(50) DEFAULT NULL COMMENT '协议类型',
  seq int(10) DEFAULT '0',
  scene_id int(11) ,
  delete_flag int(4) DEFAULT '0',
  iot_node_status int(4) DEFAULT NULL COMMENT '节点状态',
  template_id int(11) DEFAULT NULL COMMENT '模板id' ,
  img_id int(8) DEFAULT NULL,
  maintenance_time  datetime default null ,
  lonLat varchar(50) COMMENT '经纬度' ,
  infos varchar(1000) COMMENT '配置信息',
  frequency int(4) COMMENT '上传周期',
  aid int(11) DEFAULT '-1',
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  mid int(11) DEFAULT '-1',
  mtime datetime default null ,
  PRIMARY KEY (id),
  INDEX deviceCoce (device_code)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for iot_scene_info
-- ----------------------------
DROP TABLE IF EXISTS iot_scene_info;
CREATE TABLE iot_scene_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  name varchar(50) NOT NULL,
  pid int(11) DEFAULT NULL COMMENT '父场景号',
  user_id int(11) DEFAULT NULL,
  delete_flag int(4) DEFAULT '0',
  img_id varchar(100) DEFAULT null ,
  lon double DEFAULT NULL,
  lat double DEFAULT NULL,
  description varchar(100) DEFAULT NULL,
  iot_scene_type int(11) DEFAULT NULL COMMENT '场景类型：农业、家居',
  guard_status int(4) DEFAULT NULL COMMENT '布防状态',
  remark varchar(100) DEFAULT NULL,
  province varchar(20)  DEFAULT NULL ,
  province_code  int(11)  DEFAULT NULL ,
  city  varchar(20)  DEFAULT NULL ,
  city_code  int(11) default null ,
  seq int(10) DEFAULT '0',
  aid int(11) DEFAULT '-1',
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  mid int(11) DEFAULT '-1',
  mtime datetime default null ,
  PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for iot_scene_user_relation
-- ----------------------------
DROP TABLE IF EXISTS iot_scene_user_relation;
CREATE TABLE iot_scene_user_relation (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  scene_id int(11) DEFAULT NULL,
  user_id int(11) DEFAULT NULL,
  aid int(11) DEFAULT '-1',
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for iot_sensor_device_info
-- ----------------------------
DROP TABLE IF EXISTS iot_sensor_device_info;
CREATE TABLE iot_sensor_device_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  name varchar(50) NOT NULL,
  node_id int(11) DEFAULT NULL,
  address varchar(50) DEFAULT NULL,
  device_status int(4) DEFAULT '18' COMMENT '设备状态' ,
  seq int(11) ,
  aid int(11) DEFAULT '-1',
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  mid int(11) DEFAULT '-1',
  mtime datetime default null ,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for iot_sensor_info
-- ----------------------------
DROP TABLE IF EXISTS iot_sensor_info;
CREATE TABLE iot_sensor_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  name varchar(50) NOT NULL, 
  measure_unit_type int(11) DEFAULT NULL COMMENT '传感器单位',
  iot_sensor_type int(11) DEFAULT NULL COMMENT '类型：连续型、开关性等',
  iot_sensor_category int(11) DEFAULT NULL COMMENT '种类：温度、IO、开关',
  node_id int(11) DEFAULT NULL,
  sensor_device_id varchar(50)DEFAULT 0,
  port_id int(11) DEFAULT 0,
  sdata double DEFAULT '0',
  str_sdata varchar(600) DEFAULT '' ,
  seq int(8) DEFAULT NULL,
  delete_flag int(4) DEFAULT '0',
  iot_sensor_status int(4) DEFAULT '0' COMMENT '传感器状态',
  request_sdata float DEFAULT '0',
  sdata_degree int(4) DEFAULT NULL COMMENT '精度',
  formula_up varchar(50) DEFAULT NULL COMMENT '直接公式处理，公式可在数据字典选择',
  formula_down varchar(50) DEFAULT NULL COMMENT '直接公式处理，公式可在数据字典选择',
  register_time datetime default null ,
  data_type int(4) DEFAULT 0 COMMENT '数据类型',
  param_type int(4) COMMENT '参数功能数值码',
  param_names varchar(150) COMMENT '参数名称',
  param_config varchar(300) DEFAULT null COMMENT '参数配置' ,
  infos varchar(200) COMMENT '参数配置' ,
  store_strage int(4) COMMENT '储存策略' ,
  aid int(11) DEFAULT '-1',
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  mid int(11) DEFAULT '-1',
  mtime datetime default null ,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for iot_trigger_info
-- ----------------------------
DROP TABLE IF EXISTS iot_trigger_info;
CREATE TABLE iot_trigger_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  name varchar(50) NOT NULL,
  node_id int(11) COMMENT '设备id',
  from_sensor_id int(11) COMMENT '源传感器ID',
  to_sensor_id int(11) DEFAULT NULL COMMENT '目标传感器ID',
  iot_trigger_condition_type int(11) DEFAULT NULL COMMENT '触发条件类型',
  iot_trigger_action_type varchar(50) DEFAULT NULL COMMENT '触发动作类型',
  action_params varchar(150) DEFAULT NULL COMMENT '触发动作参数',
  seq int(8) DEFAULT NULL,
  delete_flag int(4) DEFAULT '0',
  condition_params varchar(100) DEFAULT NULL COMMENT '条件参数',
  iot_trigger_alarm_level int(11) DEFAULT NULL COMMENT '报警级别',
  iot_trigger_alarm_flag int(11) DEFAULT NULL COMMENT '是否报警标志',
  iot_trigger_status int(11) DEFAULT NULL COMMENT '启停状态',
  trigger_inteval_time int(6) DEFAULT NULL COMMENT '触发间隔',
  last_trigger_time datetime default null COMMENT ' 最近触发时间',
  recovery int(11) COMMENT '发送报警恢复开关' ,
  aid int(11) DEFAULT '-1',
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  mid int(11) DEFAULT '-1',
  mtime datetime default null ,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for iot_video_info
-- ----------------------------
DROP TABLE IF EXISTS iot_video_info;
CREATE TABLE iot_video_info (
  id int(11) NOT NULL AUTO_INCREMENT COMMENT 'pk',
  name varchar(100) DEFAULT NULL COMMENT '视频名称',
  scene_id int(11) DEFAULT NULL,
  app_name varchar(60) ,
  status int(4) DEFAULT NULL,
  image_id int(11) DEFAULT NULL,
  delete_flag int(4) DEFAULT '0',
  video_type int(4) DEFAULT NULL,
  seq int(4) DEFAULT NULL,
  relate_id int(4) DEFAULT NULL COMMENT '关联账户ID',
  rtmp_url_high varchar(150) DEFAULT NULL COMMENT 'rtmp播放地址',
  rtmp_url_common varchar(150) DEFAULT NULL COMMENT 'rtmp正常播放地址',
  hls_url varchar(150) DEFAULT NULL COMMENT 'hls播放地址',
  device_serial varchar(100) DEFAULT NULL COMMENT '摄像头SN' ,
  validate_code varchar(100) DEFAULT NULL COMMENT '验证码' ,
  camera_type int(4) COMMENT '摄像头类型' ,
  username varchar(32),
  password varchar(32),
  ip	varchar(20),
  port	varchar(10),
  codectype varchar(20),
  channel varchar(10) COMMENT '摄像头通道' ,
  subtype	varchar(20),
  aid int(11) DEFAULT NULL,
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  mid int(11) DEFAULT NULL,
  mtime datetime DEFAULT NULL,
  UNIQUE KEY app_name (app_name,delete_flag),
  PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='视频信息';

-- ----------------------------
-- Table structure for iot_video_record
-- ----------------------------
DROP TABLE IF EXISTS iot_video_record;
CREATE TABLE iot_video_record (
  id int(11) NOT NULL AUTO_INCREMENT COMMENT 'pk',
  video_id int(11) DEFAULT NULL COMMENT '视频id',
  name varchar(100) DEFAULT NULL COMMENT '名称',
  start_date datetime DEFAULT NULL COMMENT '开始时间',
  end_date datetime DEFAULT NULL COMMENT '结束时间',
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='视频记录';

-- ----------------------------
-- Table structure for video_file_info
-- ----------------------------
DROP TABLE IF EXISTS video_file_info;
CREATE TABLE video_file_info (
  id int(11) NOT NULL AUTO_INCREMENT COMMENT 'pk',
  video_id int(11) DEFAULT NULL COMMENT '视频id',
  name varchar(100) DEFAULT NULL COMMENT '名称',
  fix varchar(50) DEFAULT NULL,
  url varchar(100) ,
  delete_flag int(4) ,
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='视频记录';

-- ----------------------------
-- Table structure for menu_info
-- ----------------------------
DROP TABLE IF EXISTS menu_info;
CREATE TABLE menu_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  name varchar(50) DEFAULT NULL,
  url varchar(100) DEFAULT NULL,
  delete_flag int(4) DEFAULT '0',
  add_id int(11) DEFAULT '0',
  add_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  modify_time datetime default null ,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for pro_dictionary_info
-- ----------------------------
DROP TABLE IF EXISTS pro_dictionary_info;
CREATE TABLE pro_dictionary_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  p_dictionary_name varchar(50) DEFAULT NULL,
  dictionary_name varchar(50) NOT NULL,
  p_code int(11) DEFAULT NULL,
  code int(11) NOT NULL,
  name varchar(50) NOT NULL,
  value varchar(50) DEFAULT NULL,
  seq int(11) DEFAULT '0',
  delete_flag int(4) DEFAULT '0',
  mtime datetime default null ,
  PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for user_info
-- ----------------------------
DROP TABLE IF EXISTS user_info;
CREATE TABLE user_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  name varchar(50) NOT NULL,
  password varchar(50) NOT NULL,
  phone varchar(11) DEFAULT NULL,
  email varchar(50) DEFAULT NULL,
  user_key varchar(32) NOT NULL,
  nick_name varchar(50) DEFAULT NULL,
  real_name varchar(50) DEFAULT NULL,
  id_no varchar(50) DEFAULT NULL,
  type int(4) DEFAULT '0' COMMENT '用户类型',
  status int(4) DEFAULT '0' COMMENT '用户状态',
  sex int(4) DEFAULT '0',
  img_id int(8) DEFAULT NULL,
  remark varchar(50) DEFAULT NULL,
  delete_flag int(4) DEFAULT '0',
  register_time datetime default null ,
  wx_open_id varchar(32) DEFAULT NULL,
  wx_img_url varchar(200) DEFAULT NULL ,
  wp_id varchar(32) DEFAULT NULL COMMENT '微信小程序id',
  validate_code varchar(32) DEFAULT NULL,
  validate_time datetime default null ,
  aid int(11) DEFAULT '-1',
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  mid int(11) DEFAULT '-1',
  mtime datetime default null ,
  PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for user_menu_info
-- ----------------------------
DROP TABLE IF EXISTS user_menu_info;
CREATE TABLE user_menu_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  menu_id int(11) NOT NULL,
  user_type int(4) NOT NULL,
  seq int(4) DEFAULT '0',
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- 用户账户信息表
DROP TABLE IF EXISTS user_account_info ;
CREATE TABLE user_account_info (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  user_id bigint(20) NOT NULL,
  amount int(11) default 0 COMMENT '金额，分为单位' ,
  sms_num int(11) default 0 COMMENT '短信数量',
  voice_num int(11) default 0 COMMENT '语音报警数量',
  delete_flag int(4) default 0  ,
  aid int(11) DEFAULT '-1',
  atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  mid int(11) DEFAULT '-1',
  mtime datetime default null ,
  index index_user_id (user_id) ,
  PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- 报警触发记录
DROP TABLE IF EXISTS alarm_trigger_record ;
CREATE TABLE alarm_trigger_record (
	id bigint(20) NOT NULL AUTO_INCREMENT,
	user_id bigint(20) NOT NULL,
	trigger_type int(11) COMMENT '触发类型，短信，语音，微信等' ,
	remark varchar(30) ,
	content varchar(300) COMMENT '报警内容' ,
	atime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	index index_user_id (user_id) ,
	PRIMARY KEY (id)
)  ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- 报警触发统计（按天）
DROP TABLE IF EXISTS alarm_trigger_statistic ;
CREATE TABLE alarm_trigger_statistic (
	id bigint(20) NOT NULL AUTO_INCREMENT,
	user_id bigint(20) NOT NULL,
	trigger_type int(11) COMMENT '触发类型，短信，语音，微信等' ,
	num int(4) COMMENT '数量',
	atime datetime default null ,
	index index_user_id_atime (user_id,atime) ,
	PRIMARY KEY (id)
)  ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;


-- m默认初始化数据----------------------------

INSERT INTO user_info    VALUES ('1', 'admin', '123456', '15850561789', '2224313811@qq.com', '426aad8a150a4d85a8fa7221085edca3', NULL, NULL, NULL, '10', '60', '0', NULL, NULL, '0', '2019-06-03 10:58:54', NULL, NULL, NULL, NULL, '2019-06-03 10:58:54', '-1', '2019-06-03 10:58:54', '-1', '2019-06-03 10:58:54');

INSERT INTO user_account_info ( user_id ) VALUES ('1') ;


INSERT INTO sys_config_info ( name, value, remark) VALUES ('sys.borwser.name', '物联网平台', '浏览器标题名称');
INSERT INTO sys_config_info ( name, value, remark) VALUES ('sys.web.login.name', '物联网中控管理平台', 'WEB登录页名称');
INSERT INTO sys_config_info ( name, value, remark) VALUES ('sys.app.login.name', '物联网中控管理平台', 'WAP登录页名称');
INSERT INTO sys_config_info ( name, value, remark) VALUES ('sys.info.name', '物联网管控平台', 'WEB系统内左上角名称');
INSERT INTO sys_config_info ( name, value, remark) VALUES ('sys_web_screen_name', '中控管理平台数据统计', '大屏页面标题，最好少于17字');
INSERT INTO sys_config_info ( name, value, remark) VALUES ('sys.tech.help', '小名智能科技  技术支持', '技术支持');
INSERT INTO sys_config_info ( name, value, remark) VALUES ('sys.beian.name', '苏ICP备180615xx号', '备案号');
INSERT INTO sys_config_info ( name, value, remark) VALUES ('sys.version', 'v0.3.8', '系统版本');

INSERT INTO sys_config_info ( name, value, remark) VALUES ('server.domain', 'http://127.0.0.1', '系统服务访问URL,不需要斜杠结尾');
INSERT INTO sys_config_info ( name, value, remark) VALUES ('server.image.domain', 'http://127.0.0.1/res', '图片访问URL,不需要斜杠结尾');
INSERT INTO sys_config_info ( name, value, remark) VALUES ('server.file.local.path', 'D:/file/lpro', '系统文件储存地址,不需要斜杠结尾');

INSERT INTO sys_config_info ( name, value, remark) VALUES ('app.node.data.save', '0', '按设备存储数据，1存储，0不存储');

INSERT INTO sys_config_info ( name, value, remark) VALUES ('ezuiz.app.key', '7484bb427c824****f24545aa9a6b', '萤石应用appKey');
INSERT INTO sys_config_info ( name, value, remark) VALUES ('ezuiz.app.secret', '655ff00e05887****2ed0a82e24c', '萤石应用appSecret');

