

DELIMITER ??
DROP PROCEDURE IF EXISTS schema_change ??
CREATE PROCEDURE schema_change () BEGIN

    IF NOT EXISTS(SELECT *
                  FROM information_schema.columns
                  WHERE table_schema = DATABASE()
                    AND table_name = 'sys_device'
                    AND column_name = 'org_path') THEN
        ALTER TABLE sys_device
            ADD COLUMN `org_path`  varchar(255) NULL COMMENT '机构path' AFTER `org_name`;
    END IF;

	IF EXISTS(SELECT *
                  FROM information_schema.columns
                  WHERE table_schema = DATABASE()
                    AND table_name = 'core_protection_log') THEN
        rename TABLE `core_protection_log` to `iot_alarm_subsystem_log`;
    END IF;	
	
	IF EXISTS(SELECT *
                  FROM information_schema.columns
                  WHERE table_schema = DATABASE()
                    AND table_name = 'core_protection') THEN
        rename TABLE `core_protection` to `iot_alarm_subsystem`;
    END IF;	
	
    IF NOT EXISTS(SELECT *
                  FROM information_schema.columns
                  WHERE table_schema = DATABASE()
                    AND table_name = 'iot_alarm_subsystem'
                    AND column_name = 'status_change_time') THEN
        ALTER TABLE `iot_alarm_subsystem` 
					ADD COLUMN `status_change_time` datetime NULL COMMENT '布撤防时间' AFTER `all_Hour`,
					ADD COLUMN `source` int NULL COMMENT '设备来源：0：设备登记；1：iot推送' AFTER `update_by`,
					MODIFY COLUMN `status_update_time` datetime NULL DEFAULT NULL COMMENT '布撤防更新时间' AFTER `all_Hour`,
					COMMENT = '报警控制器（子系统）表';		
    END IF;
	
	IF EXISTS(SELECT *
                  FROM information_schema.columns
                  WHERE table_schema = DATABASE()
                    AND table_name = 'iot_alarm_subsystem'
                    AND column_name = 'alarm_host_id') THEN
        ALTER TABLE `iot_alarm_subsystem` 
			DROP COLUMN `alarm_host_id`;
    END IF;
	
	IF NOT EXISTS(SELECT *
                  FROM information_schema.columns
                  WHERE table_schema = DATABASE()
                    AND table_name = 'iot_alarm_subsystem'
                    AND column_name = 'alarm_host_code') THEN
        ALTER TABLE `iot_alarm_subsystem` 
					ADD COLUMN `alarm_host_code` varchar(64) NULL COMMENT '报警主机code' AFTER `org_name`;		
    END IF;
	
	IF NOT EXISTS(SELECT *
                  FROM information_schema.columns
                  WHERE table_schema = DATABASE()
                    AND table_name = 'iot_alarm_subsystem_log'
                    AND column_name = 'status_change_time') THEN
        ALTER TABLE `iot_alarm_subsystem_log` 
					ADD COLUMN `status_change_time` datetime NULL COMMENT '布撤防时间' AFTER `status_update_time`,
					MODIFY COLUMN `status_update_time` datetime NULL DEFAULT NULL COMMENT '布撤防更新时间',
					COMMENT = '报警控制器（子系统）布撤防历史表';		
    END IF;	
	
	IF EXISTS(SELECT *
                  FROM information_schema.columns
                  WHERE table_schema = DATABASE()
                    AND table_name = 'iot_alarm_subsystem_log'
                    AND column_name = 'alarm_host_id') THEN
        ALTER TABLE `iot_alarm_subsystem_log` 
			DROP COLUMN `alarm_host_id`;
    END IF;
	
	IF NOT EXISTS(SELECT *
                  FROM information_schema.columns
                  WHERE table_schema = DATABASE()
                    AND table_name = 'iot_alarm_subsystem_log'
                    AND column_name = 'alarm_host_code') THEN
        ALTER TABLE `iot_alarm_subsystem_log` 
					ADD COLUMN `alarm_host_code` varchar(64) NULL COMMENT '报警主机code' AFTER `org_name`;		
    END IF;
	IF NOT EXISTS(SELECT *
                  FROM information_schema.columns
                  WHERE table_schema = DATABASE()
                    AND table_name = 'iot_sensor'
                    AND column_name = 'state_start_time') THEN
			ALTER TABLE `iot_sensor` 
				ADD COLUMN `state_start_time` datetime NULL COMMENT '当前状态的开始时间' AFTER `state_update_time`;		
    END IF;	
END ??
DELIMITER ;
CALL schema_change ();


ALTER TABLE `iot_alarm_subsystem_log` 
MODIFY COLUMN `status` int NULL DEFAULT NULL COMMENT '布防状态，0：撤防，1：布防,2:未知（未登记过或离线）' AFTER `name`;
ALTER TABLE `iot_alarm_subsystem` 
MODIFY COLUMN `status` int NULL DEFAULT NULL COMMENT '布防状态，0：撤防，1：布防,2:未知（未登记过或离线）' AFTER `name`;
update iot_alarm_subsystem set `status`=2 WHERE status is null;
update iot_alarm_subsystem_log set `status`=2 WHERE status is null;
UPDATE iot_alarm_subsystem set status_change_time =status_update_time WHERE status_change_time is null;
UPDATE iot_alarm_subsystem_log set status_change_time =status_update_time WHERE status_change_time is null;

drop table if exists iot_device;
CREATE TABLE `iot_device` (
          `id` bigint NOT NULL,
          `org_id` bigint DEFAULT NULL COMMENT '所属机构',
          `org_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属机构名称',
          `org_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属机构path',
          `equipment_code` varchar(64) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '设备唯一标识',
          `equipment_name` varchar(255) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '设备名称',
          `category_id` bigint DEFAULT NULL COMMENT '设备分类',
          `camera_code` varchar(64) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '摄像机标识',
          `camera_user_name` varchar(255) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '摄像机登录用户名',
          `camera_password` varchar(255) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '摄像机登录密码',
          `net_address` varchar(20) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT 'ip地址',
          `producer` varchar(255) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '厂商',
          `device_type` varchar(255) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '设备型号',
          `equipment_addr` varchar(255) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '设备的地址',
          `device_id` bigint DEFAULT NULL COMMENT '资产设备id',
          `deleted` int DEFAULT NULL COMMENT '0:未删除，1：删除',
          `source` int DEFAULT NULL COMMENT '来源,0:资产设备，1：iot推送',
          `create_time` datetime DEFAULT NULL COMMENT '创建时间',
          `update_time` datetime DEFAULT NULL COMMENT '修改时间',
          `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
          `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
          `net_status` int DEFAULT NULL COMMENT '网络状态:0:未知,1:在线,2:离线,3:异常',
          PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

drop table if exists iot_dvr_channel;
CREATE TABLE `iot_dvr_channel` (
       `id` bigint NOT NULL,
       `org_id` bigint DEFAULT NULL COMMENT '所属机构',
       `org_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属机构名称',
       `org_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属机构path',
       `host_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '监控主机（硬盘录像机）的编码',
       `channel_code` int DEFAULT NULL COMMENT '通道编号',
       `channel_name` varchar(255) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '通道名称',
       `channel_addr` varchar(255) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '通道地址',
       `device_id` bigint DEFAULT NULL COMMENT '资产设备id',
       `deleted` int DEFAULT NULL COMMENT '0:未删除，1：删除',
       `source` int DEFAULT NULL COMMENT '来源,0:资产设备，1：iot推送',
       `create_time` datetime DEFAULT NULL COMMENT '创建时间',
       `update_time` datetime DEFAULT NULL COMMENT '修改时间',
       `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
       `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
       PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

drop table if exists iot_alarm_defence_area;
CREATE TABLE `iot_alarm_defence_area` (
      `id` bigint NOT NULL,
      `org_id` bigint DEFAULT NULL COMMENT '机构id',
      `org_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构名称',
      `org_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构path',
      `organization_guid` varchar(225) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构guid',
      `alarm_host_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '报警主机唯一标识',
      `sub_system_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '子系统编号',
      `defence_area_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '防区名称',
      `sensor_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '传感器类型',
      `category_id` bigint DEFAULT NULL COMMENT '设备分类',
      `sensor_type_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '专感器类型名称',
      `defence_area_index` int DEFAULT NULL COMMENT '防区序号（在子系统的编号）',
      `state` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'alarm:报警，bypass:旁路，normal:正常，activity：活动，unKnown：未知',
      `state_text` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '状态描述',
      `state_update_time` datetime DEFAULT NULL COMMENT '状态变更时间',
      `deleted` int DEFAULT NULL COMMENT '是否删除',
      `create_time` datetime(6) DEFAULT NULL COMMENT '创建时间',
      `update_time` datetime(6) DEFAULT NULL COMMENT '更新时间',
      `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
      `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人',
      PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='报警防区';

drop table if exists iot_alarm_defence_area_data;
CREATE TABLE `iot_alarm_defence_area_data` (
       `id` bigint NOT NULL,
       `organization_guid` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构guid',
       `org_id` bigint DEFAULT NULL,
       `org_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
       `org_path` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
       `alarm_host_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '报警主机唯一标识',
       `defence_area_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '报警主机子系统唯一标识',
       `defence_area_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '传感器名称',
       `defence_area_index` int DEFAULT NULL COMMENT '输入标识',
       `defence_area_status` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'alarm:报警，bypass:旁路，normal:正常，activity：活动，unKnown：未知',
       `update_time` datetime DEFAULT NULL COMMENT '修改时间',
       `device_id` bigint DEFAULT NULL COMMENT '设备id',
       `sensor_data` bigint DEFAULT NULL COMMENT '设备id',
       `create_time` datetime(6) DEFAULT NULL COMMENT '创建时间',
       PRIMARY KEY (`id`) USING BTREE,
       KEY `index_deviceId` (`device_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='防区传感器报警信息，日志';

drop table if exists iot_alarm_defence_area_alarm_data;
CREATE TABLE `iot_alarm_defence_area_alarm_data` (
     `id` bigint NOT NULL,
     `org_id` bigint DEFAULT NULL,
     `org_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
     `org_path` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
     `defence_area_id` bigint DEFAULT NULL COMMENT '设备id',
     `alarm_host_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '报警主机唯一标识',
     `sub_system_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '报警主机子系统唯一标识',
     `defence_area_name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '防区名称',
     `defence_area_index` int DEFAULT NULL COMMENT '输入标识',
     `defence_area_status` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'alarm:报警，bypass:旁路，normal:正常，activity：活动，unKnown：未知',
     `update_time` datetime DEFAULT NULL COMMENT '修改时间',
     `isdo` int DEFAULT '0' COMMENT '处理状态 0:未处理,1:已处理(误报),2:已处理(无需处理),3:已处理(运维单)',
     `organization_guid` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构guid',
     PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='防区传感器报警信息报警表，记录报警';

drop table if exists iot_alarm_defence_area_data_log;
CREATE TABLE `iot_alarm_defence_area_data_log` (
       `id` bigint NOT NULL,
       `organization_guid` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构guid',
       `org_id` bigint DEFAULT NULL,
       `org_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
       `org_path` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
       `alarm_host_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '报警主机唯一标识',
       `defence_area_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '报警主机子系统唯一标识',
       `defence_area_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '传感器名称',
       `defence_area_index` int DEFAULT NULL COMMENT '输入标识',
       `defence_area_status` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'alarm:报警，bypass:旁路，normal:正常，activity：活动，unKnown：未知',
       `update_time` datetime DEFAULT NULL COMMENT '修改时间',
       `device_id` bigint DEFAULT NULL COMMENT '设备id',
       `defence_area_data_id` bigint DEFAULT NULL COMMENT '防区数据表id',
       PRIMARY KEY (`id`) USING BTREE,
       KEY `index_deviceId` (`device_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='防区传感器报警信息，日志';

drop table if exists iot_dvr_disk;
CREATE TABLE `iot_dvr_disk` (
        `id` bigint NOT NULL,
        `org_id` bigint DEFAULT NULL COMMENT '所属机构',
        `org_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属机构名称',
        `org_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属机构path',
        `host_code` varchar(64) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '监控主机唯一标识',
        `disk_name` varchar(255) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '硬盘名称',
        `disk_index` int DEFAULT NULL COMMENT '硬盘序号',
        `total` int DEFAULT NULL COMMENT '硬盘总的空间大小(单位：MB)',
        `available` int DEFAULT NULL COMMENT '硬盘可用空间大小(单位：MB)',
        `state` int DEFAULT NULL COMMENT '硬盘状态。0：正常，1：异常',
        `state_update_time` datetime DEFAULT NULL COMMENT '最后一次状态更新时间',
        `deleted` int DEFAULT NULL COMMENT '0:未删除，1：删除',
        `source` int DEFAULT NULL COMMENT '来源,0:资产设备，1：iot推送',
        `create_time` datetime DEFAULT NULL COMMENT '创建时间',
        `update_time` datetime DEFAULT NULL COMMENT '修改时间',
        `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
        `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
        PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

drop table if exists iot_dvr_disk_log;
CREATE TABLE `iot_dvr_disk_log` (
        `id` bigint NOT NULL,
        `iot_dvr_disk_id` bigint NOT NULL,
        `org_id` bigint DEFAULT NULL COMMENT '所属机构',
        `org_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属机构名称',
        `org_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属机构path',
        `host_code` varchar(64) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '监控主机唯一标识',
        `disk_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '硬盘名称',
        `disk_index` int DEFAULT NULL COMMENT '硬盘序号',
        `state` int DEFAULT NULL COMMENT '硬盘状态。0：正常，1：异常',
        `status_update_time` datetime DEFAULT NULL COMMENT '最后一次状态更新时间',
        `deleted` int DEFAULT NULL COMMENT '0:未删除，1：删除',
        `source` int DEFAULT NULL COMMENT '来源,0:资产设备，1：iot推送',
        `create_time` datetime DEFAULT NULL COMMENT '创建时间',
        `update_time` datetime DEFAULT NULL COMMENT '修改时间',
        `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
        `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
        PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

drop table if exists mediator_video_days_check;
CREATE TABLE `mediator_video_days_check` (
         `id` bigint NOT NULL,
         `org_id` bigint DEFAULT '0' COMMENT '机构',
         `org_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构名称',
         `org_path` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '机构',
         `equipment_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '录像机名称',
         `equipment_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '录像机唯一标识',
         `channel_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '通道序号',
         `channel_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '通道的名称',
         `check_date` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '计划存储天数起止日期',
         `lose_date` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '未录像日期集合',
         `plan_days` int DEFAULT '0' COMMENT '计划存储总天数',
         `real_days` int DEFAULT '0' COMMENT '计划日期内实际存储总天数',
         `status` int DEFAULT NULL COMMENT '是否报警 0:未报警,1:报警',
         `earliest_video_time` datetime DEFAULT NULL COMMENT '最早录像日期',
         `create_by` varchar(125) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
         `create_time` datetime DEFAULT NULL COMMENT '创建人名称',
         `update_time` datetime DEFAULT NULL COMMENT '修改时间',
         `update_by` varchar(125) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改人名称',
         PRIMARY KEY (`id`) USING BTREE,
         KEY `idx_user_orgId` (`org_id`) USING BTREE,
         KEY `idx_user_orgPath` (`org_path`) USING BTREE,
         KEY `idx_code` (`equipment_code`(191),`channel_code`(191)) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='录像机天数检查';;

drop table if exists mediator_video_days_check_log;
CREATE TABLE `mediator_video_days_check_log` (
         `id` bigint NOT NULL,
         `org_id` bigint DEFAULT '0' COMMENT '机构',
         `org_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构名称',
         `org_path` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '机构',
         `equipment_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '录像机唯一标识',
         `channel_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '通道序号',
         `channel_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '通道的名称',
         `check_date` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '计划存储天数起止日期',
         `lose_date` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '计划存储天数起止日期',
         `plan_days` int DEFAULT '0' COMMENT '计划存储总天数',
         `real_days` int DEFAULT '0' COMMENT '计划日期内实际存储总天数',
         `video_days_check_id` bigint DEFAULT NULL COMMENT '录像机天数检查ID',
         `status` int DEFAULT NULL,
         `earliest_video_time` datetime DEFAULT NULL COMMENT '最早录像日期',
         `equipment_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
         `create_by` varchar(125) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
         `create_time` datetime DEFAULT NULL COMMENT '创建人名称',
         `update_by` varchar(125) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改人名称',
         `update_time` datetime DEFAULT NULL COMMENT '修改时间',
         PRIMARY KEY (`id`) USING BTREE,
         KEY `idx_user_orgId` (`org_id`) USING BTREE,
         KEY `idx_user_orgPath` (`org_path`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='录像机天数检查日志';;

drop table if exists mediator_video_integrity_check;
CREATE TABLE `mediator_video_integrity_check` (
      `id` bigint NOT NULL,
      `org_id` bigint DEFAULT '0' COMMENT '机构',
      `org_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构名称',
      `org_path` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '机构',
      `equipment_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '录像机名称',
      `equipment_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '录像机唯一标识',
      `channel_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '通道序号',
      `channel_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '通道的名称',
      `check_span` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '检查日期录像计划规则集合',
      `lose_span` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '检查日期录像丢失情况集合',
      `lose_duration` int DEFAULT NULL COMMENT '丢失时长，分钟',
      `record_date` date DEFAULT NULL COMMENT '录像情况检查日期',
      `status` int DEFAULT NULL COMMENT '0:正常 1:部分丢失 2:全部丢失',
      `plan_days` int DEFAULT NULL COMMENT '录像计划存储多少天',
      `create_by` varchar(125) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
      `create_time` datetime DEFAULT NULL COMMENT '创建人名称',
      `update_by` varchar(125) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改人名称',
      `update_time` datetime NOT NULL COMMENT '修改时间',
      PRIMARY KEY (`id`) USING BTREE,
      KEY `idx_user_orgId` (`org_id`) USING BTREE,
      KEY `idx_user_orgPath` (`org_path`) USING BTREE,
      KEY `idx_code` (`channel_code`(191),`equipment_code`(191)) USING BTREE,
      KEY `idx_recordDate_orgPath_status` (`record_date`,`org_path`,`status`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='录像机完整性检查表';

drop table if exists mediator_video_integrity_check_log;
CREATE TABLE `mediator_video_integrity_check_log` (
      `id` bigint NOT NULL,
      `org_id` bigint DEFAULT '0' COMMENT '机构',
      `org_name` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构名称',
      `org_path` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '机构',
      `video_integrity_check_id` bigint DEFAULT NULL COMMENT '录像完整性id',
      `equipment_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '录像机名称',
      `equipment_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '录像机唯一标识',
      `channel_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '通道序号',
      `channel_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '通道的名称',
      `check_span` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '检查日期录像计划规则集合',
      `lose_span` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '检查日期录像丢失情况集合',
      `lose_duration` int DEFAULT NULL COMMENT '丢失时长，分钟',
      `record_date` date DEFAULT NULL COMMENT '录像情况检查日期',
      `status` int DEFAULT NULL COMMENT '0:正常 1:部分丢失 2:全部丢失',
      `plan_days` int DEFAULT NULL COMMENT '录像计划存储多少天',
      `create_by` varchar(125) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
      `create_time` datetime DEFAULT NULL COMMENT '创建人名称',
      `update_by` varchar(125) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改人名称',
      `update_time` datetime NOT NULL COMMENT '修改时间',
      PRIMARY KEY (`id`) USING BTREE,
      KEY `idx_user_orgId` (`org_id`) USING BTREE,
      KEY `idx_user_orgPath` (`org_path`) USING BTREE,
      KEY `idx_code` (`channel_code`(191),`equipment_code`(191)) USING BTREE,
      KEY `idx_recordDate_orgPath_status` (`record_date`,`org_path`,`status`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='录像机完整性最后一次检测状态表';


drop table if exists mediator_video_diagnosis_record;
CREATE TABLE `mediator_video_diagnosis_record` (
       `id` bigint NOT NULL,
       `org_id` bigint NOT NULL COMMENT '机构id',
       `org_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构名称',
       `org_path` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '机构',
       `equipment_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '设备id',
       `channel_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '通道名称',
       `channel_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '通道序号',
       `device_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '设备名称',
       `device_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '设备id',
       `signal_lost` int NOT NULL DEFAULT '0' COMMENT '信号丢失  0: 正常 | 1：异常',
       `occlude` int NOT NULL DEFAULT '0' COMMENT '遮挡  0: 正常 | 1：异常',
       `brightness` int NOT NULL DEFAULT '0' COMMENT '亮度  0: 正常 | 1：异常',
       `color_cast` int NOT NULL DEFAULT '0' COMMENT '偏色  0: 正常 | 1：异常',
       `snowflake` int NOT NULL DEFAULT '0' COMMENT '雪花  0: 正常 | 1：异常',
       `stripe` int NOT NULL DEFAULT '0' COMMENT '条纹  0: 正常 | 1：异常',
       `contrast` int NOT NULL DEFAULT '0' COMMENT '对比度  0: 正常 | 1：异常',
       `blurry` int NOT NULL DEFAULT '0' COMMENT '模糊  0: 正常 | 1：异常',
       `equipment_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
       `alarm_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '报警/恢复时间',
       `is_alarm` int DEFAULT NULL COMMENT '报警状态标识',
       `detail_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '质量当前状态详情',
       `img_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '录像质量诊断图片',
       `create_by` varchar(125) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
       `create_time` datetime DEFAULT NULL COMMENT '创建人名称',
       `update_by` varchar(125) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改人名称',
       `update_time` datetime DEFAULT NULL COMMENT '修改时间',
       PRIMARY KEY (`id`),
       KEY `idx_videodiagnosisrecord_updatetime` (`update_time`),
       KEY `idx_code` (`equipment_code`(191),`channel_code`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

drop table if exists mediator_video_diagnosis_log;
CREATE TABLE `mediator_video_diagnosis_log` (
        `id` bigint NOT NULL,
        `create_by` varchar(125) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
        `create_time` datetime DEFAULT NULL COMMENT '创建人名称',
        `update_by` varchar(125) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改人名称',
        `update_time` datetime DEFAULT NULL COMMENT '修改时间',
        `org_id` bigint DEFAULT '0' COMMENT '机构',
        `org_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构名称',
        `org_path` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '机构',
        `alarm_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '报警/恢复时间',
        `channel_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '通道序号',
        `channel_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '通道的名称',
        `detail_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '质量当前状态详情',
        `equipment_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '录像机唯一标识',
        `is_alarm` int DEFAULT NULL COMMENT '报警状态标识',
        `video_diagnosis_id` bigint DEFAULT NULL COMMENT '视频质量诊断结果ID',
        `equipment_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
        `img_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '录像质量诊断图片',
        PRIMARY KEY (`id`) USING BTREE,
        KEY `idx_user_orgId` (`org_id`) USING BTREE,
        KEY `idx_user_orgPath` (`org_path`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='视频质量诊断结果';

drop table if exists iot_dvr_hard_disk_detection;
CREATE TABLE `iot_dvr_hard_disk_detection` (
       `id` bigint NOT NULL,
       `org_id` bigint DEFAULT '0' COMMENT '机构',
       `org_name` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构名称',
       `org_path` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '机构',
       `equipment_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '录像机的唯一标识',
       `equipment_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '录像机的名称',
       `check_time` datetime DEFAULT NULL COMMENT '检测时间',
       `check_status` int DEFAULT '0' COMMENT '检测状态；0：检测成功、1：检测失败',
       `state_update_time` datetime DEFAULT NULL COMMENT '状态更新时间',
       `detail_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '硬盘当前状态信息',
       `create_time` datetime DEFAULT NULL COMMENT '创建时间',
       `update_time` datetime DEFAULT NULL COMMENT '修改时间',
       `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
       `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
       PRIMARY KEY (`id`) USING BTREE,
       KEY `idx_user_orgId` (`org_id`) USING BTREE,
       KEY `idx_user_orgPath` (`org_path`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT=' 录像机硬盘检测表';

drop table if exists iot_dvr_hard_disk_detection_log;
CREATE TABLE `iot_dvr_hard_disk_detection_log` (
       `id` bigint NOT NULL,
       `org_id` bigint DEFAULT '0' COMMENT '机构',
       `org_name` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构名称',
       `org_path` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '机构',
       `equipment_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '录像机的唯一标识',
       `equipment_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '录像机的名称',
       `check_time` datetime DEFAULT NULL COMMENT '检测时间',
       `check_status` int DEFAULT '0' COMMENT '检测状态；0：检测成功、1：检测失败',
       `detail_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '硬盘当前状态信息',
       `status_update_time` datetime DEFAULT NULL COMMENT '状态更新时间',
       `video_recorder_hard_disk_detection_id` bigint DEFAULT NULL COMMENT '录像机硬盘检测ID',
       `create_time` datetime DEFAULT NULL COMMENT '创建时间',
       `update_time` datetime DEFAULT NULL COMMENT '修改时间',
       `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
       `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
       PRIMARY KEY (`id`) USING BTREE,
       KEY `idx_user_orgId` (`org_id`) USING BTREE,
       KEY `idx_user_orgPath` (`org_path`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT=' 录像机硬盘检测日志表';

drop table if exists iot_sensor;
CREATE TABLE `iot_sensor` (
          `id` bigint NOT NULL,
          `org_id` bigint DEFAULT NULL COMMENT '所属机构',
          `org_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属机构名称',
          `org_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属机构path',
          `host_code` varchar(64) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '视频物联网检测主机唯一标识,(此字段暂不可用)',
          `device_name` varchar(255) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '设备名称',
          `device_code` varchar(64) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '设备code',
          `device_type` varchar(10) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '设备类型编码',
          `device_id` bigint DEFAULT NULL COMMENT '资产设备id',
          `infos` varchar(2000) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '属性信息数组',
          `state` int DEFAULT NULL,
          `state_update_time` datetime DEFAULT NULL COMMENT '最后一次状态更新时间',
          `state_start_time` datetime DEFAULT NULL COMMENT '最后一次状态更新时间',
          `deleted` int DEFAULT NULL COMMENT '0:未删除，1：删除',
          `source` int DEFAULT NULL COMMENT '来源,0:资产设备，1：iot推送',
          `create_time` datetime DEFAULT NULL COMMENT '创建时间',
          `update_time` datetime DEFAULT NULL COMMENT '修改时间',
          `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
          `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
          PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci  COMMENT='动环传感器表';

drop table if exists iot_sensor_log;
CREATE TABLE `iot_sensor_log` (
          `id` bigint NOT NULL,
          `iot_sensor_id` bigint DEFAULT NULL,
          `org_id` bigint DEFAULT NULL COMMENT '所属机构',
          `org_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属机构名称',
          `org_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属机构path',
          `host_code` varchar(64) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '视频物联网检测主机唯一标识',
          `device_name` varchar(255) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '设备名称',
          `device_code` varchar(64) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '设备code',
          `device_id` bigint DEFAULT NULL COMMENT '资产设备id',
          `device_type` varchar(10) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '设备类型编码',
          `infos` varchar(2000) CHARACTER SET gbk COLLATE gbk_chinese_ci DEFAULT NULL COMMENT '属性信息数组',
          `state` int DEFAULT NULL,
          `state_update_time` datetime DEFAULT NULL COMMENT '最后一次状态更新时间',
          `source` int DEFAULT NULL COMMENT '来源,0:资产设备，1：iot推送',
          `create_time` datetime DEFAULT NULL COMMENT '创建时间',
          `update_time` datetime DEFAULT NULL COMMENT '修改时间',
          `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
          `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
          PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci  COMMENT='动环传感器日志表';

drop table if exists iot_device_detection;
CREATE TABLE `iot_device_detection` (
    `id` bigint NOT NULL,
    `org_id` bigint DEFAULT '0' COMMENT '机构',
    `org_name` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构名称',
    `org_path` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '机构',
    `equipment_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '录像机的唯一标识',
    `equipment_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '录像机的名称',
    `state` int DEFAULT '0' COMMENT '网络状态',
    `state_update_time` datetime DEFAULT NULL COMMENT '网络状态变更时间',
    `create_by` varchar(125) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
    `create_time` datetime DEFAULT NULL COMMENT '创建人名称',
    `update_by` varchar(125) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改人名称',
    `update_time` datetime NOT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY `idx_iot_device_detection_orgId` (`org_id`) USING BTREE,
    KEY `idx_iot_device_detection_orgPath` (`org_path`) USING BTREE,
    KEY `idx_iot_device_detection_code` (`equipment_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT=' 网络设备检测';

drop table if exists iot_device_detection_log;
CREATE TABLE `iot_device_detection_log` (
    `id` bigint NOT NULL,
    `org_id` bigint DEFAULT '0' COMMENT '机构',
    `org_name` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构名称',
    `org_path` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '机构',
    `equipment_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '录像机的唯一标识',
    `equipment_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '录像机的名称',
    `status` int DEFAULT '0' COMMENT '网络状态',
    `state_update_time` datetime DEFAULT NULL COMMENT '网络状态变更时间',
    `network_device_detection_id` bigint DEFAULT NULL COMMENT '网络设备检测ID',
    `create_by` varchar(125) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
    `create_time` datetime DEFAULT NULL COMMENT '创建人名称',
    `update_by` varchar(125) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改人名称',
    `update_time` datetime NOT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY `idx_user_orgId` (`org_id`) USING BTREE,
    KEY `idx_user_orgPath` (`org_path`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT=' 网络设备检测日志';

drop table if exists mediator_north_business_statistics;
CREATE TABLE `mediator_north_business_statistics` (
      `id` bigint NOT NULL,
      `org_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
      `date` date DEFAULT NULL COMMENT '日期',
      `channel_count` bigint DEFAULT NULL COMMENT '通道数量',
      `video_integrity_count` bigint DEFAULT NULL COMMENT '录像完整下数量',
      `video_days_count` bigint DEFAULT NULL COMMENT '录像视频天数数量',
      `video_diagnosis_count` bigint DEFAULT NULL COMMENT '视频质量诊断数量',
      `protection_count` bigint DEFAULT NULL COMMENT '防区数量',
      `protection_status_count` bigint DEFAULT NULL COMMENT '防区状态数量',
      `net_status_count` bigint DEFAULT NULL COMMENT '网络状态',
      `hard_disk_count` bigint DEFAULT NULL COMMENT '硬盘检测数量',
      `door_device_count` bigint DEFAULT NULL COMMENT '卷帘门状态(主机直连)数量',
      PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='北向业务数据信息统计';

drop table if exists mediator_north_base_statistics;
CREATE TABLE `mediator_north_base_statistics` (
      `id` bigint NOT NULL DEFAULT '20',
      `date` date DEFAULT NULL COMMENT '接收日期',
      `data_type` int DEFAULT NULL COMMENT '数据类型,0设备数,1通道数,2防区数,3iot产品信息,4iot产品属性,5iot设备基本信息',
      `receive_count` bigint DEFAULT NULL COMMENT '接收数量',
      `save_count` bigint DEFAULT NULL COMMENT '入库数量',
      PRIMARY KEY (`id`) USING BTREE,
      UNIQUE KEY `t_north_statistics_id_uindex` (`id`) USING BTREE,
      KEY `t_north_statistics_date_data_type_index` (`date`,`data_type`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='北向基础信息统计表';

drop table if exists mediator_north_error;
CREATE TABLE `mediator_north_error` (
     `id` bigint NOT NULL AUTO_INCREMENT,
     `create_time` datetime DEFAULT NULL COMMENT '数据生成时间',
     `error_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '错误的json数据',
     `error_msg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '错误描述',
     `interface_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '接口名称',
     `msg_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'msgId',
     `branch_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '省份branchId',
     PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=19483123 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='北向接口_存储错误数据';

drop table if exists mediator_north_msg_id;
CREATE TABLE `mediator_north_msg_id` (
      `msg_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用msgId作为主键',
      `interface_path` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
      `interface_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
      `msg_date` datetime DEFAULT NULL,
      `ymd` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '年月日',
      PRIMARY KEY (`msg_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

drop table if exists mediator_category;
CREATE TABLE `mediator_category` (
     `id` bigint NOT NULL AUTO_INCREMENT,
     `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
     `parent_id` bigint DEFAULT '0' COMMENT '上级分类',
     `create_by` varchar(125) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
     `create_time` datetime DEFAULT NULL COMMENT '创建人名称',
     `update_by` varchar(125) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改人名称',
     `update_time` datetime DEFAULT NULL COMMENT '修改时间',
     `code` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'code',
     `deleted` int DEFAULT '0' COMMENT '删除',
     `level` int DEFAULT NULL COMMENT '层级',
     `type` bit(1) DEFAULT NULL COMMENT '0:消防,1:安防',
     PRIMARY KEY (`id`) USING BTREE,
     KEY `idx_category_parentId` (`parent_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3713672266842158 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

delete from mediator_category;
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (1, '监控主机', 3713670431768576, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '14', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (1001, 'UPS', 3713670431768576, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '22', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (1002, '机柜', 3713670431768576, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '23', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (1003, '显示器', 3713670431768576, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '24', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (1004, '配电箱', 3713670431768576, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '25', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3396885624111104, '指纹验证设备', 3713670431768576, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '19', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3396885854699520, '人脸验证设备', 3713670431768576, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '20', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3396886337634304, '网络交换机', 3713670431768576, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '21', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712194117894144, '边缘巡检类', -1, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '1', 0, 1, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712194381643776, '物联网网关类', -1, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '2', 0, 1, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712194584903680, '物联采集类', -1, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '3', 0, 1, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712194930442240, '烟雾传感器', 3712194584903680, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '4', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712195941285888, '温湿度采集器', 3712194584903680, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '5', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712196701503488, '水浸传感器', 3712194584903680, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '6', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712197092999168, '门磁、窗磁传感器（Lora无线）', 3712194584903680, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '7', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712197283692544, '卷帘门门磁', 3712194584903680, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '8', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712197446270976, '地磁传感器', 3712194584903680, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '9', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712197694111744, '燃气报警器', 3712194584903680, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '10', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712197882822656, '断电检测传感器、总控、传输模块', 3712194584903680, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '11', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712198046793728, '蓝牙标签', 3712194584903680, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '12', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712198166114160, '智能电表', 3712194584903680, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '53', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712198166118400, '蓝牙接收器', 3712194584903680, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '13', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712198717341696, '传感器接入网关', 3712194381643776, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '2', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712198908510208, 'Lora无线网关', 3712194381643776, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '3', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712199107215360, '视频物联网监测主机', 3712194117894144, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '1', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3712199107215361, 'IOT BOX', 3712194117894144, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '1', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713670431768576, '主机设备类', -1, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '4', 0, 1, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713671711473664, '摄像头', 3713670431768576, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '18', 0, 2, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713671920926720, '报警主机', 3713670431768576, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '15', 0, 2, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672073773056, '对讲主机', 3713670431768576, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '16', 0, 2, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842112, '门禁主机', 3713670431768576, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '17', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842113, '报警主机传感器', -1, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '5', 0, 1, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842114, '紧急按钮', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '111', 0, 2, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842115, '微波', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '112', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842116, '红外', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '113', 0, 2, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842117, '红外微波双鉴', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '114', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842118, '烟感', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '115', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842119, '门磁', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '116', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842120, '入侵', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '117', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842121, '温度', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '118', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842122, '湿度', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '119', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842123, '水浸', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '120', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842124, '防拆', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '121', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842125, '震动', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '122', 0, 2, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842126, '破碎', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '123', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842127, '位移', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '124', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842128, '其它', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '125', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842129, '巡检主机传感器', -1, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '6', 0, 1, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842130, '卷帘门门磁', 3713672266842129, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '111', 0, 2, NULL);
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842131, '红外对射', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '126', 0, 2, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842132, '智能分析仪', 3713670431768576, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '26', 0, 2, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842133, '联动门', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '127', 0, 2, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842134, '安全门', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '128', 0, 2, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842135, '语音播报器', 3713672266842113, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '129', 0, 2, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842136, '安防设施', -1, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '201', 0, 1, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842137, '狼牙棒', 3713672266842136, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '202', 0, 2, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842138, '电警棍', 3713672266842136, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '203', 0, 2, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842139, '橡胶棍', 3713672266842136, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '205', 0, 2, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842140, '防暴钢叉', 3713672266842136, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '204', 0, 2, b'1');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842141, '消防设施', -1, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '301', 0, 1, b'0');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842142, '烟感器', 3713672266842141, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '302', 0, 2, b'0');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842144, '水喷淋', 3713672266842141, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '303', 0, 2, b'0');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842145, '消防广播', 3713672266842141, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '304', 0, 2, b'0');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842146, '广播联动器', 3713672266842141, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '305', 0, 2, b'0');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842147, '声光报警器', 3713672266842141, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '306', 0, 2, b'0');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842148, '禁烟标牌', 3713672266842141, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '307', 0, 2, b'0');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842149, '消防栓箱', 3713672266842141, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '308', 0, 2, b'0');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842150, '1211灭火器', 3713672266842141, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '309', 0, 2, b'0');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842151, '干粉灭火器', 3713672266842141, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '310', 0, 2, b'0');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842152, '悬挂式干粉灭火器', 3713672266842141, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '311', 0, 2, b'0');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842153, '防烟面罩', 3713672266842141, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '312', 0, 2, b'0');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842154, '紧急疏散标牌', 3713672266842141, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '313', 0, 2, b'0');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842155, '紧急消防报警器', 3713672266842141, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '314', 0, 2, b'0');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842156, '火灾报警控制器', 3713672266842141, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '315', 0, 2, b'0');
INSERT INTO `mediator_category`(`id`, `name`, `parent_id`, `create_by`, `create_time`, `update_by`, `update_time`, `code`, `deleted`, `level`, `type`) VALUES (3713672266842157, '防火门', 3713672266842141, NULL, '2024-02-27 14:45:16', NULL, '2024-02-27 14:45:16', '316', 0, 2, b'0');


drop table if exists iot_alarm_data;
CREATE TABLE `iot_alarm_data` (
    `id` bigint NOT NULL,
    `rule_id` bigint DEFAULT NULL COMMENT '规则id',
    `org_id` bigint DEFAULT NULL COMMENT '机构id',
    `device_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '设备名称',
    `device_id` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '设备id',
    `source_type` int DEFAULT NULL COMMENT '报警源类型(设备类型)：4：烟雾传感器；5： 温湿度采集器；6：水浸； 7：门磁、窗磁；8：卷帘门门磁；9：地磁；10燃气报警器；50：报警防区',
    `source_type_des` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '报警源类型(设备类型) 中文',
    `field_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '属性code',
    `time` datetime DEFAULT NULL COMMENT '告警时间',
    `end_time` datetime DEFAULT NULL COMMENT '告警结束时间',
    `operator` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '操作符，GT(大于)、GTE(大于等于)、LT(小于)、LTE(小于等	于)、EQUALS(等于)',
    `value` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '对比值key',
    `value_text` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '对比值value',
    `content` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '告警内容',
    `alarm_value` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '告警值',
    `is_do` int DEFAULT NULL COMMENT '0未处理1已处理',
    `data_type` int DEFAULT NULL COMMENT '0动环告警 1主机类告警',
    `do_time` datetime DEFAULT NULL COMMENT '处理时间',
    `do_type` tinyint DEFAULT '0' COMMENT '处理方式:0:为处理,1:(暂无)2:误报，3：正常告警，4：报修',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime DEFAULT NULL COMMENT '修改时间',
    `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='告警数据表';

drop table if exists iot_alarm_rule;
CREATE TABLE `iot_alarm_rule` (
  `id` bigint NOT NULL DEFAULT '0',
  `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规则名称',
  `enabled` int NOT NULL DEFAULT '0' COMMENT '是否启用',
  `isdeleted` int NOT NULL DEFAULT '0' COMMENT '是否删除',
  `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'alarm：告警，inspection：一键巡检',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注信息',
  `create_by` varchar(125) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT NULL COMMENT '创建人名称',
  `update_by` varchar(125) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改人名称',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='告警规则表';

drop table if exists iot_alarm_rule_express;
CREATE TABLE `iot_alarm_rule_express` (
  `id` bigint NOT NULL DEFAULT '0',
  `rule_id` bigint NOT NULL DEFAULT '0' COMMENT '规则编码',
  `fieldCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '属性code',
  `operator` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '操作符，GT(大于)、GTE(大于等于)、LT(小于)、LTE(小于等\r\n于)、EQUALS(等于)、STARTS_WITH(以什么开始)、\r\nENDS_WITH(以什么结束)、CONTAIN(包含)',
  `value` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '对比值',
  `value_text` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '对比值',
  `sms_type` int NULL DEFAULT NULL COMMENT '是否需要发送短信：0不需要，1需要',
  `source_type` int NOT NULL COMMENT '报警源类型：4：烟雾传感器；5： 温湿度采集器；6：水浸； 7：门磁、窗磁；8：卷帘门门磁；9：地磁；10燃气报警器；50：报警防区',
  `week_day` int DEFAULT NULL COMMENT '规则使用周期：1.周一，2.周二，3.周三，4.周四，5.周五，6.周六，7.周日',
  `start_time` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '开始时间如：07:30',
  `end_time` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '结束时间如：16:00',
  `create_by` varchar(125) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT NULL COMMENT '创建人名称',
  `update_by` varchar(125) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改人名称',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `rule_id` (`rule_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='告警规则表达式表';

drop table if exists iot_alarm_rule_source;
CREATE TABLE `iot_alarm_rule_source` (
     `id` bigint NOT NULL,
     `org_id` bigint DEFAULT NULL COMMENT 'value_type=Device时有值为设备所属机构Id，否则为空',
     `rule_id` bigint DEFAULT NULL COMMENT '报警规则编码',
     `source_type` int DEFAULT NULL COMMENT '报警源类型：4:烟雾传感器；5:温湿度采集器；6:水浸,7:门磁:窗磁,8:卷帘门门磁；9:地磁,10:燃气报警器,50:报警防区',
     `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'value_type=Device时有值为设备Id,否则为空',
     `value_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'AllDevice:所有设备，Device:单个设备',
     `create_by` varchar(125) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
     `create_time` datetime DEFAULT NULL COMMENT '创建人名称',
     `update_by` varchar(125) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改人名称',
     `update_time` datetime DEFAULT NULL COMMENT '修改时间',
     PRIMARY KEY (`id`) USING BTREE
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='告警规则与设备源关系表';

drop table if exists iot_alarm_system_field;
CREATE TABLE `iot_alarm_system_field` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `source_type` int NOT NULL COMMENT '报警源类型(设备类型)：4：烟雾传感器；5： 温湿度采集器；6：水浸； 7：门磁、窗磁；8：卷帘门门磁；9：地磁；10燃气报警器；50：报警防区',
  `source_type_des` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '报警源类型(设备类型) 中文',
  `sys_field_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '系统属性code（报警类型编码,全表唯一）',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '系统属性名称',
  `specs` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '属性规格信息，eg:{ \r\n"0": "门已关闭", \r\n"1": "门已打开" \r\n}',
  `operators` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '该属性拥有哪些操作符eg:{ \r\n"GT": "大于", \r\n"LT": "小于" \r\n}\r\n\r\nGT(大于)、GTE(大于等于)、LT(小于)、LTE(小于等\r\n于)、EQUALS(等于)、STARTS_WITH(以什么开始)、\r\nENDS_WITH(以什么结束)、CONTAIN(包含)',
  `type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '数据值类型，eg：”FLOAT“、"ENUM"',
  `type_des` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '数据值类型中午描述，eg：”浮点型“、"枚举"',
  `unit` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '属性单位，非必填',
  `enable` int NOT NULL DEFAULT '0' COMMENT '是否启用0 是1否',
  `create_by` varchar(125) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT NULL COMMENT '创建人名称',
  `update_by` varchar(125) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改人名称',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=127 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统报警属性字段表';

delete from iot_alarm_system_field;
INSERT INTO `iot_alarm_system_field` (`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (1, 4184, '水浸', '4184', '水浸告警', '{\"0\": \"正常\",\"1\": \"告警\"}', '{\"EQUALS\": \"等于\"}', 'ENUM', '枚举', NULL, 1, '2022-07-26 16:14:26', NULL, '2022-07-26 16:14:30', NULL);
INSERT INTO `iot_alarm_system_field` (`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (2, 4182, '烟感', '4182', '烟雾告警', '{\"0\": \"正常\",\"1\": \"告警\"}', '{\"EQUALS\": \"等于\"}', 'ENUM', '枚举', NULL, 1, '2022-07-26 16:14:26', NULL, '2022-07-26 16:14:30', NULL);
INSERT INTO `iot_alarm_system_field` (`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (3, 4183, '温湿度', '4183_1', '环境温度', '{}', '{\"GT\": \"大于\",\"GTE\": \"大于等于\",\"LT\": \"小于\",\"LTE\": \"小于等于\",\"EQUALS\": \"等于\"}', 'FLOAT', '浮点型', '%RH', 1, '2022-07-26 16:14:26', NULL, '2022-07-26 16:14:30', NULL);
INSERT INTO `iot_alarm_system_field` (`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (4, 4183, '温湿度', '4183_2', '环境湿度', '{}', '{\"GT\": \"大于\",\"GTE\": \"大于等于\",\"LT\": \"小于\",\"LTE\": \"小于等于\",\"EQUALS\": \"等于\"}', 'FLOAT', '浮点型', '°C', 1, '2022-07-26 16:14:26', NULL, '2022-07-26 16:14:30', NULL);
INSERT INTO `iot_alarm_system_field` (`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (5, 41885, '燃气', '41885', '可燃气体告警', '{\"0\": \"正常\",\"1\": \"告警\"}', '{\"EQUALS\": \"等于\"}', 'ENUM', '枚举', '', 1, '2022-07-26 16:14:26', NULL, '2022-07-26 16:14:30', NULL);
INSERT INTO `iot_alarm_system_field` (`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (6, 4188, '门磁', '4188', '门磁开关状态', '{\"0\":\"门已打开\",\"1\":\"门已关闭\"}', '{\"EQUALS\": \"等于\"}', 'ENUM', '枚举', '', 1, '2022-07-26 16:14:26', NULL, '2022-07-26 16:14:30', NULL);
INSERT INTO `iot_alarm_system_field` (`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (7, 4181, '红外', '4181', '红外告警', '{\"0\": \"正常\",\"1\": \"告警\"}', '{\"EQUALS\": \"等于\"}', 'ENUM', '枚举', '', 1, '2022-07-26 16:14:26', NULL, '2022-07-26 16:14:30', NULL);


DELETE FROM `sys_dict_type` WHERE `dict_type` in('video_integrity_state','video_days_state','video_diagnosis_state');
DELETE FROM `sys_dict_data` WHERE `dict_type` in('video_integrity_state','video_days_state','video_diagnosis_state');
INSERT INTO `sys_dict_type` ( `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '录像完整性状态', 'video_integrity_state', '0', '超级管理员', '2024-02-22 18:00:41', '', NULL, NULL);
INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '录像存储天数状态', 'video_days_state', '0', '超级管理员', '2024-02-22 18:02:56', '', NULL, NULL);
INSERT INTO `sys_dict_type` ( `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('视频诊断结果', 'video_diagnosis_state', '0', '超级管理员', '2024-02-22 18:04:19', '', NULL, NULL);
INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 0, '完整', '0', 'video_integrity_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:01:50', '', NULL, NULL);
INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 1, '部分丢失', '1', 'video_integrity_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:02:01', '', NULL, NULL);
INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 2, '全部丢失', '2', 'video_integrity_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:02:08', '', NULL, NULL);
INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 0, '完整', '0', 'video_days_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:03:41', '', NULL, NULL);
INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 1, '不完整', '1', 'video_days_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:03:48', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 0, '正常', '0', 'video_diagnosis_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:04:49', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 1, '异常', '1', 'video_diagnosis_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:04:57', '', NULL, NULL);

DELETE from sys_role_menu WHERE menu_id in (SELECT id from sys_menu WHERE `menu_name`='物联感知' or parent_id in (SELECT id from sys_menu WHERE `menu_name`='物联感知'));
DELETE from sys_menu WHERE `menu_name`='物联感知' or parent_id in (SELECT id from (SELECT id from sys_menu WHERE `menu_name`='物联感知') a);

DELETE from `sys_menu` where id in (01747911340288892930,1749608698379771905,01762681378201595906,01765943098126823425,01762681622628855809,01762681985838804994,01747912241556742146,01760840909641408513,01749628217843228674,01761949441304440833,01764951130651414529,01765206797656702978,1767106962654666753);
INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (01747911340288892930, '物联感知', 0, 27, 'iot', NULL, NULL, 1, 0, 'M', '0', '0', '', '1', 'job', NULL, '超级管理员', '2024-01-18 17:18:32', '超级管理员', '2024-02-01 09:34:05', '');
INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1749608698379771905, '物联•感知', 0, 5, '‘’', NULL, NULL, 1, 0, 'M', '0', '0', '', '0', NULL, NULL, '超级管理员', '2024-01-23 09:44:10', '超级管理员', '2024-01-23 09:44:26', '');

INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (01762681378201595906, '录像诊断', 1749608698379771905, 13, '/iot/videoDiagnosis', NULL, NULL, 1, 0, 'C', '0', '0', 'appiot:videoDiagnosis', '0', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEEAAABBCAYAAACO98lFAAAACXBIWXMAAAsSAAALEgHS3X78AAACD0lEQVR4nO2by1HDMBCGfxjuoQMyowKgA+CqU0pIB8lBd8JdM4QKCB3gi87pgFCAZkIHUEEYZWXGhDxkm8Gxd79b/FDkL7urSBqfrFYrcOeUuwCIBIK9BIgEgr0EiASCvQSIBIK9BIgEgr0EiASCvYTAWfGDcqYPoN9cd0qz8Np+1G3keyqtnJkCGP33U/wBj17bcZ1m1unQYgGBkXJmUqeBvCa0VUBO/UjoAL2yjxDqn3Jmjs3CyAHlzHmMnLv8cVlJUM4MAYT6cVE8fgwSMgDTPefDLzerEvI5ypmr+B3X2843LSHz2g4OXaScuQHwWrbxGPqTQ4W/6cK4SLnIa5t0XRHlTMj7ZcrI17SEcQzVvShnZqkNhqhRzgRpD6kp1HQ6hE7OY6d3EUL6MqWxWPieynbiGApjb1fBqkCleQ/7WSREAsFeAkQCwV4CRALBXgJEAsFeAkQCwV4CRALBXgI6KCGsHr+XvalTEry2QUJYpLkH8Jl6X+fSIexNem0nUUaWck9na4LXdhkXcW8PpUjnC2NIEa9tf1+KsBkdYooEGc+b51gNkbFeDGOKvOXH2e1FojCKxNXpzkRC8nBYxGu73s/I0+FXnrSM5M2ZbeQSxsUcaRlZ3G+szI/Xf5Qzg/gnoy28VNmn3IT9O1CQWSTBXgJEAsFeAkQCwV4CRALBXgJEAsFeAkQCwV4CAHwBGKFz+db+wtQAAAAASUVORK5CYII=', NULL, '超级管理员', '2024-02-28 11:30:41', '超级管理员', '2024-02-28 11:38:43', '');
INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (01762681622628855809, '硬盘诊断', 1749608698379771905, 14, '/iot/dvrDisk', NULL, NULL, 1, 0, 'C', '0', '0', 'appiot:dvrDisk', '0', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEEAAABBCAYAAACO98lFAAAACXBIWXMAAAsSAAALEgHS3X78AAACmElEQVR4nO2ZMXLbMBBFfzzp5YqtfQM5N1BOYKVg75ZVnBNER3DHVj2b3CDJCaIj2C0bKydQBlyAYSRQHiwWznh2f49v6nkB7F+8OxwO0K4L7QBgEEjqIcAgkNRDgEEgqYcAg0BSDwEGgaQeAgwC6f1r/JGqa+8APABYJCz7DWDT181DwU8bVDxFVl27AvA9w+JLaRCvsR3u//P6F1W0EqquvQTwLGD1oa+bnYBPVKUrYS3kcyfkE9VbgSDlE1Wx7SC4FYKKbYmSlXAj7LcS9htVEsIjgCchr58AtkJeJ1I/bYa1zST1EGAQSOohICdF+j7AdXKXiUu3fd08nvFdMa7DvffdJ64bxL4dqq51jcuStRj42NfNj4inS4ufmZ4uel9zQLC2Q9W16wwAiGUBX1lcAPCzClbG4J4Jub382v9oSU+8NQiLiIdEW7ysuvY6dVEyhKprbxLHZHM6HpZIJcVkmJxKkMr2Sw803AgSYMGByYEgme2Dl+TQ5DZ1AQdCal9wTuGaFJ0TRA7ds+I0SyuhatiFXsFNk6uudfd78qE245vUK6iP0rDsQFIPAQaB9M/B6DPBlvFmeN/XzewMMOMt8iVfTuA68R0PRt9u7jKaluhI3DdEv5ieTp/6uvkW8d0A+CrhO90Om8yuba7hyX1L3JT2nULIDTBzvUNuT3ESivy2zW2zl6GpGiD4kr3KNL3yHzdKMGyVSJyjb6iEUg+nUpng+EeLvnFKQ7g9Kl2p/9gYioSqNmj4vgv/0TmjsmOt8fe2EfOdbDXJFLtwvq4SJELLVCG8SPuGZCj90Et9gh9qSGg/7RVK+PoTXQrE4Ks+RcKyA0k9BBgEknoIMAgk9RBgEEjqIcAgkNRDgEEgqYcAgwAAwB8jC71/k/cB6QAAAABJRU5ErkJggg==', NULL, '超级管理员', '2024-02-28 11:31:39', '超级管理员', '2024-02-28 11:41:48', '');
INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (01762681985838804994, '动环诊断', 1749608698379771905, 15, '/iot/donghuan', NULL, NULL, 1, 0, 'C', '0', '0', 'appiot:donghuan', '0', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAMKADAAQAAAABAAAAMAAAAAD4/042AAAD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kr8KD9rUcqNefUPG25WpWqYfrd73DP8Uo5JfPYhIcHCvZ8TNQlUsOsgflVWfVPW+j+p1LP2ToV5VWR0MzpfjyM7Df7H4D/jCNsP/6NKgAAAAASUVORK5CYII=', NULL, '超级管理员', '2024-02-28 11:33:06', '超级管理员', '2024-02-28 11:40:18', '');
INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (01764951130651414529, '物联看板', 1749608698379771905, 16, '/iot/board', NULL, NULL, 1, 0, 'M', '0', '0', NULL, '0', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAG0klEQVR4Xu1ba2wUVRT+zsxSkFCDFAQSCA9BXp0+gALb3Y3gDwVCIkaIJBZhtlVCDBF/kEAiAaJGjSbEV4TQ7hAe8QcaMUIUQ0Jxty3yartTKklJWiIogfKIEKl0Z46ZLVu2y3ZnZhdsCzM/557nN+fee865dwhpPlO/ahiUM1D/AqBlALeBqVw837qhcsu8SJoiLbF16mVacpdhWyZ6yZLWJETeQHgfUacRHRSET4MrpXXpyrTC96D1pgXAjO0nhw7M6n/lPoMZt4J+KduKI+nQFCi1g7NZvAIiVxf+DPSmBcAcpXZsP7iakzkRlKW0ZFoB5GHoTcvYh2GIA4AFBB4G8E4EJALvqQgvgEALCBgLoHNBY+BslSytNuitfgnfTnUHMyZY+LgpSKgpJOe+aUevR1G/JmBynNCbDLQIrB0M+gsOxSvrjIAi5fiIATxgL4ie78aaE0FZmmXHEK+i1hJQkAkADNSFZKnQlt6AeoIIM7vR+wu4vSTonx7dxaIAeCvC40mko2CMSmFsjwAA5tqgP2+6HQB8inocQFF3vjDjvAD4fvVLf9DcTUdckTFD64kw1eRLPTIAdPjJp4Mt3xWRZ6daKjDKTcOU0RT0S88adN0mQsCNoCw9FZ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EYMgA9ovnW+XEa7c+JbwVTGWmMoA2Zhy+QK1LExsrtqeA5QsUcR5riBRWy4XGKW308ZbXzydR+MnOXGdNXxAqy+/sUBcrtQUiXLV2ZOiEsqqVUkVGu4BXUTcRsNmOYgbmhWSpMsZT3JerQQcAJwKcKeCsAc4i6OwCzjb4+OYB7vLwYpdI31tOhJgj7aRNjD+SSudUR4furpLv1fLRK/osNlnuKQCIaPxyTVne/owywWgqq6ibABi1gMnDbTrT3vhOTlxH520QFlnpB4BxIPFIy5BTHFBLBOLXADLtB4BwOLRS+iDRYNu1gJnLfW08CQDh6wDF2kyNQVma1tecsmOvNxA+S0STDB7jwif5Amo1CO5OISzOCPqnnrYjtK/QenbUzxFc906YmREij9KwXgB/GOdEc0TTXqkpK7BVevZ2ELyB+tnUcUQ/OmarzlhHc5XmwRpuNsdNg9h4EwNJL0T3dmeT2DeagGe6vGe06txvfPSfIY8SXigw/QAy6dj2Qc+TmWz8/AF2LQyVTj3c+deYO1D3oouE3QANe0T87M6NSxB5WfD1vKMGQZcfJz0VoWwI2aXE4gsATyfC8EcCDMYlBk4y4WDbnX+Nq/b/xPz6DwTgA56aU7kzAAAAAElFTkSuQmCC', NULL, '超级管理员', '2024-03-05 17:49:58', '', NULL, '');
INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (01765943098126823425, '告警中心', 1749608698379771905, 12, '/iot/alarmCenter', NULL, NULL, 1, 0, 'C', '0', '0', 'appiot:alarmCenter', '0', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAAAXNSR0IArs4c6QAACyxJREFUeF7tm3uQHFUVh3+nd/pOICVqAZKETM8mhJ2eZFEhIOCjRIqUkkQNoFEKRB5K8dAUWIAgKGCBRrFiochbBRGkeClvEKh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zUt9/jOkpALs2NMJOIEzMV6XyhaaOpYQGqDh04rOFdvNXOc++0b4jF7yxTaXkGm4NAXwfQlzXB5wQJm1Xj2zDAIsQ1WcMOB7wPk3d2RbW7zDjURA/mbYL1zccclUdmgIYddD3U/8ewIh3s2MA1XfJUWwX6Pv3PiPO5ig6WtG3YwCrD/c04kz1MdtG+rZatmMAVdFmDNjYjENRU1DNjNnSt3CrDPB/o9KITmb6QjrvPNpIn3bJdiwClUOvzccH5ah4uMHSQNO5u3ZA7ChA5dCGufEFuuZezaDA7zh8TqvjdOc1m/hsBzyls+MAy45lkvHvELP65KDmSycCbnI17VL/mcR2AWlUb9cAVIar48YzhK4OOC0CtN13fJ+2XoxqVrP71EZhNCPfVQCbcaDTfXoAI96BHsAewIgEInbvRWAPYEQCEbv3IrAHMCKBiN17ERgR4P8B0KFQjRED7wQAAAAASUVORK5CYII=', NULL, '超级管理员', '2024-03-08 11:31:42', '', NULL, '');
INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1767106962654666753, 'UPS诊断', 1749608698379771905, 12, '/iot/ups', NULL, NULL, 1, 0, 'C', '0', '0', 'appiot:ups', '0', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAABCCAYAAAACPxW5AAAJVklEQVRoge1be3BU1Rn//e4mGEJAeShqq4gS1IBFebWKMGr/8VEfReNMLYUE1FanOm0HOrSQLJtQwVdta60VrVlQdJx06qNabTsKFcSZRgGlIAViMUyjAUSFJEB29/46597N827Ye3c3KB1/w50s557zfd9vzznfOd93zhJHCVpUdp1sPAWCtliWV1XzzNHQ3OcEBTBRMXOOZYUe7VaesBdaoeVLGIHdl/r7lKDCZSdLeBLkN3upsoO2bmJ1tK6vbOgTgvrpNQNRMGSegAUgrfRGKIp4aBF/8YcPcm1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htYwPuboRei3QV1yh6cMuB1Yjxb38pl+u7zQq+nS1y8vF4Ly6crhD/n1DYT8hQNcjfOzd0jJ09PtNtyxxL3/YM/86fDyHbxyRFTFlxc86KQWOpPqk/sS84PvyER3LUTQeLgocPbP21Lm5OxPiyohJS7XtxV7/zhqPP8twlIkGeNbf/4ZvoL48uWxcjYDEib/VvUO7Q9eR17hDcLmTN0yv6Lr6waIyv3t8RaLoWU/a14swibJcIYcf4Uf20KCt3HD4xMl6A5hlvjO204cEntHiYOTYXU6zm7L5gE09qXnJpOsGr5MOHAp+6TDiZKMTJdLCVpB85guT/24GoQZ2dM0hhy80I3En9nHfRs8IxJKnSES8DbAL5OMhH4Ggkj0Y/ItskU/pqxJbbtxoAmeh93kRusZglHhkvOnJfMMOSQ6WU8MyfxUf7VlB7M2Ky9H0K1v3PSDCYSd759P8O1J8xoMG1NNA+YQOFGkls7bM3YwM50xHdk4SGAPgK2FCg+Dyy93cmtONmxt1YFSzpNvNQNnt2eM+Re7lolJ1lk3V5aZA8rmk9oHsjgZ3vDTgGn3+LOSWSQNnTn3IyuPdeO3P52KVxaZGvAbSRvDHyb3+I/eNXMBoyfNgXkmT5bmV3DXQCixmOmqtBn1xk193snoSBvMkKaaMJcSSNADobMLxv0KUlzOvw+hDq0Hf4blqz8JNnUTMSLAZicivEa5uB1cPKdqWNIrQOcPfLa3og5APA/uROLCihCZmgAAAAASUVORK5CYII=', NULL, '超级管理员', '2024-03-11 16:36:28', '', NULL, '');

INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (01747912241556742146, '硬盘诊断', 1747911340288892930, 6, 'videoRecorder', 'iot/videoRecorder', NULL, 1, 0, 'C', '0', '0', 'iot:videoRecorder', '1', 'chart', NULL, '超级管理员', '2024-01-18 17:22:07', '超级管理员', '2024-02-23 09:39:39', '');
INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (01760840909641408513, '录像诊断', 1747911340288892930, 5, 'videoDiagnosis', 'iot/videoDiagnosis', NULL, 1, 0, 'C', '0', '0', 'iot:videoDiagnosis', '1', 'sentinel', NULL, '超级管理员', '2024-02-23 09:37:19', '超级管理员', '2024-02-23 09:39:31', '');
INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (01749628217843228674, '告警规则', 1, 100, 'warnRule', 'warnRule/index', NULL, 1, 0, 'C', '0', '0', NULL, '1', 'bug', NULL, '超级管理员', '2024-01-23 11:00:48', '', NULL, '');
INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (01761949441304440833, '动环诊断', 1747911340288892930, 7, 'sensorData', 'iot/sensorData', NULL, 1, 0, 'C', '0', '0', 'iot:sensorData', '1', 'nested', NULL, '超级管理员', '2024-02-26 11:01:32', '超级管理员', '2024-02-29 17:45:01', '');
INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (01765206797656702978, '告警中心', 1747911340288892930, 4, 'alarmData', 'warn/index', NULL, 1, 0, 'C', '0', '0', 'iot:warn:list', '1', 'row', NULL, '超级管理员', '2024-03-06 10:45:13', '超级管理员', '2024-03-06 10:48:03', '');


update sys_menu set component ='iot/subSystem/index' WHERE menu_name='布撤防情况跟踪' and platform_type=1;
UPDATE sys_menu set path='/iot/subsystem' WHERE path='/protection' and platform_type=0;

delete from sys_dict_type where dict_type in ('sensor_alarm_status','sensor_device_type');
delete from sys_dict_data where dict_type in ('sensor_alarm_status','sensor_device_type');
INSERT INTO `sys_dict_type`(`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('动环传感器告警状态', 'sensor_alarm_status', '0', '超级管理员', '2024-03-01 09:12:16', '', NULL, NULL);
INSERT INTO `sys_dict_type`(`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('动环传感器设备类型', 'sensor_device_type', '0', '超级管理员', '2024-03-01 09:31:11', '', NULL, NULL);

-- 给各级保卫干部，及网点所有人增加权限
DELETE from sys_role_menu WHERE menu_id in (01747911340288892930,1749608698379771905,01765943098126823425,01747912241556742146,01749628217843228674,01752868420296888322,01760840909641408513,01761949441304440833,01762681378201595906,01762681622628855809,01762681985838804994,01764951130651414529,01765206797656702978,1767106962654666753);
INSERT into sys_role_menu SELECT id,01747911340288892930 from sys_role WHERE id in(116,118,120,121,122,128,143,144,145,146,151);
INSERT into sys_role_menu SELECT id ,1749608698379771905 from sys_role WHERE id in(116,118,120,121,122,128,143,144,145,146,151);
INSERT into sys_role_menu SELECT id,01747912241556742146 from sys_role WHERE id in(116,118,120,121,122,128,143,144,145,146,151);
INSERT into sys_role_menu SELECT id ,01749628217843228674 from sys_role WHERE id in(116,118,120,121,122,128,143,144,145,146,151);
INSERT into sys_role_menu SELECT id ,01752868420296888322 from sys_role WHERE id in(116,118,120,121,122,128,143,144,145,146,151);
INSERT into sys_role_menu SELECT id ,01760840909641408513 from sys_role WHERE id in (116,118,120,121,122,128,143,144,145,146,151);
INSERT into sys_role_menu SELECT id ,01761949441304440833 from sys_role WHERE id in(116,118,120,121,122,128,143,144,145,146,151);
INSERT into sys_role_menu SELECT id ,01762681378201595906 from sys_role WHERE id in(116,118,120,121,122,128,143,144,145,146,151);
INSERT into sys_role_menu SELECT id ,01762681622628855809 from sys_role WHERE id in(116,118,120,121,122,128,143,144,145,146,151);
INSERT into sys_role_menu SELECT id ,01762681985838804994 from sys_role WHERE id in(116,118,120,121,122,128,143,144,145,146,151);
INSERT into sys_role_menu SELECT id ,01764951130651414529 from sys_role WHERE id in(116,118,120,121,122,128,143,144,145,146,151);
INSERT into sys_role_menu SELECT id ,01765206797656702978 from sys_role WHERE id in(116,118,120,121,122,128,143,144,145,146,151);
INSERT into sys_role_menu SELECT id ,01765943098126823425 from sys_role WHERE id in(116,118,120,121,122,128,143,144,145,146,151);
INSERT into sys_role_menu SELECT id ,1767106962654666753 from sys_role WHERE id in(116,118,120,121,122,128,143,144,145,146,151);
INSERT INTO `sys_dict_data`(`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (0, '正常', '0', 'sensor_alarm_status', NULL, 'default', 'N', '0', NULL, now(), NULL, NULL, NULL);
INSERT INTO `sys_dict_data`(`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1, '告警', '1', 'sensor_alarm_status', NULL, 'default', 'N', '0', NULL, now(), NULL, NULL, NULL);
INSERT INTO `sys_dict_data`(`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (100, '温湿度采集器', '4183', 'sensor_device_type', NULL, 'default', 'N', '0', NULL, now(), NULL, NULL, NULL);
INSERT INTO `sys_dict_data`(`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (200, '红外传感器', '4181', 'sensor_device_type', NULL, 'default', 'N', '0', NULL, now(), NULL, NULL, NULL);
INSERT INTO `sys_dict_data`(`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (300, '烟雾传感器', '4182', 'sensor_device_type', NULL, 'default', 'N', '0', NULL, now(), NULL, NULL, NULL);
INSERT INTO `sys_dict_data`(`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (400, '水浸传感器', '4184', 'sensor_device_type', NULL, 'default', 'N', '0', NULL, now(), NULL, NULL, NULL);
INSERT INTO `sys_dict_data`(`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (500, '门磁、窗磁传感器', '4188', 'sensor_device_type', NULL, 'default', 'N', '0', NULL, now(), NULL, NULL, NULL);
INSERT INTO `sys_dict_data`(`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (600, '燃气报警器', '41885', 'sensor_device_type', NULL, 'default', 'N', '0', NULL, now(), NULL, NULL, NULL);

delete from sys_dict_type where dict_type in ('app_sensor_device_type');
delete from sys_dict_data where dict_type in ('app_sensor_device_type');
INSERT INTO `sys_dict_type` ( `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 'App动环传感器设备类型', 'app_sensor_device_type', '0', '超级管理员', '2024-03-04 16:21:31', '', NULL, '值与web应保持一致，文本有差异');
INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 0, '温湿度', '4183', 'app_sensor_device_type', NULL, 'default', 'N', '0', '超级管理员', '2024-03-04 16:22:31', '', NULL, NULL);
INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 1, '红外', '4181', 'app_sensor_device_type', NULL, 'default', 'N', '0', '超级管理员', '2024-03-04 16:22:41', '超级管理员', '2024-03-04 16:22:45', NULL);
INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 2, '烟感', '4182', 'app_sensor_device_type', NULL, 'default', 'N', '0', '超级管理员', '2024-03-04 16:22:58', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 3, '水浸', '4184', 'app_sensor_device_type', NULL, 'default', 'N', '0', '超级管理员', '2024-03-04 16:23:16', '', NULL, NULL);
INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 4, '门窗磁', '4188', 'app_sensor_device_type', NULL, 'default', 'N', '0', '超级管理员', '2024-03-04 16:23:38', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 5, '燃气', '41885', 'app_sensor_device_type', NULL, 'default', 'N', '0', '超级管理员', '2024-03-04 16:23:49', '', NULL, NULL);

delete from sys_dict_type where dict_type in ('iot_device_net_status');
delete from sys_dict_data where dict_type in ('iot_device_net_status');
INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '物联设备网络状态', 'iot_device_net_status', '0', '超级管理员', '2024-02-23 10:23:34', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 0, '正常', '0', 'iot_device_net_status', NULL, 'default', 'N', '0', '超级管理员', '2024-02-23 10:24:07', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 1, '异常', '1', 'iot_device_net_status', NULL, 'default', 'N', '0', '超级管理员', '2024-02-23 10:24:16', '', NULL, NULL);
INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 2, '中断', '2', 'iot_device_net_status', NULL, 'default', 'N', '0', '超级管理员', '2024-02-23 10:24:24', '', NULL, NULL);


-- 调整统计报表菜单名称
UPDATE sys_menu m set m.menu_name='行社全面检查情况表' WHERE m.menu_name ='行社全面检查统计报表';
UPDATE sys_menu m set m.menu_name='外包履职评价情况表' WHERE m.menu_name ='外包履职评价统计表';
UPDATE sys_menu m set m.menu_name='报警测试情况表' WHERE m.menu_name ='报警测试报表';
UPDATE sys_menu m set m.menu_name='备用电源维护情况表' WHERE m.menu_name ='备用电源维护报表';
UPDATE sys_menu m set m.menu_name='离行式自助银行巡检情况表' WHERE m.menu_name ='离行式自助银行巡检报表';
UPDATE sys_menu m set m.menu_name='网点负责人自查情况表' WHERE m.menu_name ='网点负责人自查报表';

delete from sys_dict_type where dict_type in ('app_video_diagnosis_status','app_dvr_recorder_status');
delete from sys_dict_data where dict_type in ('app_video_diagnosis_status','app_dvr_recorder_status');
INSERT INTO  `sys_dict_type` ( `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 'APP录像诊断状态', 'app_video_diagnosis_status', '0', '超级管理员', '2024-03-07 15:41:41', '', NULL, NULL);
INSERT INTO  `sys_dict_type` ( `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 'App硬盘诊断状态', 'app_dvr_recorder_status', '0', '超级管理员', '2024-03-07 16:22:14', '', NULL, NULL);

INSERT INTO  `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 0, '异常', '1', 'app_video_diagnosis_status', NULL, 'default', 'N', '0', '超级管理员', '2024-03-07 15:42:09', '', NULL, NULL);
INSERT INTO  `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 1, '正常', '0', 'app_video_diagnosis_status', NULL, 'default', 'N', '0', '超级管理员', '2024-03-07 15:42:17', '', NULL, NULL);
INSERT INTO  `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 2, '未知', '2', 'app_video_diagnosis_status', NULL, 'default', 'N', '0', '超级管理员', '2024-03-07 15:42:26', '', NULL, NULL);
INSERT INTO  `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 0, '异常', '1', 'app_dvr_recorder_status', NULL, 'default', 'N', '0', '超级管理员', '2024-03-07 16:22:32', '', NULL, NULL);
INSERT INTO  `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 1, '正常', '0', 'app_dvr_recorder_status', NULL, 'default', 'N', '0', '超级管理员', '2024-03-07 16:22:43', '', NULL, NULL);
INSERT INTO  `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 2, '未知', '2', 'app_dvr_recorder_status', NULL, 'default', 'N', '0', '超级管理员', '2024-03-07 16:22:51', '', NULL, NULL);
