<?xml version="1.0" encoding="utf-8"?>

<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
    <changeSet author="suhuiguang" id="1619517821561-1">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column"/>
        </preConditions>
        <comment>插入动态表单数据 wl_form_group_column</comment>
        <sql>
            INSERT INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES ('133000000213', 'belongAreaId', '所属物理区域', 'String', '132828674810', 'eq', b'0', 'building', '2581805', '2020-12-29 12:04:47');
            INSERT INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES ('133000000214', 'belongAreaId', '所属物理区域', 'String', '132828674811', 'eq', b'0', 'fireControlRoom', '2581805', '2020-12-29 12:04:47');
            INSERT INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES ('133000000215', 'belongAreaId', '所属物理区域', 'String', '132828674815', 'eq', b'0', 'fireFoamRoom', '2581805', '2020-12-29 12:04:47');
            INSERT INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES ('133000000216', 'belongAreaId', '所属物理区域', 'String', '132828674813', 'eq', b'0', 'fireRoom', '2581805', '2020-12-29 12:04:47');
            INSERT INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES ('133000000217', 'belongAreaId', '所属物理区域', 'String', '132828674822', 'eq', b'0', 'floor', '2581805', '2020-12-22 12:01:04');
            INSERT INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES ('133000000218', 'belongAreaId', '所属物理区域', 'String', '132828674812', 'eq', b'0', 'pool', '2581805', '2020-12-29 12:04:47');
            INSERT INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES ('133000000219', 'belongAreaId', '所属物理区域', 'String', '132828674814', 'eq', b'0', 'rainRoom', '2581805', '2020-12-29 12:04:47');
            INSERT INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES ('133000000220', 'belongAreaId', '所属物理区域', 'String', '132828674823', 'eq', b'0', 'r_else', '2581805', '2020-12-29 12:04:47');
            INSERT INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES ('133000000221', 'belongAreaId', '所属物理区域', 'String', '132828674817', 'eq', b'0', 'r_fireControlRoom', '2581805', '2020-12-29 12:04:47');
            INSERT INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES ('133000000222', 'belongAreaId', '所属物理区域', 'String', '132828674821', 'eq', b'0', 'r_fireFoamRoom', '2581805', '2020-12-29 12:04:47');
            INSERT INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES ('133000000223', 'belongAreaId', '所属物理区域', 'String', '132828674819', 'eq', b'0', 'r_fireRoom', '2581805', '2020-12-29 12:04:47');
            INSERT INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES ('133000000224', 'belongAreaId', '所属物理区域', 'String', '132828674818', 'eq', b'0', 'r_pool', '2581805', '2020-12-29 12:04:47');
            INSERT INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES ('133000000225', 'belongAreaId', '所属物理区域', 'String', '132828674820', 'eq', b'0', 'r_rainRoom', '2581805', '2020-12-29 12:04:47');
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1619517821561-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="area_id"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific add column area_id</comment>
        <sql>
            alter table `wl_equipment_specific` add column `area_id` bigint(20) DEFAULT NULL COMMENT '物理区域id' after `iot_code`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1619517821561-3">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_equipment_specific" columnName="system_id"/>
        </preConditions>
        <comment>wl_equipment_specific modify column system_id</comment>
        <sql>
            alter table `wl_equipment_specific` modify column `system_id`  text COMMENT '所属系统(逗号分隔开)' after `single`;
        </sql>
    </changeSet>
    <changeSet id="1620610959379-1" author="suhuiguang">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists indexName="idx_equipment_specific_id"/>
            </not>
        </preConditions>
        <createIndex
                indexName="idx_equipment_specific_id"
                tableName="wl_stock_detail"
                tablespace="A String"
                unique="false">
            <column name="equipment_specific_id"/>
        </createIndex>
    </changeSet>
    <changeSet author="suhuiguang" id="1620800947757-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm" columnName="confirm_user_name"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_alarm add column confirm_user_name</comment>
        <sql>
            alter table `wl_equipment_specific_alarm` add column `confirm_user_name` varchar(255) DEFAULT NULL COMMENT '确警人员姓名' after `confirm_user`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1621231410935-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_equipment_alarm_report_day"/>
            </not>
        </preConditions>
        <comment>设备报警日报表 wl_equipment_alarm_report_day</comment>
        <sql>
            CREATE TABLE `wl_equipment_alarm_report_day` (
            `id` bigint(20) NOT NULL COMMENT '主键',
            `org_code` varchar(100) NOT NULL COMMENT '机构编号',
            `report_date` date NOT NULL COMMENT '上报日期',
            `equipment_specific_id` bigint(20) NOT NULL COMMENT '设备id',
            `equipment_specific_name` varchar(255) DEFAULT NULL COMMENT '设备名称',
            `system_ids` varchar(1000) DEFAULT NULL COMMENT '所属系统名称（多个系统已逗号分隔）',
            `alarm_type` varchar(50) NOT NULL DEFAULT '0' COMMENT '原始报警类型',
            `last_report_date` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '最后一次上报日期',
            `frequency` bigint(20) NOT NULL DEFAULT '1' COMMENT '发生频次',
            `create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
            `update_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
            PRIMARY KEY (`id`) USING BTREE,
            KEY `idx_equip_spe_id` (`equipment_specific_id`) USING BTREE,
            KEY `idx_system_ids` (`system_ids`) USING BTREE
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='设备报警日报表';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1621231410935-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_area"/>
            </not>
        </preConditions>
        <comment>区域 wl_area</comment>
        <sql>
            CREATE TABLE `wl_area` (
            `id` bigint(20) NOT NULL COMMENT '物理主键',
            `name` varchar(50) NOT NULL COMMENT '区域名称',
            `code` varchar(50) DEFAULT NULL COMMENT '区域编码',
            `type` varchar(50) DEFAULT NULL COMMENT '区域类型',
            `parent_id` bigint(20) DEFAULT NULL COMMENT '父id',
            `remark` varchar(255) DEFAULT NULL COMMENT '备注',
            `org_code` varchar(255) DEFAULT NULL COMMENT '单位编码',
            `is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除:0-否；1-是',
            `creator_id` bigint(20) DEFAULT NULL COMMENT '创建者id',
            `risk_point_id` bigint(20) NOT NULL COMMENT '风险区域父节点id',
            `create_date` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
            PRIMARY KEY (`id`) USING BTREE,
            KEY `idx_code` (`code`) USING BTREE,
            KEY `idx_name` (`name`) USING BTREE,
            KEY `idx_parent_id` (`parent_id`) USING BTREE
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='区域';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1621590618802-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="f_fire_fighting_system" columnName="charge_person_name"/>
            </not>
        </preConditions>
        <comment>f_fire_fighting_system add column charge_person_name</comment>
        <sql>
            alter table `f_fire_fighting_system` add column `charge_person_name` varchar(64) DEFAULT NULL COMMENT '负责人姓名';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1622011569539-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_alarm_report_day" columnName="equipment_detail_id"/>
            </not>
        </preConditions>
        <comment>wl_equipment_alarm_report_day add column equipment_detail_id</comment>
        <sql>
            alter table `wl_equipment_alarm_report_day` add column `equipment_detail_id` bigint(20) DEFAULT NULL COMMENT '装备实例明细id(冗余字段)' after `equipment_specific_name`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1622011569539-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_alarm_report_day" columnName="equipment_id"/>
            </not>
        </preConditions>
        <comment>wl_equipment_alarm_report_day add column equipment_id</comment>
        <sql>
            alter table `wl_equipment_alarm_report_day` add column `equipment_id` bigint(20) DEFAULT NULL COMMENT '装备定义id(冗余字段)' after `equipment_detail_id`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1622011569539-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_alarm_report_day" columnName="equipment_code"/>
            </not>
        </preConditions>
        <comment>wl_equipment_alarm_report_day add column equipment_code</comment>
        <sql>
            alter table `wl_equipment_alarm_report_day` add column `equipment_code` varchar(255) DEFAULT NULL COMMENT '装备定义code(冗余字段)' after `equipment_id`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1622088109840-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_analysis_report_log"/>
            </not>
        </preConditions>
        <comment>报告流水表 wl_analysis_report_log</comment>
        <sql>
            CREATE TABLE `wl_analysis_report_log` (
            `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
            `org_code` varchar(255) DEFAULT NULL COMMENT '部门code',
            `name` varchar(255) DEFAULT NULL COMMENT '报告名称',
            `report_type` tinyint(4) DEFAULT NULL COMMENT '0日对比，1周分析，2月总结',
            `create_date` datetime DEFAULT NULL COMMENT '创建时间',
            `report_date_desc` varchar(255) DEFAULT NULL COMMENT '报告日期描述',
            `start_date` date DEFAULT NULL COMMENT '开始时间',
            `end_date` date DEFAULT NULL COMMENT '结束时间',
            PRIMARY KEY (`id`),
            KEY `index_name` (`start_date`,`end_date`,`report_type`)
            ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='报告流水表';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-1">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column"/>
        </preConditions>
        <comment>插入动态表单数据 wl_form_group_column</comment>
        <sql>
            INSERT INTO `wl_form_group_column` VALUES (133000000226, 'orgCode', '组织机构', 'String', 132828674810, 'eq', b'1', 'building', 2581805, '2021-01-13 15:24:12');
            INSERT INTO `wl_form_group_column` VALUES (133000000227, 'orgCode', '组织机构', 'String', 132828674811, 'eq', b'1', 'fireControlRoom', 2581805, '2021-05-19 14:53:13');
            INSERT INTO `wl_form_group_column` VALUES (133000000228, 'orgCode', '组织机构', 'String', 132828674815, 'eq', b'1', 'fireFoamRoom', 2581805, '2020-12-21 17:31:02');
            INSERT INTO `wl_form_group_column` VALUES (133000000229, 'orgCode', '组织机构', 'String', 132828674813, 'eq', b'1', 'fireRoom', 2581805, '2020-12-21 17:30:29');
            INSERT INTO `wl_form_group_column` VALUES (133000000230, 'orgCode', '组织机构', 'String', 132828674822, 'eq', b'1', 'floor', 2581805, '2021-05-19 14:53:13');
            INSERT INTO `wl_form_group_column` VALUES (133000000231, 'orgCode', '组织机构', 'String', 132828674812, 'eq', b'1', 'pool', 2581805, '2020-12-21 17:29:47');
            INSERT INTO `wl_form_group_column` VALUES (133000000232, 'orgCode', '组织机构', 'String', 132828674814, 'eq', b'1', 'rainRoom', 2581805, '2020-12-21 17:30:45');
            INSERT INTO `wl_form_group_column` VALUES (133000000233, 'orgCode', '组织机构', 'String', 132828674823, 'eq', b'1', 'r_else', 2581805, '2021-05-19 14:53:13');
            INSERT INTO `wl_form_group_column` VALUES (133000000234, 'orgCode', '组织机构', 'String', 132828674817, 'eq', b'1', 'r_fireControlRoom', 2581805, '2021-05-19 14:53:13');
            INSERT INTO `wl_form_group_column` VALUES (133000000235, 'orgCode', '组织机构', 'String', 132828674821, 'eq', b'1', 'r_fireFoamRoom', 2581805, '2020-12-21 17:35:01');
            INSERT INTO `wl_form_group_column` VALUES (133000000236, 'orgCode', '组织机构', 'String', 132828674819, 'eq', b'1', 'r_fireRoom', 2581805, '2020-12-21 17:33:17');
            INSERT INTO `wl_form_group_column` VALUES (133000000237, 'orgCode', '组织机构', 'String', 132828674818, 'eq', b'1', 'r_pool', 2581805, '2020-12-21 17:32:43');
            INSERT INTO `wl_form_group_column` VALUES (133000000238, 'orgCode', '组织机构', 'String', 132828674820, 'eq', b'1', 'r_rainRoom', 2581805, '2020-12-21 17:33:42');
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="16218261500010-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="f_fire_fighting_system" columnName="core_component_ids"/>
            </not>
        </preConditions>
        <comment>新增属性字段 core_component_ids</comment>
        <sql>
            alter table `f_fire_fighting_system` add column `core_component_ids` varchar(255) DEFAULT NULL COMMENT '核心部件Ids';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="16218261500010-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_alarm_report_day" columnName="alarm_type"/>
            </not>
        </preConditions>
        <comment>新修改属性字段 alarm_type</comment>
        <sql>
            alter table `wl_equipment_alarm_report_day` modify  column `alarm_type` varchar(128) DEFAULT NULL COMMENT '原始报警类型';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-4">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="mt_maintenance_resource"/>
            </not>
        </preConditions>
        <comment>创建表 mt_maintenance_resource</comment>
        <sql>
            CREATE TABLE `mt_maintenance_resource`  (
            `id` bigint(20) NOT NULL COMMENT 'ID',
            `code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '编码',
            `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称',
            `type` tinyint(4) NULL DEFAULT NULL COMMENT '类型',
            `parent_id` bigint(20) NULL DEFAULT NULL COMMENT '父级ID',
            `create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建日期',
            PRIMARY KEY (`id`) USING BTREE
            ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-5">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="mt_maintenance_resource_data"/>
            </not>
        </preConditions>
        <comment>创建表 mt_maintenance_resource_data</comment>
        <sql>
            CREATE TABLE `mt_maintenance_resource_data`  (
            `id` bigint(20) NOT NULL COMMENT 'ID',
            `maintenance_resource_id` bigint(20) NULL DEFAULT NULL COMMENT '维保资源ID',
            `maintenance_company_id` bigint(20) NOT NULL COMMENT '维保单位ID',
            `maintenance_company_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '维保单位编码',
            `maintenance_company_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '维保单位名称',
            `owner_unit_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业主单位ID',
            `owner_unit_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业主单位编码',
            `owner_unit_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业主单位名称',
            `fire_fight_sys_id` bigint(20) NOT NULL COMMENT '消防系统ID',
            `fire_fight_sys_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '消防系统编码',
            `fire_fight_sys_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '消防系统名称',
            `classify_id` bigint(20) NULL DEFAULT NULL COMMENT '分类ID',
            `classify_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类编码',
            `classify_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类名称',
            `classify_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类类型',
            `fire_facility_id` bigint(20) NOT NULL COMMENT '消防设施ID',
            `fire_facility_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '消防设施编码',
            `fire_facility_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '消防设施名称',
            `fire_facility_type` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '消防设施类型',
            `maintenance_expiration_time` datetime(0) NULL DEFAULT NULL COMMENT '维保到期时间',
            `location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '位置',
            `building_id` bigint(20) NULL DEFAULT NULL COMMENT '建筑ID',
            `building_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '建筑名称',
            `create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建日期',
            PRIMARY KEY (`id`) USING BTREE
            ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="16218261500010-6">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="mt_maintenance_resource_data" columnName="fire_fight_sys_id"/>
        </preConditions>
        <comment>mt_maintenance_resource_data modify column fire_fight_sys_id</comment>
        <sql>
            alter table `mt_maintenance_resource_data` modify column `fire_fight_sys_id` bigint(20) DEFAULT NULL COMMENT '消防系统ID';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-7">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="privilege_department"/>
            </not>
        </preConditions>
        <comment>创建表 privilege_department</comment>
        <sql>
            CREATE TABLE `privilege_department`  (
            `id` bigint(20) NOT NULL COMMENT '部门ID',
            `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门名称',
            PRIMARY KEY (`id`) USING BTREE
            ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-8">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="rpm_person"/>
            </not>
        </preConditions>
        <comment>创建表 rpm_person</comment>
        <sql>
            CREATE TABLE `rpm_person`  (
            `id` bigint(20) NOT NULL COMMENT '用户ID',
            `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户名称',
            PRIMARY KEY (`id`) USING BTREE
            ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-9">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists indexName="idx_equipment_index_id"/>
            </not>
        </preConditions>
        <createIndex tableName="wl_equipment_specific_index" indexName="idx_equipment_index_id">
            <column name="equipment_index_id"></column>
        </createIndex>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-10">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists indexName="idx_qr_code"/>
            </not>
        </preConditions>
        <createIndex tableName="wl_equipment_specific" indexName="idx_qr_code">
            <column name="qr_code"></column>
        </createIndex>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-11">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists indexName="idx_qr_code"/>
            </not>
        </preConditions>
        <createIndex tableName="wl_stock_detail" indexName="idx_qr_code">
            <column name="qr_code"></column>
        </createIndex>
    </changeSet>
    <changeSet author="gaojianqiang" id="16218261500010-12">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="mt_maintenance_resource_data" columnName="status"/>
            </not>
        </preConditions>
        <comment>新增属性字段 mt_maintenance_resource_data</comment>
        <sql>
            alter table `mt_maintenance_resource_data` add column `status` varchar(16) DEFAULT NULL COMMENT '维保设施状态：来源字典';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="16218261500010-13">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="mt_maintenance_resource_data" columnName="maintenance_cycle"/>
            </not>
        </preConditions>
        <comment>新增属性字段 maintenance_cycle</comment>
        <sql>
            alter table `mt_maintenance_resource_data` add column `maintenance_cycle` int(11) DEFAULT '0' COMMENT '维保周期';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="16218261500011-13">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="mt_maintenance_resource_data" columnName="area"/>
            </not>
        </preConditions>
        <comment>新增属性字段 area</comment>
        <sql>
            alter table `mt_maintenance_resource_data` add column `area` varchar(128) DEFAULT NULL COMMENT '位置信息';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="16218261500010-14">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="mt_maintenance_resource_data" columnName="maintenance_time"/>
            </not>
        </preConditions>
        <comment>新增属性字段maintenance_time</comment>
        <sql>
            alter table `mt_maintenance_resource_data` add column `maintenance_time` datetime DEFAULT NULL COMMENT '维保时间';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="16218261500010-15">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="mt_maintenance_resource_data" columnName="maintenance_time"/>
        </preConditions>
        <comment>修改属性字段 maintenance_time</comment>
        <sql>
            alter table `mt_maintenance_resource_data` modify column `maintenance_time` date DEFAULT NULL COMMENT '维保时间';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="16218261500011-15">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="mt_maintenance_resource_data" columnName="maintenance_expiration_time"/>
        </preConditions>
        <comment>修改属性字段 maintenance_expiration_time</comment>
        <sql>
            alter table `mt_maintenance_resource_data` modify column `maintenance_expiration_time` date DEFAULT NULL COMMENT '维保到期时间';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="16218261500010-16">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="mt_maintenance_resource_data" columnName="area"/>
        </preConditions>
        <comment>删除属性字段area</comment>
        <sql>
            alter table `mt_maintenance_resource_data` drop column `area`;
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="16218261500010-17">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="mt_maintenance_resource_data" columnName="maintenance_resource_id"/>
        </preConditions>
        <comment>删除属性字段maintenance_resource_id</comment>
        <sql>
            alter table `mt_maintenance_resource_data` drop column `maintenance_resource_id`;
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="16218261500010-18">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="mt_maintenance_resource"/>
        </preConditions>
        <sql>
            ALTER TABLE `mt_maintenance_resource` DROP PRIMARY KEY ,ADD PRIMARY KEY ( `id`,`parent_id` );
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-19">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm" columnName="location"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_alarm add column location</comment>
        <sql>
            alter table `wl_equipment_specific_alarm` add column `location` varchar(255) DEFAULT NULL COMMENT '设备位置';
        </sql>
    </changeSet>
    
    <changeSet author="gaojianqiang" id="1621826150001-21">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_video" columnName="longitude"/>
            </not>
        </preConditions>
        <comment>wl_video add column longitude</comment>
        <sql>
            alter table `wl_video` add column `longitude` double(18,14) DEFAULT NULL COMMENT '经度';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-22">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_video" columnName="latitude"/>
            </not>
        </preConditions>
        <comment>wl_video add column latitude</comment>
        <sql>
            alter table `wl_video` add column `latitude` double(18,14) DEFAULT NULL COMMENT '纬度';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-23">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_video" columnName="type_code"/>
            </not>
        </preConditions>
        <comment>新增属性字段 type_code</comment>
        <sql>
            alter table `wl_video` add column `type_code` varchar(32) DEFAULT NULL COMMENT '类型编码';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-24">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="name"/>
            </not>
        </preConditions>
        <comment>新增属性字段 name</comment>
        <sql>
            alter table `wl_equipment_specific` add column `name` varchar(128) DEFAULT NULL COMMENT '设备名称';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-25">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="position"/>
            </not>
        </preConditions>
        <comment>新增属性字段 position</comment>
        <sql>
            alter table `wl_equipment_specific` add column `position` varchar(500) DEFAULT NULL COMMENT '位置';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-26">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="equipment_code"/>
            </not>
        </preConditions>
        <comment>新增属性字段 equipment_code</comment>
        <sql>
            alter table `wl_equipment_specific` add column `equipment_code` varchar(64) DEFAULT NULL COMMENT 'detail编码';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-27">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists indexName="idx_equipment_code" />
            </not>
        </preConditions>
        <sql>
            ALTER TABLE `wl_equipment_specific`
            ADD INDEX `idx_equipment_code` (`equipment_code`) USING BTREE ;
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="16218261500010-28">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_equipment_specific" columnName="equipment_code"/>
        </preConditions>
        <comment>更新表wl_equipment_specific属性字段值</comment>
        <sql>
            UPDATE wl_equipment_specific es
            SET es.`name` = (
            SELECT
            ed.`name`
            FROM
            wl_equipment_detail ed
            WHERE
            ed.id = es.equipment_detail_id
            ),
            es.equipment_code = (
            SELECT
            ed.`code`
            FROM
            wl_equipment_detail ed
            WHERE
            ed.id = es.equipment_detail_id
            ),
            es.position = (
            SELECT
            ws.full_name
            FROM
            wl_warehouse_structure ws
            LEFT JOIN wl_stock_detail sd ON sd.warehouse_structure_id = ws.id
            WHERE
            sd.equipment_specific_id = es.id limit 1
            );
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-29">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_warehouse_structure"/>
        </preConditions>
        <comment>插入其他货位数据 wl_warehouse_structure</comment>
        <sql>
            INSERT INTO `wl_warehouse_structure`(`id`, `code`, `name`, `full_name`, `parent_id`, `cell_type`, `cell_code`, `warehouse_id`, `remark`, `create_date`, `source_id`, `source_code`) VALUES (9223372036854775807, 'DEFAULTCODE', '其他', '其他', 0, NULL, NULL, 0, NULL, '2021-10-27 11:27:14', 0, NULL);
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-30">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists indexName="idx_video_id" />
            </not>
        </preConditions>
        <sql>
            ALTER TABLE `wl_video_source`
            ADD INDEX `idx_video_id` (`video_id`) USING BTREE ;
        </sql>
    </changeSet>
    <changeSet author="xixinzhao" id="1622519665128-4">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_alarm_report_day" columnName="alarm_type_name"/>
            </not>
        </preConditions>
        <comment>wl_equipment_alarm_report_day add column alarm_type_name</comment>
        <sql>
            alter table `wl_equipment_alarm_report_day` add column `alarm_type_name` varchar(255) DEFAULT NULL COMMENT '冗余字段（分析报告统计使用）' after `alarm_type`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1622621248843-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_alarm_report_day" columnName="index_true_num"/>
            </not>
        </preConditions>
        <comment>wl_equipment_alarm_report_day add column index_true_num</comment>
        <sql>
            alter table `wl_equipment_alarm_report_day` add column `index_true_num` bigint(20) NOT NULL DEFAULT '0' COMMENT '遥信指标true类型指标数量(统计使用)' after `frequency`;
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1622789789-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_alarm_report_day" columnName="index_id"/>
            </not>
        </preConditions>
        <comment>wl_equipment_alarm_report_day add column index_id</comment>
        <sql>
            alter table `wl_equipment_alarm_report_day` add column `index_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '告警指标Id';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1622789789-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_alarm_report_day" columnName="index_name"/>
            </not>
        </preConditions>
        <comment>wl_equipment_alarm_report_day add column index_name</comment>
        <sql>
            alter table `wl_equipment_alarm_report_day` add column `index_name` varchar(255) DEFAULT NULL COMMENT '告警指标名称';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1622789789-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_alarm_report_day" columnName="index_type"/>
            </not>
        </preConditions>
        <comment>wl_equipment_alarm_report_day add column index_type</comment>
        <sql>
            alter table `wl_equipment_alarm_report_day` add column `index_type` varchar(255) DEFAULT NULL COMMENT '告警指标key值';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1623060561-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm" columnName="system_ids"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_alarm add column system_ids</comment>
        <sql>
            alter table `wl_equipment_specific_alarm` add column `system_ids` text DEFAULT NULL COMMENT '装备所属消防系统（冗余字段）';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1623060561-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm" columnName="system_codes"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_alarm add column system_codes</comment>
        <sql>
            alter table `wl_equipment_specific_alarm` add column `system_codes` text DEFAULT NULL COMMENT '装备所属消防系统code（冗余字段）';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1623060561-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm" columnName="equipment_code"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_alarm add column equipment_code</comment>
        <sql>
            alter table `wl_equipment_specific_alarm` add column `equipment_code` varchar(50) DEFAULT NULL COMMENT '装备定义code（冗余字段）';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1623060561-4">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm" columnName="equipment_id"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_alarm add column equipment_id</comment>
        <sql>
            alter table `wl_equipment_specific_alarm` add column `equipment_id` bigint(20) DEFAULT NULL COMMENT '装备定义id（冗余字段）';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1623060561-5">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm" columnName="equipment_detail_id"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_alarm add column equipment_detail_id</comment>
        <sql>
            alter table `wl_equipment_specific_alarm` add column `equipment_detail_id` bigint(20) DEFAULT NULL COMMENT '装备明细表id(冗余字段)';
        </sql>
    </changeSet>
    <changeSet id="1623208072749-1" author="suhuiguang">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists indexName="idx_equipment_detail_id"/>
            </not>
        </preConditions>
        <createIndex
                indexName="idx_equipment_detail_id"
                tableName="wl_stock_detail"
                tablespace="A String"
                unique="false">
            <column name="equipment_detail_id"/>
        </createIndex>
    </changeSet>
    <changeSet id="1623208072749-2" author="suhuiguang">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_stock_detail" columnName="area"/>
            </not>
        </preConditions>
        <comment>wl_stock_detail add column area</comment>
        <sql>
            alter table `wl_stock_detail` add column `area` varchar(100) DEFAULT NULL COMMENT '位置信息' after `equipment_specific_id`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1623225884763-1">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_equipment_alarm_report_day" columnName="index_id"/>
        </preConditions>
        <comment>wl_equipment_alarm_report_day modify column index_id</comment>
        <sql>
            alter table `wl_equipment_alarm_report_day` modify column `index_id` bigint(20) DEFAULT NULL COMMENT '告警指标Id';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1623595129909-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_alarm_report_day" columnName="value"/>
            </not>
        </preConditions>
        <comment>wl_equipment_alarm_report_day add column value</comment>
        <sql>
            alter table `wl_equipment_alarm_report_day` add column `value` varchar(64) DEFAULT NULL COMMENT '指标值' after `index_type`;
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1623921978-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="agency_id"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific add column</comment>
        <sql>
            alter table `wl_equipment_specific` add column `agency_id` bigint(20) DEFAULT NULL COMMENT '所属单位id(来源于平台)';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1623921978-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="team_id"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific add column</comment>
        <sql>
            alter table `wl_equipment_specific` add column `team_id` bigint(20) DEFAULT NULL COMMENT '所属队伍id(来源于平台)';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1623921978-3" runOnChange="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="team_name"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific add column</comment>
        <sql>
            alter table `wl_equipment_specific` add column `team_name` varchar(255) DEFAULT NULL COMMENT '队伍名称(冗余字段来源于平台)';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1623980956-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_car" columnName="agency_id"/>
            </not>
        </preConditions>
        <comment>wl_car add column</comment>
        <sql>
            alter table `wl_car` add column `agency_id` bigint(20) DEFAULT NULL COMMENT '所属单位id(来源于平台)';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1623980956-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_car" columnName="team_id"/>
            </not>
        </preConditions>
        <comment>wl_car add column</comment>
        <sql>
            alter table `wl_car` add column `team_id` bigint(20) DEFAULT NULL COMMENT '所属队伍id(来源于平台)';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1623980956-3" runOnChange="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_car" columnName="team_name"/>
            </not>
        </preConditions>
        <comment>wl_car add column</comment>
        <sql>
            alter table `wl_car` add column `team_name` varchar(255) DEFAULT NULL COMMENT '队伍名称(冗余字段来源于平台)';
        </sql>
    </changeSet>
    <changeSet author="wujunkai" id="1626247999-1" runOnChange="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_video" columnName="preset_position"/>
            </not>
        </preConditions>
        <comment>wl_video add column</comment>
        <sql>
            alter table `wl_video` add column `preset_position` varchar(255) DEFAULT NULL COMMENT '视频预置位' after `address`;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1627436510447-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_equipment_standard" />
            </not>
        </preConditions>
        <comment>wl_equipment_standard 装备定义规范关系表</comment>
        <sql>
            CREATE TABLE `wl_equipment_standard` (
            `id` bigint(20) NOT NULL,
            `equipment_id` varchar(50) NOT NULL COMMENT '装备id',
            `type` varchar(20) NOT NULL COMMENT '规范类型',
            `standard_key` varchar(100) DEFAULT '' COMMENT '规范key值',
            `standard_name` varchar(1000) DEFAULT NULL COMMENT '维保规范描述（冗余）',
            `create_date` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
            `create_id` bigint(20) DEFAULT NULL COMMENT '创建者',
            `org_code` varchar(255) DEFAULT NULL COMMENT '单位编码',
            PRIMARY KEY (`id`),
            UNIQUE KEY `uni` (`type`,`equipment_id`) USING BTREE
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='装备定义规范关系表';
        </sql>
    </changeSet>
	
	<changeSet author="maoying" id="1628139705001-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists indexName="ix_equip_iot_code" /> 
            </not>
        </preConditions>
        <sql>
           ALTER TABLE `wl_equipment_specific`
		  ADD INDEX `ix_equip_iot_code` (`iot_code`) USING BTREE ;
        </sql>
    </changeSet>
    
    <changeSet author="maoying" id="1628139705001-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists indexName="ix_car_iot_code" /> 
            </not>
        </preConditions>
        <sql>
           ALTER TABLE `wl_car`
		  ADD INDEX `ix_car_iot_code` (`iot_code`) USING BTREE ;
        </sql>
    </changeSet>
    <changeSet author="xixinzhao" id="1628061588000-3">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column"/>
        </preConditions>
        <comment>插入动态表单数据 wl_form_group_column</comment>
        <sql>
            INSERT INTO `wl_form_group_column` VALUES ('133000000239', 'fireResistanceLevel', '耐火等级', 'Enum', '132828674810', 'eq', b'0', 'building', '2581805', '2021-08-04 14:04:14');
            INSERT INTO `wl_form_group_column` VALUES ('133000000240', 'roomNumber', '房间数量', 'String', '132828674810', 'eq', b'0', 'building', '2581805', '2021-08-04 14:09:55');
            INSERT INTO `wl_form_group_column` VALUES ('133000000241', 'east', '东', 'String', '132828674810', 'eq', b'0', 'building', '2581805', '2021-08-04 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES ('133000000242', 'southeast', '东南', 'String', '132828674810', 'eq', b'0', 'building', '2581805', '2021-08-04 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES ('133000000243', 'south', '南', 'String', '132828674810', 'eq', b'0', 'building', '2581805', '2021-08-04 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES ('133000000244', 'southwest', '西南', 'String', '132828674810', 'eq', b'0', 'building', '2581805', '2021-08-04 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES ('133000000245', 'west', '西', 'String', '132828674810', 'eq', b'0', 'building', '2581805', '2021-08-04 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES ('133000000246', 'northwest', '西北', 'String', '132828674810', 'eq', b'0', 'building', '2581805', '2021-08-04 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES ('133000000247', 'north', '北', 'String', '132828674810', 'eq', b'0', 'building', '2581805', '2021-08-04 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES ('133000000248', 'northeast', '东北', 'String', '132828674810', 'eq', b'0', 'building', '2581805', '2021-08-04 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES ('133000000249', 'longitude', '经度', 'String', '132828674810', 'eq', b'0', 'building', '2581805', '2021-08-04 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES ('133000000250', 'latitude', '纬度', 'String', '132828674810', 'eq', b'0', 'building', '2581805', '2021-08-04 14:11:15');
        </sql>
    </changeSet>

    <changeSet author="xixinzhao" id="1628580224000-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_building_audit"/>
            </not>
        </preConditions>
        <comment>消防建筑审核信息 wl_building_audit</comment>
        <sql>
            CREATE TABLE `wl_building_audit` (
            `id` bigint(20) NOT NULL COMMENT '物理主键',
            `audit_type_id` varchar(50) CHARACTER SET utf8 NOT NULL COMMENT '审核类型id',
            `audit_type_name` varchar(50) CHARACTER SET utf8 DEFAULT NULL COMMENT '审核类型名称',
            `audit_unit` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '审核单位',
            `building_name` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '建筑名称',
            `building_id` bigint(20) NOT NULL COMMENT '建筑id',
            `audit_time` datetime DEFAULT NULL COMMENT '审核时间',
            `is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除:0-否；1-是',
            `org_code` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '单位编码',
            `creator_id` bigint(20) DEFAULT NULL COMMENT '创建者id',
            `create_date` datetime DEFAULT NULL COMMENT '创建时间',
            PRIMARY KEY (`id`)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
             </sql>
    </changeSet>
    <changeSet author="maoying" id="1628139705001-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists indexName="idk_eqd_code" /> 
            </not>
        </preConditions>
        <sql>
          ALTER TABLE `wl_equipment_detail`
		ADD INDEX `idk_eqd_code` (`code`) USING BTREE ;
        </sql>
    </changeSet>
    
    <changeSet author="maoying" id="1628139705001-4">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists indexName="idk_ei_name_key" /> 
            </not>
        </preConditions>
        <sql>
         ALTER TABLE `wl_equipment_index`
		ADD INDEX `idk_ei_name_key` (`name_key`) USING BTREE ;
        </sql>
    </changeSet>
    
    <changeSet author="maoying" id="1628139705001-5">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists indexName="idx_eq_sp_index_value" /> 
            </not>
        </preConditions>
        <sql>
          ALTER TABLE `wl_equipment_specific_index`
		  ADD INDEX `idx_eq_sp_index_value` (`value`) USING BTREE ;
        </sql>
    </changeSet>
    <changeSet author="maoying" id="1628139705001-6">
        <preConditions onFail="MARK_RAN">
           <not>
                <columnExists tableName="wl_car_property" columnName="update_date"/>
            </not>
        </preConditions>
        <sql>
          ALTER TABLE `wl_car_property`
		 ADD COLUMN `update_date`  datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `equipment_index_id`;
        </sql>
    </changeSet>

    <changeSet author="keyong" id="1629336170-1" runOnChange="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_equipment_specific_alarm_log"/>
            </not>
        </preConditions>
        <comment>告警日志表 wl_equipment_specific_alarm_log</comment>
        <sql>
            CREATE TABLE `wl_equipment_specific_alarm_log` (
            `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
            `equipment_specific_alarm_id` bigint(20) DEFAULT NULL COMMENT '告警信息id',
            `equipment_specific_name` varchar(100) NOT NULL,
            `equipment_specific_index_name` varchar(255) NOT NULL COMMENT '指标名称',
            `equipment_specific_index_key` varchar(255) NOT NULL COMMENT '指标编码',
            `equipment_specific_index_value` varchar(500) NOT NULL COMMENT '报警值',
            `type` varchar(50) NOT NULL COMMENT '报警类型:alarm_type_fire（火灾报警）/alarm_type_trouble（故障告警）',
            `confirm_type` varchar(20) DEFAULT NULL COMMENT '确认类型',
            `alarm_reason` varchar(300) DEFAULT NULL COMMENT '报警原因',
            `resolve_result` varchar(300) DEFAULT NULL COMMENT '处理情况',
            `confirm_user` varchar(20) DEFAULT NULL COMMENT '确警人员',
            `confirm_user_name` varchar(255) DEFAULT NULL COMMENT '确警人员姓名',
            `confirm_date` datetime DEFAULT NULL COMMENT '确警时间',
            `system_ids` text COMMENT '装备所属消防系统（冗余字段）',
            `system_codes` text COMMENT '装备所属消防系统code（冗余字段）',
            `equipment_code` varchar(50) DEFAULT NULL COMMENT '装备定义code（冗余字段）',
            `iot_code` varchar(255) NOT NULL COMMENT '设备物联编码',
            `equipment_specific_code` varchar(100) DEFAULT NULL,
            `equipment_id` bigint(20) DEFAULT NULL COMMENT '装备定义id（冗余字段）',
            `equipment_detail_id` bigint(20) DEFAULT NULL COMMENT '装备明细表id(冗余字段)',
            `equipment_specific_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '消防设备id',
            `create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
            `update_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
            `org_code` varchar(100) NOT NULL COMMENT '机构编号',
            `equipment_index_id` bigint(20) DEFAULT NULL COMMENT '装备指标id(冗余字段)',
            PRIMARY KEY (`id`) USING BTREE
            ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COMMENT='设备报警信息日志表';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1621826150001-20">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm_log" columnName="location"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_alarm_log add column location</comment>
        <sql>
            alter table `wl_equipment_specific_alarm_log` add column `location` varchar(255) DEFAULT NULL COMMENT '设备位置';
        </sql>
    </changeSet>
    <changeSet id="1630379025553-1" author="shg">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_equipment_standard" columnName="create_id"/>
        </preConditions>
        <comment>wl_equipment_standard 修改字段类型 create_id</comment>
        <sql>
           alter table `wl_equipment_standard` modify `create_id` varchar(32) DEFAULT NULL COMMENT '创建者';
        </sql>
    </changeSet>
    <changeSet id="1630379025553-2" author="shg">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_equipment_standard" columnName="equipment_id"/>
        </preConditions>
        <comment>wl_equipment_standard 修改字段类型 equipment_id</comment>
        <sql>
            alter table `wl_equipment_standard` modify `equipment_id` varchar(32) NOT NULL COMMENT '装备id';
        </sql>
    </changeSet>
    <changeSet id="1630379025553-3" author="shg">
    <preConditions onFail="MARK_RAN">
        <columnExists tableName="wl_area" columnName="risk_point_id"/>
    </preConditions>
    <comment>wl_area 修改字段类型 risk_point_id 非必输</comment>
    <sql>
        alter table `wl_area` modify `risk_point_id` bigint(20) DEFAULT NULL COMMENT '风险区域父节点id';
    </sql>
</changeSet>


    <changeSet author="tw" id="1626247999-10" runOnChange="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_video" columnName="longitude"/>
            </not>
        </preConditions>
        <comment>wl_video add column</comment>
        <sql>
            alter table `wl_video` add column `longitude` double(18,14) DEFAULT NULL COMMENT '经度';
        </sql>
    </changeSet>

    <changeSet author="tw" id="1626247999-11" runOnChange="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_video" columnName="latitude"/>
            </not>
        </preConditions>
        <comment>wl_video add column</comment>
        <sql>
            alter table `wl_video` add column `latitude` double(18,14) DEFAULT NULL COMMENT '纬度';
        </sql>
    </changeSet>
    <changeSet author="litengwei" id="2021-09-08-litengwei-1">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group" />
            <primaryKeyExists primaryKeyName="id" tableName="wl_form_group"/>
        </preConditions>
        <comment>add data wl_form_group</comment>
        <sql>
            INSERT INTO `wl_form_group` VALUES(132828674816, '储罐', 'storageTank', 'building', 'edit,delete', 2581805, '2021-09-06 18:14:19');
        </sql>
    </changeSet>
    <changeSet author="litengwei" id="2021-09-08-litengwei-2">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column" />
            <primaryKeyExists primaryKeyName="id" tableName="wl_form_group_column"/>
        </preConditions>
        <comment>add data wl_form_group_column</comment>
        <sql>
            INSERT INTO `wl_form_group_column` VALUES(133000000251, 'belongUnitId', '所属单位', 'String', 132828674816, 'eq', 0, 'storageTank', 2581805, '2021-09-03 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000252, 'code', '储罐编号', 'String', 132828674816, 'eq', 0, 'storageTank', 2581805, '2021-09-07 17:08:27');
            INSERT INTO `wl_form_group_column` VALUES(133000000253, 'name', '储罐名称', 'String', 132828674816, 'eq', 0, 'storageTank', 2581805, '2021-09-07 17:07:55');
            INSERT INTO `wl_form_group_column` VALUES(133000000254, 'storageName', '储存物名称', 'String', 132828674816, 'eq', 0, 'storageTank', 2581805, '2021-09-03 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000255, 'storageNature', '储存物性质', 'String', 132828674816, 'eq', 0, 'storageTank', 2581805, '2021-09-03 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000256, 'storageForm', '储存物形式', 'String', 132828674816, 'eq', 0, 'storageTank', 2581805, '2021-09-03 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000257, 'storageCapacity', '储存容量', 'String', 132828674816, 'eq', 0, 'storageTank', 2581805, '2021-09-03 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000258, 'orgCode', '组织机构', 'String', 132828674816, 'eq', 1, 'storageTank', 2581805, '2021-09-03 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000259, 'parentId', '父级id', 'String', 132828674816, 'eq', 1, 'storageTank', 2581805, '2021-09-03 14:11:15');
        </sql>
    </changeSet>

    <changeSet author="litengwei" id="2021-09-10-litengwei-1">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column" />
            <primaryKeyExists primaryKeyName="id" tableName="wl_form_group_column"/>
        </preConditions>
        <comment>add data wl_form_group_column</comment>
        <sql>
            INSERT INTO `wl_form_group_column` VALUES(133000000260, 'dutyUserPhone', '责任人电话', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000261, 'structureType', '结构类型', 'Enum', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000262, 'fireRisk', '火灾危险性', 'Enum', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000263, 'fireFightingType', '建筑消防设施类别', 'Enum', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000264, 'emergencyExitsNum', '安全出口数量', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000265, 'fireResistanceLevel', '耐火等级', 'Enum', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000266, 'roomNumber', '房间数量', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000267, 'east', '东', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000268, 'north', '北', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000269, 'northeast', '东北', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000270, 'northwest', '西北', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000271, 'south', '南', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-08-04 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000272, 'southeast', '东南', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000273, 'southwest', '西南', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000274, 'west', '西', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000275, 'cableInterlayerLoc', '电缆夹层位置', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000276, 'cableWellLoc', '电缆井位置（强电和弱电）', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000277, 'emergencyExitsLoc', '安全出口位置', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000278, 'emergencyExitsType', '安全出口形式', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000279, 'maximumCapacity', '最大容纳人数', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000280, 'pipingShaftLoc', '管道井位置', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000281, 'workingPersonNum', '日常工作时间人数', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');
            INSERT INTO `wl_form_group_column` VALUES(133000000282, 'dutyUser', '责任人', 'String', 132828674810, 'eq', 0, 'storageTank', 2581805, '2021-09-09 14:11:15');

        </sql>
    </changeSet>
    <changeSet author="xl" id="1626247999-2021-0910001">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_video" columnName="status"/>
            </not>
        </preConditions>
        <comment>wl_video add column</comment>
        <sql>
            alter table `wl_video` add column `status` bit(1) DEFAULT NULL COMMENT '状态【0：离线；1：在线】';
        </sql>
    </changeSet>
    <changeSet author="xl" id="1626247999-2021-0910002">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_video" columnName="belongAreaId"/>
            </not>
        </preConditions>
        <comment>wl_video add column</comment>
        <sql>
            alter table `wl_video` add column `belongAreaId` bigint(20) DEFAULT NULL COMMENT '监控区域';
        </sql>
    </changeSet>
    <changeSet author="guowubin" id="1631927476868-1" runOnChange="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_monitor_event"/>
            </not>
        </preConditions>
        <comment>在岗监测事件表 wl_monitor_event</comment>
        <sql>
            DROP TABLE IF EXISTS `wl_monitor_event`;
			CREATE TABLE `wl_monitor_event`  (
			  `id` bigint(20) NOT NULL COMMENT 'id',
			  `event_content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '事件内容',
			  `event_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '事件类型',
			  `video_id` bigint(20) NOT NULL COMMENT '摄像头设备id',
			  `video_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '摄像头设备名称',
			  `video_code` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '摄像头设备编号',
			  `video_position` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '摄像头设备位置',
			  `video_monitor_position` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '摄像头设备监控区域',
			  `event_state` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '事件状态',
			  `event_date` datetime(0) NOT NULL COMMENT '发生时间',
			  `snap_pictures` json NULL COMMENT '抓拍图片',
			  `onduty` json NULL COMMENT '值班人员，包括姓名、单位/部门、岗位',
			  `disposal_record` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '事件处理记录',
			  `disposal_user_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '处理人id',
			  `disposal_user_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '处置人姓名',
			  `disposal_date` datetime(0) NULL DEFAULT NULL COMMENT '处理时间',
			  `create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
			  PRIMARY KEY (`id`) USING BTREE
			) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '行为分析摄像头监控事件' ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>
    <changeSet author="guowubin" id="1631927476868-2" runOnChange="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_monitor_view"/>
            </not>
        </preConditions>
        <comment>在岗监测视图件表 wl_monitor_view</comment>
        <sql>
			DROP TABLE IF EXISTS `wl_monitor_view`;
			CREATE TABLE `wl_monitor_view`  (
			  `id` bigint(20) NOT NULL COMMENT 'id',
			  `view_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '视图名称',
			  `polling_period` int(10) NOT NULL COMMENT '轮询周期',
			  `create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
			  PRIMARY KEY (`id`) USING BTREE
			) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '行为分析摄像头监测轮询视图' ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>
    <changeSet author="guowubin" id="1631927476868-3" runOnChange="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_monitor_view_video"/>
            </not>
        </preConditions>
        <comment>在岗监测视图视频关系表 wl_monitor_view_video</comment>
        <sql>
            DROP TABLE IF EXISTS `wl_monitor_view_video`;
			CREATE TABLE `wl_monitor_view_video`  (
			  `id` bigint(20) NOT NULL COMMENT 'id',
			  `video_id` bigint(20) NOT NULL COMMENT '视频id',
			  `view_id` bigint(20) NOT NULL COMMENT '在岗监测视图id',
			  `create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
			  PRIMARY KEY (`id`) USING BTREE
			) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '监测视图与视频关系表' ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>
    <changeSet author="xl" id="1626247999-2021-092401">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_video" columnName="status"/>
        </preConditions>
        <comment>wl_video modify `status`</comment>
        <sql>
            alter table `wl_video` modify column `status` varchar(5);
        </sql>
    </changeSet>
    <changeSet author="guowubin" id="1632721162250-1" runOnChange="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_monitor_event_utils_week"/>
            </not>
        </preConditions>
        <comment>在岗监测事件周统计临时表 wl_monitor_event_utils_week</comment>
        <sql>
            DROP TABLE IF EXISTS `wl_monitor_event_utils_week`;
			CREATE TABLE `wl_monitor_event_utils_week`  (
			  `id` int(20) NOT NULL AUTO_INCREMENT,
			  `week_day` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
			  PRIMARY KEY (`id`) USING BTREE
			) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>
     <changeSet author="guowubin" id="1632721162250-2">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_monitor_event_utils_week" />
            <primaryKeyExists primaryKeyName="id" tableName="wl_monitor_event_utils_week"/>
        </preConditions>
        <comment>add data wl_monitor_event_utils_week</comment>
        <sql>
            INSERT INTO `wl_monitor_event_utils_week`(`id`, `week_day`) VALUES (1, '星期一');
			INSERT INTO `wl_monitor_event_utils_week`(`id`, `week_day`) VALUES (2, '星期二');
			INSERT INTO `wl_monitor_event_utils_week`(`id`, `week_day`) VALUES (3, '星期三');
			INSERT INTO `wl_monitor_event_utils_week`(`id`, `week_day`) VALUES (4, '星期四');
			INSERT INTO `wl_monitor_event_utils_week`(`id`, `week_day`) VALUES (5, '星期五');
			INSERT INTO `wl_monitor_event_utils_week`(`id`, `week_day`) VALUES (6, '星期六');
			INSERT INTO `wl_monitor_event_utils_week`(`id`, `week_day`) VALUES (7, '星期天');
        </sql>
    </changeSet>
    <changeSet author="guowubin" id="1632721162250-3" runOnChange="true">
        <comment>在岗监测事件月统计临时视图表v_monitor_event_utils_month</comment>
        <createView viewName="v_monitor_event_utils_month" replaceIfExists="true">
         	SELECT
				cast( ( curdate( ) - INTERVAL 0 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 1 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 2 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 3 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 4 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 5 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 6 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 7 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 8 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 9 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 10 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 11 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 12 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 13 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 14 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 15 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 16 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 17 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 18 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 19 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 20 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 21 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 22 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 23 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 24 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 25 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 26 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 27 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 28 DAY ) AS date ) AS `click_date` UNION ALL
			SELECT
				cast( ( curdate( ) - INTERVAL 29 DAY ) AS date ) AS `click_date`
        </createView>
    </changeSet>
    <changeSet author="guowubin" id="1632721162250-4" runOnChange="true">
        <comment>在岗监测事件月实时统计视图v_utils_month_view</comment>
        <createView viewName="v_utils_month_view" replaceIfExists="true">
            <![CDATA[
         	SELECT
				sum( IF ( ( `wl_monitor_event`.`event_type` = '离岗' ), 1, 0 ) ) AS `离岗`,
				sum( IF ( ( `wl_monitor_event`.`event_type` = '人数异常' ), 1, 0 ) ) AS `人数异常`,
				`wl_monitor_event`.`event_date` AS `event_date` 
			FROM
				`wl_monitor_event`
			WHERE
				( ( curdate( ) - INTERVAL 30 DAY ) <= cast( `wl_monitor_event`.`event_date` AS date ) )
			GROUP BY
				cast( `wl_monitor_event`.`event_date` AS date )
            ]]>
         </createView>
    </changeSet>
     <changeSet author="guowubin" id="1632721162250-5" runOnChange="true">
        <comment>在岗监测事件周实时统计视图v_utils_week_view</comment>
        <createView viewName="v_utils_week_view" replaceIfExists="true">
         	SELECT
				sum( IF ( ( `wl_monitor_event`.`event_type` = '离岗' ), 1, 0 ) ) AS `离岗`,
				sum( IF ( ( `wl_monitor_event`.`event_type` = '人数异常' ), 1, 0 ) ) AS `人数异常`,
				weekday( `wl_monitor_event`.`event_date` ) AS `WEEKDAY(event_date)`,
				`wl_monitor_event`.`event_date` AS `event_date` 
			FROM
				`wl_monitor_event` 
			WHERE
				( yearweek( date_format( `wl_monitor_event`.`event_date`, '%Y-%m-%d' ), 1 ) = yearweek( now( ), 1 ) ) 
			GROUP BY
				cast( `wl_monitor_event`.`event_date` AS date )
        </createView>
    </changeSet>
     <changeSet author="guowubin" id="1632721162250-6" runOnChange="true">
        <comment>在岗监测事件月统计视图v_monitor_event_month</comment>
        <createView viewName="v_monitor_event_month" replaceIfExists="true">
         	SELECT
				date_format( `a`.`click_date`, '%m-%d' ) AS `days`,
				ifnull( `b`.`离岗`, 0 ) AS `离岗`,
				ifnull( `b`.`人数异常`, 0 ) AS `人数异常`,
				`b`.`event_date` AS `event_date` 
			FROM
				( `v_monitor_event_utils_month` `a` LEFT JOIN `v_utils_month_view` `b` ON ( ( `a`.`click_date` = cast( `b`.`event_date` AS date ) ) ) ) 
			ORDER BY
				`a`.`click_date`
        </createView>
    </changeSet>
     <changeSet author="guowubin" id="1632721162250-7" runOnChange="true">
        <comment>在岗监测事件周统计视图v_monitor_event_week</comment>
        <createView viewName="v_monitor_event_week" replaceIfExists="true">
         	SELECT
				`a`.`week_day` AS `days`,
				ifnull( `b`.`离岗`, 0 ) AS `离岗`,
				ifnull( `b`.`人数异常`, 0 ) AS `人数异常`,
				weekday( `b`.`event_date` ) AS `WEEKDAY(b.event_date)`,
				`b`.`event_date` AS `event_date` 
			FROM
				( `wl_monitor_event_utils_week` `a` LEFT JOIN `v_utils_week_view` `b` ON ( ( `a`.`id` = ( weekday( `b`.`event_date` ) + 1 ) ) ) ) 
			ORDER BY
				`a`.`id`
        </createView>
    </changeSet>
    <changeSet author="guowubin" id="1632721162250-8" runOnChange="true">
        <comment>在岗监测事件区域前十统计视图v_monitor_event_region</comment>
        <createView viewName="v_monitor_event_region" replaceIfExists="true">
            <![CDATA[
         	SELECT
				`wl_monitor_event`.`video_monitor_position` AS `video_monitor_position`,
				count( `wl_monitor_event`.`event_content` ) AS `count_evet_content` 
			FROM
				`wl_monitor_event` 
			WHERE
				( ( ( curdate( ) - INTERVAL 30 DAY ) <= `wl_monitor_event`.`event_date` ) AND ( `wl_monitor_event`.`video_monitor_position` IS NOT NULL ) ) 
			GROUP BY
				`wl_monitor_event`.`video_monitor_position` 
			HAVING
				count( `wl_monitor_event`.`event_content` ) 
			ORDER BY
				count( `wl_monitor_event`.`event_date` ) DESC 
				LIMIT 10
			]]>
        </createView>
    </changeSet>
    
    <changeSet author="maoying" id="1633681349001-1">
        <preConditions onFail="MARK_RAN">
           <not>
                <columnExists tableName="wl_equipment_specific_index" columnName="equipment_specific_name"/>
            </not>
        </preConditions>
        <sql>
	         ALTER TABLE `wl_equipment_specific_index`
			ADD COLUMN `equipment_specific_name`  varchar(255) NULL ,
			ADD COLUMN `equipment_index_name`  varchar(255) NULL,
			ADD COLUMN `equipment_index_key`  varchar(255) NULL;
			UPDATE wl_equipment_specific_index esi
			SET esi.equipment_index_key = (
				SELECT
					name_key
				FROM
					wl_equipment_index
				WHERE
					id = esi.equipment_index_id
			),
			 esi.equipment_index_name = (
				SELECT
					`name`
				FROM
					wl_equipment_index
				WHERE
					id = esi.equipment_index_id
			),
			 esi.equipment_specific_name = (
				SELECT
					ed.`name`
				FROM
					wl_equipment_detail AS ed,
					wl_equipment_specific AS es
				WHERE
					es.id = esi.equipment_specific_id
				AND es.equipment_detail_id = ed.id
			)
 		</sql>
    </changeSet>
    
    <changeSet author="maoying" id="1634031084001-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists indexName="idx_equipment_index_key" /> 
            </not>
        </preConditions>
        <sql>
          	ALTER TABLE `wl_equipment_specific_index`
			ADD INDEX `idx_equipment_index_key` (`equipment_index_key`) USING BTREE ;
        </sql>
    </changeSet>
    
    <changeSet author="maoying" id="1634031085001-1">
        <preConditions onFail="MARK_RAN">
           <not>
                <columnExists tableName="f_fire_fighting_system" columnName="system_type_code"/>
            </not>
        </preConditions>
        <sql>
           ALTER TABLE `f_fire_fighting_system`
			ADD COLUMN `system_type_code`  varchar(255) NULL COMMENT '系统类型编码，用于数字换流站集成页面fireCAFSSys（CAFS系统）；fireAlarmSys（火灾报警系统）；fireONLSys（排油系统）；fireFoamSys（泡沫灭火系统）；fireWaterSys（消防给水系统）；fireFoamMistSys（细水雾涡扇炮系统）;otherSys（其他系统）' AFTER `core_component_ids`;
        </sql>
    </changeSet>
   <changeSet author="maoying" id="1633681350001-1">
        <preConditions onFail="MARK_RAN">
           <not>
                <columnExists tableName="wl_car_property" columnName="equipment_index_name"/>
            </not>
        </preConditions>
        <sql>
	        ALTER TABLE `wl_car_property`
			ADD COLUMN `equipment_index_name`  varchar(255) NULL COMMENT '指标名称' AFTER `equipment_index_id`,
			ADD COLUMN `equipment_index_key`  varchar(255) NULL COMMENT '指标编码' AFTER `equipment_index_name`;
			UPDATE wl_car_property cp
			SET cp.equipment_index_key = (
				SELECT
					name_key
				FROM
					wl_equipment_index
				WHERE
					id = cp.equipment_index_id
			),
			 cp.equipment_index_name = (
				SELECT
					`name`
				FROM
					wl_equipment_index
				WHERE
					id = cp.equipment_index_id
			)
 		</sql>
	 </changeSet>

    <changeSet author="xl" id="1626247999-2021-1014001">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment" columnName="is_iot"/>
            </not>
        </preConditions>
        <comment>wl_equipment add column</comment>
        <sql>
            alter table `wl_equipment` add column `is_iot` varchar(5) DEFAULT NULL COMMENT '是否物联装备【0：否；1：是】';
        </sql>
    </changeSet>

    <changeSet author="maoying" id="16340310856001-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists indexName="idx_equipment_specific_code" />
            </not>
        </preConditions>
        <sql>
          	ALTER TABLE `wl_equipment_specific`
			ADD INDEX `idx_equipment_specific_code` (`code`) USING BTREE ;
        </sql>
    </changeSet>
    <changeSet author="xl" id="1626247999-2021-1018001">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_equipment" columnName="is_iot"/>
        </preConditions>
        <comment>更新表wl_equipment属性字段值</comment>
        <sql>
            UPDATE wl_equipment
                SET is_iot = '0'
            WHERE
                id not IN (
                    SELECT
                    t.id
                    FROM
                    (
                    SELECT
                    we.id
                    FROM
                    wl_equipment we
                    LEFT JOIN wl_equipment_index wi ON we.id = wi.equipment_id
                    WHERE
                    wi.is_iot = '1'
                    GROUP BY
                    we.id
                ) t
            );
            UPDATE wl_equipment
                SET is_iot = '1'
            WHERE
                id IN (
                    SELECT
                    t.id
                    FROM
                    (
                    SELECT
                    we.id
                    FROM
                    wl_equipment we
                    LEFT JOIN wl_equipment_index wi ON we.id = wi.equipment_id
                    WHERE
                    wi.is_iot = '1'
                    GROUP BY
                    we.id
                ) t
            );
        </sql>
    </changeSet>



    <changeSet author="tw" id="1632721162258880-01">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_system_dic" />
            <primaryKeyExists primaryKeyName="id" tableName="wl_system_dic"/>
        </preConditions>
        <comment>add data wl_system_dic</comment>
        <sql>
            INSERT INTO `wl_system_dic`(`id`, `code`, `name`, `type`, `create_date`, `remark`) VALUES (388, '12', '装配', 'EquipStatus', '2021-10-18 11:42:28', NULL);
            INSERT INTO `wl_system_dic`(`id`, `code`, `name`, `type`, `create_date`, `remark`) VALUES (389, '10', '装配', 'JournalType', '2021-10-18 11:43:17', NULL);

        </sql>
    </changeSet>

	<changeSet author="maoying" id="1634700804001-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="realtime_iot_index_name"/>
            </not>
        </preConditions>
        <comment>wl_equipment add column</comment>
        <sql>
           ALTER TABLE `wl_equipment_specific`
			ADD COLUMN `realtime_iot_index_name`  varchar(200) NULL DEFAULT '' COMMENT '实时指标名称',
			ADD COLUMN `realtime_iot_index_key`  varchar(200) NULL DEFAULT '' COMMENT '实时指标编码',
			ADD COLUMN `realtime_iot_index_value`  varchar(50) NULL DEFAULT '' COMMENT '实时指标值',
			ADD COLUMN `realtime_iot_es_index_id`  bigint(20) NULL COMMENT '实时指标id(wl_equipment_specific_index_id)',
			ADD COLUMN `realtime_iot_index_update_date`  datetime NULL DEFAULT NULL COMMENT '实时指标更新时间';
        </sql>
    </changeSet>
     <changeSet author="maoying" id="1634700804001-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists indexName="idx_es_equipment_index_update" />
            </not>
        </preConditions>
        <sql>
		    ALTER TABLE `wl_equipment_specific_index`
		ADD INDEX `idx_es_equipment_index_update` (`update_date`) USING BTREE ;
        </sql>
    </changeSet>
     <changeSet author="guowubin" id="1634815382224-1" runOnChange="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_topography_line"/>
            </not>
        </preConditions>
        <comment>网络拓扑连线表 wl_topography_line</comment>
        <sql>
			DROP TABLE IF EXISTS `wl_topography_line`;
			CREATE TABLE `wl_topography_line`  (
			  `line_from` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '连线起点节点id',
			  `line_to` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '连线终点节点id',
			  `treeid` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '树id',
			  `id` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
			  `create_date` datetime(0) NULL DEFAULT NULL,
			  `create_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
			  `is_delete` bit(1) NULL DEFAULT NULL,
			  `update_date` datetime(0) NULL DEFAULT NULL,
			  `update_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
			  `clickable` bit(1) NULL DEFAULT NULL COMMENT '可点击',
			  `tree_node_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '树节点id',
			  `number` int(11) NULL DEFAULT NULL COMMENT '异常数量',
			  `state` int(11) NULL DEFAULT 0 COMMENT '异常状态',
			  `type` int(11) NULL DEFAULT NULL COMMENT '类型：1-网络拓扑图，2-PAMS',
			  `has_arrow` bit(1) NULL DEFAULT NULL COMMENT '有箭头',
			  `from_port` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '起点位置',
			  `to_port` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '终点位置',
			  `is_dash` bit(1) NULL DEFAULT NULL COMMENT '是虚线',
			  `line_color` int(11) NULL DEFAULT NULL COMMENT '颜色',
			  `org_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '部门单位',
			  PRIMARY KEY (`id`) USING BTREE
			) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>
    <changeSet author="guowubin" id="1634815382224-2" runOnChange="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_topography_node"/>
            </not>
        </preConditions>
        <comment>网络拓扑节点表 wl_topography_node</comment>
        <sql>
			DROP TABLE IF EXISTS `wl_topography_node`;
			CREATE TABLE `wl_topography_node`  (
			  `node_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'key',
			  `topo_group` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '分组',
			  `category` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类别',
			  `text` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文本',
			  `loc` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '位置',
			  `size` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '大小',
			  `is_group` bit(1) NULL DEFAULT NULL COMMENT '是否是组',
			  `source` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片',
			  `treeid` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '树id',
			  `id` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
			  `create_date` datetime(0) NULL DEFAULT NULL,
			  `create_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
			  `is_delete` bit(1) NULL DEFAULT NULL,
			  `update_date` datetime(0) NULL DEFAULT NULL,
			  `update_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
			  `number` int(11) NULL DEFAULT NULL COMMENT '异常数量',
			  `state` int(11) NULL DEFAULT 0 COMMENT '异常状态：0-正常，1-警告（W），2-次要（S），3-重要（M），4-紧急（E）',
			  `type` int(11) NULL DEFAULT NULL COMMENT '类型：1-网络拓扑图，2-PAMS',
			  `equip_type` int(10) NULL DEFAULT NULL,
			  `source_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '对接设备id',
			  `ports` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
			  `org_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '部门单位',
			  PRIMARY KEY (`id`) USING BTREE
			) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>
    <changeSet author="guowubin" id="1634815382224-3" runOnChange="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_topography_node_detail"/>
            </not>
        </preConditions>
        <comment>网络拓扑节点详情表 wl_topography_node_detail</comment>
        <sql>
			DROP TABLE IF EXISTS `wl_topography_node_detail`;
			CREATE TABLE `wl_topography_node_detail`  (
			  `id` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
			  `create_date` datetime(0) NULL DEFAULT NULL,
			  `create_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
			  `is_delete` bit(1) NULL DEFAULT NULL,
			  `update_date` datetime(0) NULL DEFAULT NULL,
			  `update_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
			  `alarm_number` int(11) NULL DEFAULT NULL COMMENT '告警数',
			  `eqp_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备id，equipment_specific_id',
			  `eqp_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '装备名称',
			  `nodeid` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '节点id',
			  `node_detail` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
			  PRIMARY KEY (`id`) USING BTREE
			) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>
    <changeSet author="guowubin" id="1634815382224-4" runOnChange="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_topography_tree"/>
            </not>
        </preConditions>
        <comment>网络拓扑树表 wl_topography_tree</comment>
        <sql>
			DROP TABLE IF EXISTS `wl_topography_tree`;
			CREATE TABLE `wl_topography_tree`  (
			  `id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'ID',
			  `code` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编码',
			  `parent_code` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '父编码',
			  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名称',
			  `tree_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '树字段',
			  `topo_group` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '分组',
			  `create_date` datetime(0) NULL DEFAULT NULL,
			  `create_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
			  `is_delete` bit(1) NULL DEFAULT NULL,
			  `update_date` datetime(0) NULL DEFAULT NULL,
			  `update_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
			  `type` int(11) NULL DEFAULT NULL COMMENT '类型：1-网络拓扑图',
			  `end_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '终点ID   | b_bank_info',
			  `start_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '起点ID   | b_bank_info ',
			  `org_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '部门单位',
			  `auth_org` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '组织',
			  PRIMARY KEY (`id`) USING BTREE
			) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '拓扑树结构' ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>

    <changeSet author="xl" id="1626247999-2021-1025001">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_equipment_index" columnName="unit"/>
        </preConditions>
        <comment>更新表wl_equipment_index属性字段值</comment>
        <sql>
            UPDATE wl_equipment_index SET unit = 'MPa' WHERE `name` = 'NB_水压值';
            UPDATE wl_equipment_index SET unit = '℃' WHERE `name` in ('NB_第四路温度','NB_第三路温度','NB_第二路温度','NB_第一路温度');
            UPDATE wl_equipment_index SET unit = 'mA' WHERE `name` in ('NB_剩余电流','NB_A相电流','NB_B相电流','NB_C相电流');
            UPDATE wl_equipment_index SET unit = 'Hz' WHERE `name` = 'NB_频率';
            UPDATE wl_equipment_index SET unit = '%' WHERE `name` in ('NB_电流不平衡度','NB_电压不平衡度');
            UPDATE wl_equipment_index SET unit = 'W' WHERE `name` in ('NB_三相总有功功率','NB_C相有功功率','NB_B相有功功率','NB_A相有功功率');
            UPDATE wl_equipment_index SET unit = 'm' WHERE `name` = 'NB_液位值';
            UPDATE wl_equipment_index SET unit = 'V' WHERE `name` in ('NB_C相电压','NB_A相电压','NB_B相电压','NB_电池电压');
        </sql>
    </changeSet>
    <changeSet author="litw" id="2021年10月25日" runOnChange="true">
        <comment>联动力量统计视图表v_person_onduty_jcs</comment>
        <createView viewName="v_person_onduty_jcs" replaceIfExists="true">
            select
            `wl_car`.`team_name` as `teamName`,
            sum((case when (`wl_car`.`car_state` = 1) then 1 else 0 end)) as `carStateOne`,
            sum((case when (`wl_car`.`car_state` = 2) then 1 else 0 end)) as `carStateTwo`
            from
            `wl_car`
            where
            ((`wl_car`.`team_id` is not null)
            and (`wl_car`.`team_name` is not null))
            group by
            `wl_car`.`team_id`,
            `wl_car`.`team_name`;
        </createView>
    </changeSet>
    <changeSet author="guowubin" id="1635155361269-1" runOnChange="true">
        <comment>故障告警类型统计视图v_equipment_speciific_alarm_log_type</comment>
        <createView viewName="v_equipment_speciific_alarm_log_type" replaceIfExists="true">
            <![CDATA[
         	SELECT
				`wl_equipment_specific_alarm_log`.`id` AS `id`,
				'火灾告警' AS `type` 
			FROM
				`wl_equipment_specific_alarm_log` 
			WHERE
				( `wl_equipment_specific_alarm_log`.`type` = 'FIREALARM' ) UNION ALL
			SELECT
				`wl_equipment_specific_alarm_log`.`id` AS `id`,
				'屏蔽告警' AS `type` 
			FROM
				`wl_equipment_specific_alarm_log` 
			WHERE
				( `wl_equipment_specific_alarm_log`.`type` = 'SHIELD' ) UNION ALL
			SELECT
				`wl_equipment_specific_alarm_log`.`id` AS `id`,
				'故障告警' AS `type` 
			FROM
				`wl_equipment_specific_alarm_log` 
			WHERE
				( `wl_equipment_specific_alarm_log`.`type` = 'BREAKDOWN' )
				]]>
         </createView>
    </changeSet>
 	<changeSet author="guowubin" id="1635155361269-2" runOnChange="true">
        <comment>故障告警近30天统计视图v_equipment_specigic_alarm_log_days</comment>
        <createView viewName="v_equipment_specigic_alarm_log_days" replaceIfExists="true">
            <![CDATA[
         	SELECT
				sum( IF ( ( `wl_equipment_specific_alarm_log`.`type` = 'FIREALARM' ), 1, 0 ) ) AS `火灾告警`,
				sum( IF ( ( `wl_equipment_specific_alarm_log`.`type` = 'SHIELD' ), 1, 0 ) ) AS `屏蔽告警`,
				sum( IF ( ( `wl_equipment_specific_alarm_log`.`type` = 'BREAKDOWN' ), 1, 0 ) ) AS `故障告警`,
				`wl_equipment_specific_alarm_log`.`create_date` AS `create_date` 
			FROM
				`wl_equipment_specific_alarm_log` 
			WHERE
				( ( curdate( ) - INTERVAL 30 DAY ) <= cast( `wl_equipment_specific_alarm_log`.`create_date` AS date ) ) 
			GROUP BY
				cast( `wl_equipment_specific_alarm_log`.`create_date` AS date )
				]]>
         </createView>
    </changeSet>
    <changeSet author="guowubin" id="1635155361269-3" runOnChange="true">
        <comment>故障告警近月统计视图v_equipment_specific_alarm_log_month</comment>
        <createView viewName="v_equipment_specific_alarm_log_month" replaceIfExists="true">
            <![CDATA[
         	SELECT
				date_format( `a`.`click_date`, '%m-%d' ) AS `days`,
				ifnull( `b`.`火灾告警`, 0 ) AS `火灾告警`,
				ifnull( `b`.`屏蔽告警`, 0 ) AS `屏蔽告警`,
				ifnull( `b`.`故障告警`, 0 ) AS `故障告警`,
				`b`.`create_date` AS `create_date` 
			FROM
				( `v_monitor_event_utils_month` `a` LEFT JOIN `v_equipment_specigic_alarm_log_days` `b` ON ( ( `a`.`click_date` = cast( `b`.`create_date` AS date ) ) ) ) 
			ORDER BY
				`a`.`click_date`
				]]>
         </createView>
    </changeSet>
    <changeSet author="xixinzhao" id="1635322807000-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm_log" columnName="build_id"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_alarm_log add column build_id</comment>
        <sql>
            alter table `wl_equipment_specific_alarm_log` add column `build_id` varchar(255) DEFAULT NULL COMMENT '建筑id（冗余字段）';
        </sql>
    </changeSet>
	<changeSet author="maoying" id="1635838478005-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="realtime_iot_index_id"/>
            </not>
        </preConditions>
        <comment>wl_equipment add column realtime_iot_index_id</comment>
        <sql>
           ALTER TABLE `wl_equipment_specific`
           ADD COLUMN `realtime_iot_index_id`  bigint(20) NULL COMMENT '指标库id(wl_equipment_index_id)';
        </sql>
    </changeSet>
    <changeSet author="maoying" id="1635838478005-2">
        <preConditions onFail="MARK_RAN">
                <columnExists tableName="wl_equipment_specific" columnName="realtime_iot_index_id"/>
        </preConditions>
        <comment>insert realtime_iot_index_id</comment>
        <sql>
		 UPDATE wl_equipment_specific wes
			SET wes.realtime_iot_index_id = (
				SELECT
					esi.equipment_index_id
				FROM
				wl_equipment_specific_index esi
				WHERE
					esi.id = wes.realtime_iot_es_index_id
			)
        </sql>
    </changeSet>
    <changeSet author="shg" id="1637829617337-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="warehouse_structure_id"/>
            </not>
        </preConditions>
        <comment>wl_equipment add column warehouse_structure_id</comment>
        <sql>
            ALTER TABLE `wl_equipment_specific`
            ADD COLUMN `warehouse_structure_id`  bigint(20) DEFAULT NULL COMMENT '所在货位id(冗余字段)';
        </sql>
    </changeSet>
    <changeSet author="shg" id="1637829617337-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="agency_name"/>
            </not>
        </preConditions>
        <comment>wl_equipment add column agency_name</comment>
        <sql>
            ALTER TABLE `wl_equipment_specific` ADD COLUMN `agency_name` varchar(100) DEFAULT NULL COMMENT '所属单位名称(来源于平台)';
        </sql>
    </changeSet>
    
     <changeSet author="my" id="1637896586001-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_detail" columnName="equipment_name"/>
            </not>
        </preConditions>
        <comment>wl_equipment_detail add column equipment_name</comment>
        <sql>
            ALTER TABLE `wl_equipment_detail`
			ADD COLUMN `equipment_name`  varchar(255) NULL DEFAULT '' COMMENT '装备定义名称' AFTER `code`;
			UPDATE wl_equipment_detail ed SET ed.equipment_name = (SELECT `name` FROM wl_equipment WHERE id = ed.equipment_id);
			  </sql>
    </changeSet>
    <changeSet author="guowubin" id="1638107713860-1">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_topography_node_detail" columnName="eqp_id"/>
        </preConditions>
        <comment>wl_topography_node_detail modify `eqp_id`</comment>
        <sql>
            alter table `wl_topography_node_detail` modify column `eqp_id` bigint(32);
        </sql>
    </changeSet>
    <changeSet author="shg" id="1638172796697-1">
    <preConditions onFail="MARK_RAN">
        <columnExists tableName="wl_equipment_specific" columnName="warehouse_structure_id"/>
    </preConditions>
    <comment>wl_equipment_specific 增加冗余字段内容填充</comment>
    <sql>
        UPDATE
        `wl_equipment_specific` s
        SET s.warehouse_structure_id = (
        SELECT
        d.warehouse_structure_id
        FROM
        wl_stock_detail d
        WHERE
        d.equipment_specific_id = s.id
        LIMIT 1
        );
    </sql>
    </changeSet>
    <changeSet author="shg" id="1638172796697-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_equipment_alarm_equip_day" />
            </not>
        </preConditions>
        <comment>wl_equipment_alarm_equip_day 报警设备数量日统计分析日报统计用</comment>
        <sql>
            CREATE TABLE `wl_equipment_alarm_equip_day` (
            `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
            `report_date` date NOT NULL COMMENT '上报日期',
            `system_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '所属系统名称',
            `equipment_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '装备定义code(冗余字段)',
            `equipment_name` varchar(255) DEFAULT NULL COMMENT '装备定义名称',
            `index_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '告警指标key值',
            `index_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '告警指标名称(冗余)',
            `report_equip_num` int(11) DEFAULT '1' COMMENT '上报信号设备数量',
            `create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
            PRIMARY KEY (`id`) USING BTREE,
            KEY `idx_system_id` (`system_id`) USING BTREE,
            KEY `uniq_rsei` (`report_date`,`system_id`,`equipment_code`,`index_key`)
            ) ENGINE=InnoDB AUTO_INCREMENT=1321 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='报警设备数量日统计';
        </sql>
    </changeSet>

    <changeSet author="xixinzhao" id="1638251100000-1">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column"/>
        </preConditions>
        <comment>插入动态表单数据 wl_form_group_column</comment>
        <sql>
            INSERT INTO `wl_form_group_column` VALUES ('133000000283', 'mapSetting', '地图配置', 'String', '132828674822', 'eq', b'0', 'floor', '2581805', '2021-11-30 10:50:14');
        </sql>
    </changeSet>

    <changeSet author="xl" id="1626247999-2021-1130001">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_equipment_alarm_report_day" columnName="value"/>
        </preConditions>
        <comment>wl_equipment_alarm_report_day modify `value`</comment>
        <sql>
            alter table `wl_equipment_alarm_report_day` modify column `value` varchar(255);
        </sql>
    </changeSet>

    <changeSet author="xl" id="1626247999-2021-1130002">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_equipment_specific" columnName="realtime_iot_index_value"/>
        </preConditions>
        <comment>wl_equipment_specific modify `realtime_iot_index_value`</comment>
        <sql>
            alter table `wl_equipment_specific` modify column `realtime_iot_index_value` varchar(255);
        </sql>
    </changeSet>
    
    
    <changeSet author="my" id="1626247999-2021-1203011">
        <preConditions onFail="MARK_RAN">
        	<not>
            	<columnExists tableName="wl_equipment_specific_index" columnName="value_label"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_index add `value_label`</comment>
        <sql>
            ALTER TABLE wl_equipment_specific_index ADD COLUMN value_label varchar(255) DEFAULT NULL COMMENT '值说明';
        </sql>
    </changeSet>
    
     <changeSet author="my" id="1626247999-2021-1203022">
        <preConditions onFail="MARK_RAN">
        	<not>
            	<columnExists tableName="wl_equipment_index" columnName="value_enum"/>
            </not>
        </preConditions>
        <comment>wl_equipment_index add `value_enum`</comment>
        <sql>
           	 ALTER TABLE `wl_equipment_index`
			ADD COLUMN `value_enum`  text NULL COMMENT '指标值枚举' AFTER `name_key`;
        </sql>
    </changeSet>
    
    
    <changeSet author="my" id="1626247999-2021-1203013">
        <preConditions onFail="MARK_RAN">
        	<not>
            	<columnExists tableName="wl_equipment_specific_alarm" columnName="equipment_specific_index_label"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_alarm add `equipment_specific_index_label`</comment>
        <sql>
            ALTER TABLE wl_equipment_specific_alarm ADD COLUMN equipment_specific_index_label varchar(255) DEFAULT NULL COMMENT '报警值说明';
        </sql>
    </changeSet>

    <changeSet author="xl" id="1626247999-2021-120701">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_video" columnName="status"/>
        </preConditions>
        <comment>wl_video modify `status`</comment>
        <sql>
            alter table `wl_video` modify column `status` varchar(5) DEFAULT NULL COMMENT '状态【0：在线；1：离线】';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1639540630-20211215-01">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_video" columnName="biz_org_code"/>
            </not>
        </preConditions>
        <comment>wl_video add column biz_org_code</comment>
        <sql>
            alter table `wl_video` add column `biz_org_code` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构编码';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1639540630-20211215-02">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_video" columnName="biz_org_name"/>
            </not>
        </preConditions>
        <comment>wl_video add column biz_org_name</comment>
        <sql>
            alter table `wl_video` add column `biz_org_name` varchar(128) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构/部门名称';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1639540630-20211215-03">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column"/>
        </preConditions>
        <comment>wl_form_group_column 表添加建筑数据</comment>
        <sql>
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000251, 'bizOrgCode', '机构编码', 'String', 132828674810, 'eq', b'0', 'building', 2581805, '2021-12-15 17:33:56');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000252, 'bizOrgName', '机构/部门名称', 'String', 132828674810, 'eq', b'0', 'building', 2581805, '2021-12-15 17:34:04');
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1639540630-20211217-01">
        <comment>`getOrgUsrTreeById`</comment>
        <sql endDelimiter="#">
            DROP FUNCTION IF EXISTS `getOrgUsrTreeById`#
            CREATE DEFINER = `root` @`%` FUNCTION `getOrgUsrTreeById` ( `rootId` BIGINT ) RETURNS VARCHAR ( 1000 ) CHARSET utf8 BEGIN
            DECLARE
            sTemp TEXT;
            DECLARE
            sTempChd VARCHAR ( 4000 );
            SET sTemp = '$';
            SET sTempChd = CAST( rootId AS CHAR );
            WHILE
            sTempChd IS NOT NULL DO
            SET sTemp = CONCAT( sTemp, ',', sTempChd );
            SELECT
            GROUP_CONCAT( DISTINCT sequence_nbr ) INTO sTempChd
            FROM
            cb_org_usr
            WHERE
            FIND_IN_SET( parent_id, sTempChd ) > 0;
            END WHILE;
            RETURN substring( sTemp, 3 );
            END#
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1639540630-20211221-01">
        <comment>`getOrgUsrTreeById`</comment>
        <sql endDelimiter="#">
            DROP FUNCTION IF EXISTS `getOrgUsrTreeById`;
        </sql>
    </changeSet>
    <changeSet author="xixinzhao" id="1639991298000-01">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="f_fire_fighting_system" columnName="biz_org_code"/>
            </not>
        </preConditions>
        <comment>f_fire_fighting_system add column biz_org_code</comment>
        <sql>
            alter table `f_fire_fighting_system` add column `biz_org_code` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构编码';
        </sql>
    </changeSet>
    <changeSet author="xixinzhao" id="1639991298000-02">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="f_fire_fighting_system" columnName="biz_org_name"/>
            </not>
        </preConditions>
        <comment>f_fire_fighting_system add column biz_org_name</comment>
        <sql>
            alter table `f_fire_fighting_system` add column `biz_org_name` varchar(128) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构/部门名称';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1640203458-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_area" columnName="biz_org_code"/>
            </not>
        </preConditions>
        <comment>wl_area add column biz_org_code</comment>
        <sql>
            alter table `wl_area` add column `biz_org_code` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构编码';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1640203458-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_area" columnName="biz_org_name"/>
            </not>
        </preConditions>
        <comment>wl_area add column biz_org_name</comment>
        <sql>
            alter table `wl_area` add column `biz_org_name` varchar(128) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构/部门名称';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="1639540630-20211227-01">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column"/>
        </preConditions>
        <comment>wl_form_group_column 表添加建筑数据</comment>
        <sql>
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000284 , 'bizOrgCode', '机构编码', 'String', 132828674811, 'eq', b'0', 'fireControlRoom', 2581805, '2021-12-15 17:33:56');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000285 , 'bizOrgName', '机构/部门名称', 'String', 132828674811, 'eq', b'0', 'fireControlRoom', 2581805, '2021-12-15 17:34:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000286 , 'bizOrgCode', '机构编码', 'String', 132828674812, 'eq', b'0', 'pool', 2581805, '2021-12-15 17:33:56');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000287 , 'bizOrgName', '机构/部门名称', 'String', 132828674812, 'eq', b'0', 'pool', 2581805, '2021-12-15 17:34:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000288 , 'bizOrgCode', '机构编码', 'String', 132828674813, 'eq', b'0', 'fireRoom', 2581805, '2021-12-15 17:33:56');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000289 , 'bizOrgName', '机构/部门名称', 'String', 132828674813, 'eq', b'0', 'fireRoom', 2581805, '2021-12-15 17:34:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000290 , 'bizOrgCode', '机构编码', 'String', 132828674814, 'eq', b'0', 'rainRoom', 2581805, '2021-12-15 17:33:56');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000291 , 'bizOrgName', '机构/部门名称', 'String', 132828674814, 'eq', b'0', 'rainRoom', 2581805, '2021-12-15 17:34:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000292 , 'bizOrgCode', '机构编码', 'String', 132828674815, 'eq', b'0', 'fireFoamRoom', 2581805, '2021-12-15 17:33:56');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000293 , 'bizOrgName', '机构/部门名称', 'String', 132828674815, 'eq', b'0', 'fireFoamRoom', 2581805, '2021-12-15 17:34:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000294 , 'bizOrgCode', '机构编码', 'String', 132828674817, 'eq', b'0', 'r_fireControlRoom', 2581805, '2021-12-15 17:33:56');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000295 , 'bizOrgName', '机构/部门名称', 'String', 132828674817, 'eq', b'0', 'r_fireControlRoom', 2581805, '2021-12-15 17:34:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000296 , 'bizOrgCode', '机构编码', 'String', 132828674818, 'eq', b'0', 'r_pool', 2581805, '2021-12-15 17:33:56');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000297 , 'bizOrgName', '机构/部门名称', 'String', 132828674818, 'eq', b'0', 'r_pool', 2581805, '2021-12-15 17:34:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000298 , 'bizOrgCode', '机构编码', 'String', 132828674819, 'eq', b'0', 'r_fireRoom', 2581805, '2021-12-15 17:33:56');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000299 , 'bizOrgName', '机构/部门名称', 'String', 132828674819, 'eq', b'0', 'r_fireRoom', 2581805, '2021-12-15 17:34:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000300 , 'bizOrgCode', '机构编码', 'String', 132828674820, 'eq', b'0', 'r_rainRoom', 2581805, '2021-12-15 17:33:56');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000301 , 'bizOrgName', '机构/部门名称', 'String', 132828674820, 'eq', b'0', 'r_rainRoom', 2581805, '2021-12-15 17:34:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000302 , 'bizOrgCode', '机构编码', 'String', 132828674821, 'eq', b'0', 'r_fireFoamRoom', 2581805, '2021-12-15 17:33:56');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000303 , 'bizOrgName', '机构/部门名称', 'String', 132828674821, 'eq', b'0', 'r_fireFoamRoom', 2581805, '2021-12-15 17:34:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000304 , 'bizOrgCode', '机构编码', 'String', 132828674822, 'eq', b'0', 'floor', 2581805, '2021-12-15 17:33:56');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000305 , 'bizOrgName', '机构/部门名称', 'String', 132828674822, 'eq', b'0', 'floor', 2581805, '2021-12-15 17:34:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000306 , 'bizOrgCode', '机构编码', 'String', 132828674823, 'eq', b'0', 'r_else', 2581805, '2021-12-15 17:33:56');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000307 , 'bizOrgName', '机构/部门名称', 'String', 132828674823, 'eq', b'0', 'r_else', 2581805, '2021-12-15 17:34:04');
        </sql>
    </changeSet>



    <changeSet author="tw" id="20220104-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_car" columnName="biz_org_name"/>
            </not>
        </preConditions>
        <comment>wl_area add column biz_org_name</comment>
        <sql>
            alter table `wl_car` add column `biz_org_name` varchar(128) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构/部门名称';
        </sql>
    </changeSet>
    <changeSet author="tw" id="20220104-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_car" columnName="biz_org_code"/>
            </not>
        </preConditions>
        <comment>wl_area add column biz_org_code</comment>
        <sql>
            alter table `wl_car` add column `biz_org_code` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构编码';
        </sql>
    </changeSet>



    <changeSet author="tw" id="20220104-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="biz_org_name"/>
            </not>
        </preConditions>
        <comment>wl_area add column biz_org_name</comment>
        <sql>
            alter table `wl_equipment_specific` add column `biz_org_name` varchar(128) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构/部门名称';
        </sql>
    </changeSet>
    <changeSet author="tw" id="20220104-4">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="biz_org_code"/>
            </not>
        </preConditions>
        <comment>wl_area add column biz_org_code</comment>
        <sql>
            alter table `wl_equipment_specific` add column `biz_org_code` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构编码';
        </sql>
    </changeSet>

    <changeSet author="keyong" id="1640205688-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm_log" columnName="status"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_alarm_log add column status</comment>
        <sql>
            alter table `wl_equipment_specific_alarm_log` add column `status` bit(1) COLLATE utf8mb4_general_ci NOT NULL DEFAULT b'1' COMMENT '报警状态：1报警0恢复';
        </sql>
    </changeSet>


    <changeSet author="tw" id="20220104-5">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_warehouse_structure" columnName="biz_org_name"/>
            </not>
        </preConditions>
        <comment>wl_warehouse_structure add column biz_org_name</comment>
        <sql>
            alter table `wl_warehouse_structure` add column `biz_org_name` varchar(128) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构/部门名称';
        </sql>
    </changeSet>
    <changeSet author="tw" id="20220104-6">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_warehouse_structure" columnName="biz_org_code"/>
            </not>
        </preConditions>
        <comment>wl_warehouse_structure add column biz_org_code</comment>
        <sql>
            alter table `wl_warehouse_structure` add column `biz_org_code` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构编码';
        </sql>
    </changeSet>

    <changeSet author="keyong" id="1641977770-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_index" columnName="is_trend"/>
            </not>
        </preConditions>
        <comment>wl_equipment_index add column is_trend</comment>
        <sql>
            alter table `wl_equipment_index` add column `is_trend` bit(1) DEFAULT b'0' COMMENT '是否支持趋势查看, 默认false';
        </sql>
    </changeSet>



    <changeSet author="keyong" id="1641367742-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm_log" columnName="clean_time"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_alarm_log add column clean_time</comment>
        <sql>
            alter table `wl_equipment_specific_alarm_log` add column `clean_time` datetime DEFAULT NULL COMMENT '消除时间';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1641367742-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment" columnName="clean_type"/>
            </not>
        </preConditions>
        <comment>wl_equipment add column clean_type</comment>
        <sql>
            ALTER TABLE wl_equipment ADD COLUMN clean_type varchar(50) DEFAULT NULL COMMENT '警情消除方式(0：收到复位信号自动消除；1：警情处理确认后消除)';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1642465149617-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_analysis_report_month"/>
            </not>
        </preConditions>
        <comment>create table wl_analysis_report_month 分析报告用</comment>
        <sql>
            CREATE TABLE `wl_analysis_report_month` (
            `system_id` bigint DEFAULT NULL COMMENT '系统id',
            `num` int DEFAULT NULL COMMENT '总数量',
            `equipment_code` varchar(255) DEFAULT NULL COMMENT '装备定义编码',
            `equipment_name` varchar(255) DEFAULT NULL,
            `report_month` varchar(255) DEFAULT NULL COMMENT '报告所在年月',
            `fault_equip_num` int DEFAULT NULL COMMENT '故障设备数量',
            `fault_info_num` int DEFAULT NULL COMMENT '故障信息条数',
            `alarm_equip_num` int DEFAULT NULL COMMENT '告警设备数量',
            `alarm_info_num` int DEFAULT NULL COMMENT '告警信息条数',
            `total_info_num` int DEFAULT NULL COMMENT '总信息数量',
            `create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
            UNIQUE KEY `uk_system_id_report_month_equipment_code` (`system_id`,`equipment_code`,`report_month`) USING BTREE,
            KEY `idx_report_month` (`report_month`) USING BTREE
            ) ENGINE=InnoDB COMMENT='设备告警月统计';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1642465149617-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_analysis_report_summary"/>
            </not>
        </preConditions>
        <comment>create table wl_analysis_report_summary 分析报告用</comment>
        <sql>
            CREATE TABLE `wl_analysis_report_summary` (
            `system_id` bigint DEFAULT NULL COMMENT '系统id',
            `system_name` varchar(255)  DEFAULT NULL COMMENT '系统名称',
            `report_type` varchar(255)  DEFAULT NULL COMMENT '报告类型',
            `report_date` date DEFAULT NULL COMMENT '报告日期',
            `summary_info` varchar(500)  DEFAULT NULL COMMENT '总结信息',
            `create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
            UNIQUE KEY `uk_system_id_report_type_report_date` (`system_id`,`report_type`,`report_date`),
            KEY `idx_systemid_report_type` (`system_id`,`report_type`) USING BTREE
            ) ENGINE=InnoDB COMMENT='总结报告';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1642465149617-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="f_fire_fighting_system" columnName="analysis_index_key"/>
            </not>
        </preConditions>
        <comment>f_fire_fighting_system add column analysis_index_key 分析报告用</comment>
        <sql>
            ALTER TABLE f_fire_fighting_system ADD COLUMN `analysis_index_key` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分析报告统计用参数（为空不统计）';
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1642465149617-4">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="f_fire_fighting_system" columnName="analysis_index_key"/>
        </preConditions>
        <comment>f_fire_fighting_system 更新 analysis_index_key 分析报告统计用</comment>
        <sql>
            UPDATE `f_fire_fighting_system` SET `analysis_index_key`='Fault,Open,OilLeak' WHERE (`code`='029026401813010000000030');
            UPDATE `f_fire_fighting_system` SET `analysis_index_key`='FireAlarm,Fault,Shield' WHERE (`code`='029026401813010000000016');
            UPDATE `f_fire_fighting_system` SET `analysis_index_key`='Fault,Alarm,Abnormal' WHERE (`code`='029026401813010000000023');
            UPDATE `f_fire_fighting_system` SET `analysis_index_key`='Fault,Shield,FireAlarm' WHERE (`code`='029026401813010000000047');
            UPDATE `f_fire_fighting_system` SET `analysis_index_key`='FireAlarm,Fault,Shield,State' WHERE (`code`='029026401813010000000054');
        </sql>
    </changeSet>
    <changeSet author="tw" id="20220120-1">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_equipment_category"/>
        </preConditions>
        <comment>wl_equipment_category 更新消火栓</comment>
        <sql>
            REPLACE INTO `wl_equipment_category`(`id`, `parent_id`, `code`, `name`, `is_consumptive`, `description`, `remark`, `create_date`, `industry_code`) VALUES (1438772584828137473, '1438771726480601090', '93060400', '消火栓', 0, NULL, NULL, '2021-09-17 15:51:30', '2');
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1643271244095-1">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_equipment_specific" columnName="team_id"/>
        </preConditions>
        <comment>wl_equipment_specific modify column team_id</comment>
        <sql>
            alter table `wl_equipment_specific` modify column `team_id` varchar(32) DEFAULT NULL COMMENT '所属队伍id(来源于平台)';
        </sql>
    </changeSet>
    <changeSet author="shg" id="1644459872903-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_video_source" columnName="parent_source_ids"/>
            </not>
        </preConditions>
        <comment>wl_video_source add column parent_source_ids 本级及父级建筑ids，冗余树形搜索</comment>
        <sql>
            alter table `wl_video_source` add column `parent_source_ids` text COMMENT '本级及父级建筑ids，冗余树形搜索';
        </sql>
    </changeSet>
    <changeSet author="shg" id="1644459872903-10"  runAlways="true">
        <comment>`getBuildingParentIds` 存在前后顺序依赖关系所以放在这里</comment>
        <sql endDelimiter="#">
            DROP FUNCTION IF EXISTS `getBuildingParentIds`#
            CREATE DEFINER=`root`@`%` FUNCTION `getBuildingParentIds`(`childrenId` VARCHAR(32)) RETURNS varchar(1000) CHARSET utf8
            BEGIN
            DECLARE ptemp VARCHAR(1000);
            DECLARE ctemp VARCHAR(1000);
            DECLARE ctempName VARCHAR(1000);
            SET ptemp ='';
            SET ctemp = childrenId;
            WHILE ctemp != '0' DO
            SET ptemp = concat(ptemp,',',ctemp);
            SELECT IFNULL((SELECT parentId
            FROM get_building_tree
            WHERE instanceId = ctemp),'0') INTO ctemp;
            END WHILE;
            SET ptemp = SUBSTR(ptemp,2);
            RETURN ptemp;
            END#
        </sql>
    </changeSet>
    <changeSet author="shg" id="1644459872903-3">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_video_source" columnName="parent_source_ids"/>
        </preConditions>
        <comment>wl_video_source 存量数据修改parent_source_ids</comment>
        <sql>
            update wl_video_source s set s.parent_source_ids = (SELECT getBuildingParentIds(s.source_id)) ;
        </sql>
    </changeSet>

    <changeSet author="keyong" id="1645149948-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_signal_classify"/>
            </not>
        </preConditions>
        <comment>create table wl_signal_classify 用于点图装备状态颜色展示等</comment>
        <sql>
            CREATE TABLE `wl_signal_classify` (
            `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
            `type_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '量测枚举key',
            `type_name` varchar(20) DEFAULT NULL COMMENT '类型名称',
            `emergency_level_color` varchar(20) DEFAULT NULL COMMENT '十六进制颜色',
            `is_alarm` bit(1) DEFAULT b'0' COMMENT '是否告警:0-否；1-是',
            `emergency_level` varchar(10) DEFAULT NULL COMMENT '紧急程度枚举（1：紧急，2：严重，3：轻微，4：正常，5：无效，6：备用，7：其他）',
            `emergency_level_describe` varchar(20) DEFAULT NULL COMMENT '紧急程度描述',
            `create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
            PRIMARY KEY (`id`) USING BTREE
            ) ENGINE=InnoDB AUTO_INCREMENT=20220218 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='信号分类量测枚举表';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1645152102-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_index" columnName="emergency_level_color"/>
            </not>
        </preConditions>
        <comment>wl_equipment_index add `emergency_level_color`</comment>
        <sql>
            ALTER TABLE `wl_equipment_index` ADD COLUMN `emergency_level_color` varchar(20) DEFAULT NULL COMMENT '十六进制颜色',
            ADD COLUMN `is_alarm` bit(1) DEFAULT b'0' COMMENT '是否告警:0-否；1-是',
            ADD COLUMN `emergency_level` varchar(10) DEFAULT NULL COMMENT '紧急程度枚举（1：紧急，2：严重，3：轻微，4：正常，5：无效，6：备用，7：其他）',
            ADD COLUMN `emergency_level_describe` varchar(20) DEFAULT NULL COMMENT '紧急程度描述';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1645149948-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_car_property" columnName="emergency_level_color"/>
            </not>
        </preConditions>
        <comment>wl_car_property add `emergency_level_color`</comment>
        <sql>
            ALTER TABLE `wl_car_property` ADD COLUMN `emergency_level_color` varchar(20) DEFAULT NULL COMMENT '十六进制颜色',
            ADD COLUMN `is_alarm` bit(1) DEFAULT b'0' COMMENT '是否告警:0-否；1-是',
            ADD COLUMN `emergency_level` varchar(10) DEFAULT NULL COMMENT '紧急程度枚举（1：紧急，2：严重，3：轻微，4：正常，5：无效，6：备用，7：其他）',
            ADD COLUMN `emergency_level_describe` varchar(20) DEFAULT NULL COMMENT '紧急程度描述';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1645149948-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_index" columnName="emergency_level_color"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_index add `emergency_level_color`</comment>
        <sql>
            ALTER TABLE `wl_equipment_specific_index` ADD COLUMN `emergency_level_color` varchar(20) DEFAULT NULL COMMENT '十六进制颜色',
            ADD COLUMN `is_alarm` bit(1) DEFAULT b'0' COMMENT '是否告警:0-否；1-是',
            ADD COLUMN `emergency_level` varchar(10) DEFAULT NULL COMMENT '紧急程度枚举（1：紧急，2：严重，3：轻微，4：正常，5：无效，6：备用，7：其他）',
            ADD COLUMN `emergency_level_describe` varchar(20) DEFAULT NULL COMMENT '紧急程度描述';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1645149948-4">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm" columnName="emergency_level_color"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_alarm add `emergency_level_color`</comment>
        <sql>
            ALTER TABLE `wl_equipment_specific_alarm` ADD COLUMN `emergency_level_color` varchar(20) DEFAULT NULL COMMENT '十六进制颜色',
            ADD COLUMN `emergency_level` varchar(10) DEFAULT NULL COMMENT '紧急程度枚举（1：紧急，2：严重，3：轻微，4：正常，5：无效，6：备用，7：其他）',
            ADD COLUMN `emergency_level_describe` varchar(20) DEFAULT NULL COMMENT '紧急程度描述';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1645149948-5">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm_log" columnName="emergency_level_color"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_alarm_log add `emergency_level_color`</comment>
        <sql>
            ALTER TABLE `wl_equipment_specific_alarm_log` ADD COLUMN `emergency_level_color` varchar(20) DEFAULT NULL COMMENT '十六进制颜色',
            ADD COLUMN `emergency_level` varchar(10) DEFAULT NULL COMMENT '紧急程度枚举（1：紧急，2：严重，3：轻微，4：正常，5：无效，6：备用，7：其他）',
            ADD COLUMN `emergency_level_describe` varchar(20) DEFAULT NULL COMMENT '紧急程度描述';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1645149948-6">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_alarm_report_day" columnName="is_alarm"/>
            </not>
        </preConditions>
        <comment>wl_equipment_alarm_report_day add `is_alarm`</comment>
        <sql>
            ALTER TABLE `wl_equipment_alarm_report_day` ADD COLUMN `is_alarm` bit(1) DEFAULT b'0' COMMENT '是否告警:0-否；1-是';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1645149948-7">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_signal_classify"/>
        </preConditions>
        <comment>插入基础数据 wl_signal_classify</comment>
        <sql>
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220218, 'BREAKDOWN', '故障', '#D87A16', b'1', '2', '严重', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220219, 'SHIELD', '屏蔽', '#177DDC', b'1', '6', '一般', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220220, 'RUNSTATE', '运行状态', '#49AA19', b'0', '4', '正常', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220221, 'Alarm', '告警', '#D32029', b'1', '1', '紧急', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220222, 'HearBeat', '心跳', '#49AA19', b'0', '4', '正常', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220223, 'Action', '动作', '#E8D639', b'1', '3', '轻微', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220224, 'Reset', '复位', '#49AA19', b'0', '4', '正常', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220225, 'FIREALARM', '火警', '#D32029', b'1', '1', '紧急', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220226, 'Abnormal', '异常', '#D87A16', b'1', '2', '严重', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220227, 'FeedBack', '反馈', '#D87A16', b'1', '2', '严重', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220228, 'PowerLoss', '失电', '#D87A16', b'1', '2', '严重', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220229, 'StartStop', '启停', '#D87A16', b'1', '2', '严重', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220230, 'Activation', '激活', '#D87A16', b'1', '2', '严重', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220231, 'Status', '状态信号', '#49AA19', b'0', '4', '正常', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220232, 'Normal', '正常信号', '#49AA19', b'0', '4', '正常', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220233, 'Indicate', '指示信号', '#E8D639', b'1', '3', '轻微', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220234, 'Tripping', '跳闸', '#D87A16', b'1', '2', '严重', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220235, 'OilLeak', '漏油', '#D32029', b'1', '1', '紧急', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220236, 'Recovery', '恢复', '#49AA19', b'1', '4', '正常', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220237, 'Quarantine', '隔离', '#E8D639', b'1', '3', '轻微', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220238, 'Release', '释放', '#E8D639', b'1', '3', '轻微', now());
            INSERT INTO `wl_signal_classify`(`id`, `type_code`, `type_name`, `emergency_level_color`, `is_alarm`, `emergency_level`, `emergency_level_describe`, `create_date`) VALUES (20220239, 'Control', '控制', '#E8D639', b'1', '3', '轻微', now());

            UPDATE wl_equipment_index wei
            SET wei.emergency_level_color = (
            SELECT
            emergency_level_color
            FROM
            wl_signal_classify wsc
            WHERE
            upper( wsc.type_code ) = upper( wei.type_code )
            ),
            wei.is_alarm = (
            SELECT
            is_alarm
            FROM
            wl_signal_classify wsc
            WHERE
            upper( wsc.type_code ) = upper( wei.type_code )
            ),
            wei.emergency_level = (
            SELECT
            emergency_level
            FROM
            wl_signal_classify wsc
            WHERE
            upper( wsc.type_code ) = upper( wei.type_code )
            ),
            wei.emergency_level_describe = (
            SELECT
            emergency_level_describe
            FROM
            wl_signal_classify wsc
            WHERE
            upper( wsc.type_code ) = upper( wei.type_code )
            );

            UPDATE wl_car_property cp
            SET cp.emergency_level_color = ( SELECT emergency_level_color FROM wl_equipment_index wei WHERE cp.equipment_index_id = wei.id ),
            cp.is_alarm = ( SELECT is_alarm FROM wl_equipment_index wei WHERE cp.equipment_index_id = wei.id ),
            cp.emergency_level = ( SELECT emergency_level FROM wl_equipment_index wei WHERE cp.equipment_index_id = wei.id ),
            cp.emergency_level_describe = ( SELECT emergency_level_describe FROM wl_equipment_index wei WHERE cp.equipment_index_id = wei.id );

            UPDATE wl_equipment_specific_index esi
            SET esi.emergency_level_color = ( SELECT emergency_level_color FROM wl_equipment_index wei WHERE esi.equipment_index_id = wei.id ),
            esi.is_alarm = ( SELECT is_alarm FROM wl_equipment_index wei WHERE esi.equipment_index_id = wei.id ),
            esi.emergency_level = ( SELECT emergency_level FROM wl_equipment_index wei WHERE esi.equipment_index_id = wei.id ),
            esi.emergency_level_describe = ( SELECT emergency_level_describe FROM wl_equipment_index wei WHERE esi.equipment_index_id = wei.id );

            UPDATE wl_equipment_specific_alarm esa
            SET esa.emergency_level_color = ( SELECT emergency_level_color FROM wl_equipment_index wei WHERE esa.equipment_index_id = wei.id ),
            esa.emergency_level = ( SELECT emergency_level FROM wl_equipment_index wei WHERE esa.equipment_index_id = wei.id ),
            esa.emergency_level_describe = ( SELECT emergency_level_describe FROM wl_equipment_index wei WHERE esa.equipment_index_id = wei.id );

            UPDATE wl_equipment_specific_alarm_log esal
            SET esal.emergency_level_color = ( SELECT emergency_level_color FROM wl_equipment_index wei WHERE esal.equipment_index_id = wei.id ),
            esal.emergency_level = ( SELECT emergency_level FROM wl_equipment_index wei WHERE esal.equipment_index_id = wei.id ),
            esal.emergency_level_describe = ( SELECT emergency_level_describe FROM wl_equipment_index wei WHERE esal.equipment_index_id = wei.id );

            UPDATE wl_equipment_alarm_report_day eard
            SET eard.is_alarm = ( SELECT is_alarm FROM wl_equipment_index wei WHERE eard.index_id = wei.id );
        </sql>
    </changeSet>

    <changeSet author="suhuiguang" id="1646103800910-2">
        <comment>wl_stock_detail 更新区域描述 之前新增编辑未更新 alarm表使用到</comment>
        <sql>
            update wl_stock_detail
            sd set sd.description =
            (select
            ed.area from wl_equipment_detail ed
            where
            ed.id = sd.equipment_detail_id and ed.area <![CDATA[<>]]>''
            )
            where sd.description is null;
        </sql>
    </changeSet>
    <changeSet author="suhuiguang" id="1646291252942-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm_log" columnName="confirm_type_name"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_alarm_log add column confirm_type_name 确认类型名称前端回显用</comment>
        <sql>
            ALTER TABLE wl_equipment_specific_alarm_log ADD COLUMN `confirm_type_name` varchar(255) DEFAULT NULL COMMENT '确认类型名称前端回显用';
        </sql>
    </changeSet>

    <changeSet author="tw" id="20220301-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_detail" columnName="longitude"/>
            </not>
        </preConditions>
        <comment>wl_equipment_detail add `longitude`</comment>
        <sql>
            ALTER TABLE `wl_equipment_detail` ADD COLUMN  `longitude` double(18,14) DEFAULT NULL COMMENT '经度'
        </sql>
    </changeSet>

    <changeSet author="tw" id="20220301-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_detail" columnName="latitude"/>
            </not>
        </preConditions>
        <comment>wl_equipment_detail add `latitude`</comment>
        <sql>
            ALTER TABLE `wl_equipment_detail` ADD COLUMN `latitude` double(18,14) DEFAULT NULL COMMENT '纬度'
        </sql>
    </changeSet>




    <changeSet author="tw" id="2022-04-14">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column"/>
        </preConditions>
        <comment>插入动态表单数据 wl_form_group_column</comment>
        <sql>
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000319, 'latitude', '纬度', 'String', 132828674815, 'eq', b'0', 'r_else', 2581805, '2022-03-01 12:01:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000320, 'longitude', '经度', 'String', 132828674813, 'eq', b'0', 'r_else', 2581805, '2022-03-01 12:04:47');
        </sql>
    </changeSet>

    <changeSet author="tw" id="2022-04-15">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column"/>
        </preConditions>
        <comment>插入动态表单数据 wl_form_group_column</comment>
        <sql>
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000322, 'latitude', '纬度', 'String', 132828674817, 'eq', b'0', 'r_fireControlRoom', 2581805, '2022-03-01 12:01:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000323, 'longitude', '经度', 'String', 132828674817, 'eq', b'0', 'r_fireControlRoom', 2581805, '2022-03-01 12:04:47');

            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000324, 'latitude', '纬度', 'String', 132828674818, 'eq', b'0', 'r_pool', 2581805, '2022-03-01 12:01:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000325, 'longitude', '经度', 'String', 132828674818, 'eq', b'0', 'r_pool', 2581805, '2022-03-01 12:04:47');

            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000326, 'latitude', '纬度', 'String', 132828674819, 'eq', b'0', 'r_fireRoom', 2581805, '2022-03-01 12:01:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000327, 'longitude', '经度', 'String', 132828674819, 'eq', b'0', 'r_fireRoom', 2581805, '2022-03-01 12:04:47');

            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000328, 'latitude', '纬度', 'String', 132828674820, 'eq', b'0', 'r_rainRoom', 2581805, '2022-03-01 12:01:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000329, 'longitude', '经度', 'String', 132828674820, 'eq', b'0', 'r_rainRoom', 2581805, '2022-03-01 12:04:47');

            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000330, 'latitude', '纬度', 'String', 132828674821, 'eq', b'0', 'r_fireFoamRoom', 2581805, '2022-03-01 12:01:04');
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000331, 'longitude', '经度', 'String', 132828674821, 'eq', b'0', 'r_fireFoamRoom', 2581805, '2022-03-01 12:04:47');


        </sql>
    </changeSet>
    <changeSet author="tw" id="2022-04-15-01">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column"/>
        </preConditions>
        <comment>插入动态表单数据 wl_form_group_column</comment>
        <sql>
            INSERT INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000333, 'address', '地址', 'String', 132828674817, 'eq', b'0', 'r_fireControlRoom', 2581805, '2022-03-01 12:01:04');
        </sql>
    </changeSet>

    <changeSet author="chenzhao" id="2022-04-14-1">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group"/>
        </preConditions>
        <comment>add data wl_form_group</comment>
        <sql>
            INSERT INTO  wl_form_group (`id`, `group_name`, `group_code`, `group_type`, `allow_operation`, `creator_id`, `create_date`) VALUES (132828674824, '储罐', 'r_tank', 'room', 'edit,delete,room_add', 258105, '2022-04-14 10:15:10');
        </sql>
    </changeSet>



    <changeSet author="chenzhao" id="2022-04-20-1">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column"/>
        </preConditions>
        <comment>add data wl_form_group_column</comment>
        <sql>
            REPLACE INTO `wl_form_group_column` ( `id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date` ) VALUES ( 133000000344, 'bizOrgCode', '机构编码', 'String', 132828674824, 'eq', 0, 'r_tank', 2581805, '2021-12-15 17:33:56' );
            REPLACE INTO `wl_form_group_column` ( `id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date` ) VALUES ( 133000000345, 'bizOrgName', '机构/部门名称', 'String', 132828674824, 'eq', 0, 'r_tank', 2581805, '2021-12-15 17:34:04' );
            REPLACE INTO `wl_form_group_column` ( `id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000346, 'parentId', '父级id', 'String', 132828674824, 'eq', 1, 'r_tank', 2581805, '2020-12-21 17:36:14');
        </sql>
    </changeSet>

    <changeSet author="chenzhao" id="2022-04-20-2">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column"/>
        </preConditions>
        <comment>add data wl_form_group</comment>
        <sql>
            REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000334, 'companyCode', '单位编码', 'String', 132828674824, 'eq', b'0', 'r_tank', 2581805, '2022-04-18 11:29:34');
            REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000335, 'code', '储罐编号', 'String', 132828674824, 'eq', b'0', 'r_tank', 2581805, '2022-04-18 11:29:34');
            REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000336, 'name', '储罐名称', 'String', 132828674824, 'eq', b'0', 'r_tank', 2581805, '2022-04-18 11:29:34');
            REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000337, 'storageName', '储存物名称', 'String', 132828674824, 'eq', b'0', 'r_tank', 2581805, '2022-04-18 11:29:34');
            REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000338, 'storageNature', '储存物性质', 'String', 132828674824, 'eq', b'0', 'r_tank', 2581805, '2022-04-18 11:29:34');
            REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000339, 'storageForm', '储存物形式', 'String', 132828674824, 'eq', b'0', 'r_tank', 2581805, '2022-04-18 11:29:34');
            REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000340, 'storageCapacity', '储存容量', 'String', 132828674824, 'eq', b'0', 'r_tank', 2581805, '2022-04-18 11:29:34');
            REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000341, 'storagePlanName', '储罐区平面图名称', 'String', 132828674824, 'eq', b'0', 'r_tank', 2581805, '2022-04-18 11:29:34');
            REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000342, 'storagePlan', '储罐区平面图图纸', 'String', 132828674824, 'eq', b'0', 'r_tank', 2581805, '2022-04-18 11:29:34');
            REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000343, 'fireSituation', '消防设施情况', 'String', 132828674824, 'eq', b'0', 'r_tank', 2581805, '2022-04-18 11:29:34');
        </sql>
    </changeSet>

    
    <changeSet author="my" id="16504254290001-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_source_scene" columnName="source_type"/>
            </not>
        </preConditions>
        <comment>wl_source_scene add column source_type 添加组态页面关系表数据源类型字段</comment>
        <sql>
            ALTER TABLE `wl_source_scene`
			ADD COLUMN `source_type`  varchar(255) NULL COMMENT '数据源类型：building（建筑类），system（系统类）' AFTER `source_name`;
			UPDATE wl_source_scene ss
			SET ss.source_type = 'building'
			WHERE
				(
					SELECT
						count(1)
					FROM
						wl_warehouse_structure ws
					WHERE
						ws.id = ss.source_id
				) > 0;
			
			UPDATE wl_source_scene ss
			SET ss.source_type = 'system'
			WHERE
				(
					SELECT
						count(1)
					FROM
						f_fire_fighting_system ffs
					WHERE
						ffs.id = ss.source_id
				) > 0;
        </sql>
    </changeSet>

    <changeSet author="chenzhao" id="2022-04-21-1">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column"/>
        </preConditions>
        <comment>add data wl_form_group</comment>
        <sql>
            REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000347, 'inwhichBuild', '所在建筑', 'String', 132828674824, 'eq', b'0', 'r_tank', 2581805, '2022-04-18 11:29:34');
        </sql>
    </changeSet>
    
   <changeSet author="wujiang" id="2022-05-05-1" runAlways="true">
        <preConditions onFail="MARK_RAN">
          <not>
            <tableExists tableName="cb_org_usr"/>
          </not>
        </preConditions>
        <comment>add cb_org_usr</comment>
        <sql>
            CREATE TABLE `cb_org_usr` (
			  `sequence_nbr` bigint(32) NOT NULL,
			  `biz_org_name` varchar(104) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '机构/部门名称',
			  `biz_org_code` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '机构编码',
			  `amos_org_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'amos中公司/部门ID',
			  `amos_org_code` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'amos中公司/部门编码',
			  `biz_org_type` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '机构类型（部门：DEPARTMENT，单位：COMPANY，人员：PERSON）',
			  `build_name` varchar(104) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '所属建筑名称',
			  `build_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '所属建筑ID',
			  `parent_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '归属机构/部门/人员',
			  `org_expand_attr1` varchar(104) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '扩展属性1',
			  `org_expand_attr2` varchar(104) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '扩展属性2',
			  `org_expand_attr3` varchar(104) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '扩展属性3',
			  `org_expand_attr4` varchar(104) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '扩展属性4',
			  `org_expand_attr5` varchar(104) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
			  `org_expand_attr6` varchar(104) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
			  `org_expand_attr7` varchar(104) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
			  `org_expand_attr8` varchar(104) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
			  `rec_user_name` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '更新人',
			  `rec_user_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人ID',
			  `rec_date` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
			  `is_delete` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已被删除（0：未背删除，1：已删除）',
			  `parent_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '归属机构/部门/人员名称',
			  `code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '唯一编号 ： 临时用',
			  `pcz_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '测试字段 稍后删除',
			  `pcz_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '测试字段 稍后删除',
			  `is_certificate` int(10) DEFAULT 0 COMMENT '是否持证',
			  PRIMARY KEY (`sequence_nbr`) USING BTREE
			) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='机构/部门/人员表';
        </sql>
    </changeSet>
    
        
   <changeSet author="wujiang" id="2022-05-011-1" runAlways="true">
        <preConditions onFail="MARK_RAN">
          <not>
            <tableExists tableName="idx_width_report"/>
          </not>
        </preConditions>
        <comment>add idx_width_report</comment>
        <sql>
			CREATE TABLE `idx_width_report` (
			  `id` varchar(50) NOT NULL,
			  `valid` bit(1) DEFAULT NULL,
			  `record` varchar(50) DEFAULT NULL,
			  `creator` varchar(64) DEFAULT NULL,
			  `creatorName` varchar(64) DEFAULT NULL,
			  `biz_org_code` varchar(32) DEFAULT NULL,
			  `biz_org_name` varchar(255) DEFAULT NULL,
			  `complete_task_percent` double DEFAULT NULL,
			  `task_count` int(11) DEFAULT NULL,
			  `complete_task_count` int(11) DEFAULT NULL,
			  `uncomplete_task_count` int(11) DEFAULT NULL,
			  `date` varchar(32) DEFAULT NULL,
			  `problem_count` int(11) DEFAULT NULL,
			  `fixed_problem_count` int(11) DEFAULT NULL,
			  `unfixed_problem_count` int(11) DEFAULT NULL,
			  `checked_equipment_count` int(11) DEFAULT NULL,
			  `equipment_count` int(11) DEFAULT NULL,
			  `unchecked_equipment_count` int(11) DEFAULT NULL,
			  `certified_percent` double DEFAULT NULL,
			  `person_count` int(11) DEFAULT NULL,
			  `certified_person_count` int(11) DEFAULT NULL,
			  `checked_point_count` int(11) DEFAULT NULL,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8;
        </sql>
    </changeSet> 
       <changeSet author="wujiang" id="2022-05-011-2" runAlways="true">
        <preConditions onFail="MARK_RAN">
          <not>
            <tableExists tableName="idx_width_defect"/>
          </not>
        </preConditions>
        <comment>add idx_width_defect</comment>
        <sql>
			CREATE TABLE `idx_width_defect` (
			  `id` varchar(50) NOT NULL,
			  `valid` bit(1) DEFAULT NULL,
			  `record` varchar(50) DEFAULT NULL,
			  `creator` varchar(64) DEFAULT NULL,
			  `creatorName` varchar(64) DEFAULT NULL,
			  `biz_org_name` varchar(255) DEFAULT NULL,
			  `biz_org_code` varchar(255) DEFAULT NULL,
			  `org_code` varchar(255) DEFAULT NULL,
			  `defect_name` varchar(255) DEFAULT NULL,
			  `date` varchar(255) DEFAULT NULL,
			  `danger_position` varchar(255) NOT NULL,
			  `problem_description` varchar(255) NOT NULL,
			  `remark` varchar(255) NOT NULL,
			  `danger_state` varchar(255) NOT NULL,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8;
			        </sql>
    </changeSet> 

    <changeSet author="keyong" id="1652339928-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="value_label"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific add column value_label</comment>
        <sql>
            alter table `wl_equipment_specific` add column `value_label` varchar(255) DEFAULT NULL COMMENT '设备值说明' after `realtime_iot_index_value`;
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1652339928-2">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_equipment_specific" />
        </preConditions>
        <comment>wl_equipment_specific同步value_label列数据</comment>
        <sql>
            UPDATE
                wl_equipment_specific wes
            SET
                wes.value_label = ( SELECT value_label FROM wl_equipment_specific_index wesi
            WHERE
                wesi.equipment_specific_id = wes.id AND wesi.equipment_index_id = wes.realtime_iot_index_id );
        </sql>
    </changeSet>

    <changeSet author="zs" id="20220526-1">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_equipment_standard" />
        </preConditions>
        <comment>修改表wl_equipment_standard唯一索引</comment>
        <sql>
            DROP INDEX uni ON wl_equipment_standard;
            create unique index uni on wl_equipment_standard (`type`, `equipment_id`, `org_code`);
        </sql>
    </changeSet>

    <changeSet author="ls" id="20220601-1">
        <comment>`getChildListdate`</comment>
        <sql endDelimiter="#">
            DROP FUNCTION IF EXISTS `getChildListdate`#
            CREATE DEFINER=`root`@`%` FUNCTION `getChildListdate`(`p_id` VARCHAR(1000)) RETURNS varchar(5000) CHARSET latin1
            BEGIN
            DECLARE sTemp TEXT;
            DECLARE sTempChd VARCHAR(5000);
            SET sTemp='';
            SET sTempChd = CAST(p_id AS CHAR);
            WHILE sTempChd IS NOT NULL  DO

            SET sTemp = CONCAT(sTemp,',',sTempChd);

            SELECT GROUP_CONCAT(distinct a.instance_id) INTO sTempChd FROM


            (select wl_form_instance.instance_id ,wl_form_instance.field_value  from wl_form_instance  where wl_form_instance.group_type in('building','room','floor') and field_name='parentId') a

            WHERE FIND_IN_SET(a.field_value,sTempChd) > 0;

            END WHILE;
            RETURN    SUBSTRING(sTemp,LENGTH(CONCAT(',',p_id))+1);
            END
        </sql>
    </changeSet>

    <changeSet author="zs" id="202209131015-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="f_fire_fighting_system" columnName="design_org"/>
            </not>
        </preConditions>
        <comment>任务9322 系统基础属性加字段</comment>
        <sql>
            ALTER TABLE `f_fire_fighting_system` ADD COLUMN `design_org` varchar(255) DEFAULT NULL COMMENT '设计单位',
            ADD COLUMN `lead_designer` varchar(255) DEFAULT NULL COMMENT '主要设计人员';
        </sql>
    </changeSet>
    <changeSet author="tianyiming" id="20220922tianyiming">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="f_fire_fighting_system" columnName="design_org_telephone"/>
            </not>
        </preConditions>
        <comment>f_fire_fighting_system add design_org_telephone</comment>
        <sql>
            ALTER TABLE `f_fire_fighting_system`
                ADD COLUMN `design_org_telephone` varchar(32) NULL COMMENT '设计单位联系方式';
        </sql>
    </changeSet>

    <changeSet author="keyong" id="1664185585-1">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_equipment_specific_alarm" columnName="confirm_type"/>
        </preConditions>
        <comment>删除不需要的属性字段</comment>
        <sql>
            ALTER TABLE `wl_equipment_specific_alarm` DROP COLUMN `confirm_type`;
            ALTER TABLE `wl_equipment_specific_alarm` DROP COLUMN `alam_reason`;
            ALTER TABLE `wl_equipment_specific_alarm` DROP COLUMN `resolve_result`;
            ALTER TABLE `wl_equipment_specific_alarm` DROP COLUMN `confirm_user`;
            ALTER TABLE `wl_equipment_specific_alarm` DROP COLUMN `confirm_user_name`;
            ALTER TABLE `wl_equipment_specific_alarm` DROP COLUMN `confirm_date`;
        </sql>
    </changeSet>
    <changeSet author="tianyiming" id="20221011tianyiming" runAlways="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_supervision_video"/>
            </not>
        </preConditions>
        <comment>add wl_supervision_video</comment>
        <sql>
            CREATE TABLE `wl_supervision_video` (
                                                    `id` bigint(20) NOT NULL,
                                                    `biz_org_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '所属公司',
                                                    `camera_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '摄像头id',
                                                    `create_date` datetime DEFAULT NULL COMMENT '添加时间',
                                                    PRIMARY KEY (`id`)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
        </sql>
    </changeSet>
    <changeSet author="xxz" id="20221013xxz" runAlways="true">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_marquee_data"/>
            </not>
        </preConditions>
        <comment>add wl_marquee_data</comment>
        <sql>
            CREATE TABLE `wl_marquee_data`  (
            `id` bigint(20) NOT NULL,
            `type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型',
            `position` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '位置',
            `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备名称',
            `create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
            `message_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息类型',
            `is_read` int(10) NULL DEFAULT NULL COMMENT '是否已读【0：未读；1：已读】',
            `equipment_specific_id` bigint(20) NULL DEFAULT NULL,
            PRIMARY KEY (`id`) USING BTREE
            ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>
    <changeSet author="tianyiming" id="202211031846">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group" />
            <primaryKeyExists primaryKeyName="id" tableName="wl_form_group"/>
        </preConditions>
        <comment>add data wl_form_group</comment>
        <sql>
            REPLACE INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000322, 'latitude', '纬度', 'String', 132828674817, 'eq', b'0', 'r_fireControlRoom', 2581805, '2022-03-01 12:01:04');
            REPLACE INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000323, 'longitude', '经度', 'String', 132828674817, 'eq', b'0', 'r_fireControlRoom', 2581805, '2022-03-01 12:04:47');
        </sql>
    </changeSet>

    <changeSet author="ls" id="20230201-1" runAlways="true">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="idx_width_report"/>
        </preConditions>
        <dropTable tableName="idx_width_report"/>
    </changeSet>

    <changeSet author="ls" id="20230201-2" runAlways="true">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="idx_width_defect"/>
        </preConditions>
        <dropTable tableName="idx_width_defect"/>
    </changeSet>

    <changeSet author="ls" id="20230209-1">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_equipment_specific_alarm_log" />
        </preConditions>
        <comment>添加索引 index_equipment_code</comment>
        <sql>
            create index index_equipment_code on wl_equipment_specific_alarm_log (`equipment_code`);
        </sql>
    </changeSet>


    <changeSet author="ls" id="202300406-1" >
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_car_mileage"/>
            </not>
        </preConditions>
        <comment>add wl_car_mileage</comment>
        <sql>
            CREATE TABLE `wl_car_mileage`  (
            `id` bigint(0) NOT NULL,
            `iot_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'iot编码',
            `travel` double(11, 1) NULL DEFAULT NULL COMMENT '里程km',
            `date` date NULL DEFAULT NULL COMMENT '日期',
            `start_time` datetime(0) NULL DEFAULT NULL COMMENT '开始时间',
            `end_time` datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
            `take_time` bigint(0) NULL DEFAULT NULL COMMENT '耗时',
            `start_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开始地址',
            `end_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '结束地址',
            `start_longitude` double(20, 6) NULL DEFAULT NULL COMMENT '开始精度',
            `start_latitude` double(20, 6) NULL DEFAULT NULL COMMENT '开始纬度',
            `end_longitude` double(20, 6) NULL DEFAULT NULL COMMENT '结束精度',
            `end_latitude` double(20, 6) NULL DEFAULT NULL COMMENT '结束纬度',
            `start_speed` int(0) NULL DEFAULT NULL COMMENT '开始速度km/h',
            `end_speed` int(0) NULL DEFAULT NULL COMMENT '结束速度km/h',
            `create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
            PRIMARY KEY (`id`) USING BTREE
            ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '车量里程表' ROW_FORMAT = Dynamic;

        </sql>
    </changeSet>


    <changeSet author="ls" id="202300406-2" >
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_car" columnName="deployment"/>
            </not>
        </preConditions>
        <comment>wl_car add displacement,ownership,code,extra1,extra2,extra3,extra4,longitude,latitude</comment>
        <sql>
            ALTER TABLE `wl_car`
            ADD COLUMN `deployment` varchar(255) NULL COMMENT '配备方式';
            ALTER TABLE `wl_car`
            ADD COLUMN `deploy_date` varchar(50) NULL COMMENT '配备日期';
            ALTER TABLE `wl_car`
            ADD COLUMN `deploy_date_range` varchar(100) NULL COMMENT '配备日期区间';
            ALTER TABLE `wl_car`
            ADD COLUMN `displacement` varchar(255) NULL COMMENT '排量';
            ALTER TABLE `wl_car`
            ADD COLUMN `ownership` varchar(255) NULL COMMENT '车辆产权单位';
            ALTER TABLE `wl_car`
            ADD COLUMN `code` varchar(255) NULL COMMENT '编号';
            ALTER TABLE `wl_car`
            ADD COLUMN `extra1` varchar(255) NULL COMMENT '扩展字段1';
            ALTER TABLE `wl_car`
            ADD COLUMN `extra2` varchar(255) NULL COMMENT '扩展字段2';
            ALTER TABLE `wl_car`
            ADD COLUMN `extra3` varchar(255) NULL COMMENT '扩展字段3';
            ALTER TABLE `wl_car`
            ADD COLUMN `extra4` varchar(255) NULL COMMENT '扩展字段4';
            ALTER TABLE `wl_car`
            ADD COLUMN `longitude` double(20, 6) NULL COMMENT '经度';
            ALTER TABLE `wl_car`
            ADD COLUMN `latitude` double(20, 6) NULL COMMENT '纬度';
        </sql>
    </changeSet>
</databaseChangeLog>