<?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="gaojianqiang" id="20220624-1732-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_index" columnName="trace_id"/>
            </not>
        </preConditions>
        <comment>新增属性字段 trace_id</comment>
        <sql>
            alter table `wl_equipment_specific_index` add column `trace_id` varchar(64) DEFAULT NULL COMMENT 'iot数据上报唯一id';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="20220624-1732-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm" columnName="trace_id"/>
            </not>
        </preConditions>
        <comment>新增属性字段 trace_id</comment>
        <sql>
            alter table `wl_equipment_specific_alarm` add column `trace_id` varchar(64) DEFAULT NULL COMMENT 'iot数据上报唯一id';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="20220624-1732-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm_log" columnName="trace_id"/>
            </not>
        </preConditions>
        <comment>新增属性字段 trace_id</comment>
        <sql>
            alter table `wl_equipment_specific_alarm_log` add column `trace_id` varchar(64) DEFAULT NULL COMMENT 'iot数据上报唯一id';
        </sql>
    </changeSet>

    <changeSet author="zs" id="20220719-1417-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_category" columnName="image"/>
            </not>
        </preConditions>
        <comment>新增属性字段 image</comment>
        <sql>
            alter table `wl_equipment_category` add column `image` varchar(1000) DEFAULT NULL COMMENT '图片';
        </sql>
    </changeSet>

    <changeSet author="ky" id="1671100692">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="cb_org_usr" columnName="is_firefighters"/>
            </not>
        </preConditions>
        <comment>新增属性字段is_firefighters</comment>
        <sql>
            alter table `cb_org_usr` add column `is_firefighters` varchar(10) DEFAULT '0' COMMENT '是否是消防人员0-否 1-是';
        </sql>
    </changeSet>
    <changeSet author="ky" id="1671100692-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="cb_org_usr" columnName="type_code"/>
            </not>
        </preConditions>
        <comment>新增属性字段 type_code</comment>
        <sql>
            alter table `cb_org_usr` add column `type_code` varchar(255) DEFAULT NULL COMMENT '消防队类型';
        </sql>
    </changeSet>
    <changeSet author="ky" id="1671100692-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="cb_org_usr" columnName="is_certificate"/>
            </not>
        </preConditions>
        <comment>新增属性字段is_certificate</comment>
        <sql>
            alter table `cb_org_usr` add column `is_certificate` int(10) DEFAULT 0 COMMENT '是否持证';
        </sql>
    </changeSet>

    <changeSet author="zs" id="202207220937-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="cb_water_resource"/>
            </not>
        </preConditions>
        <comment>create table cb_water_resource 水源表</comment>
        <sql>
            CREATE TABLE `cb_water_resource`  (
            `sequence_nbr` bigint(32) NOT NULL COMMENT '唯一主键',
            `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '资源名称',
            `address` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址',
            `resource_type` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '资源类型（消火栓、消防水鹤、天然水源、消防水池）',
            `resource_type_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '资源类型（消火栓、消防水鹤、天然水源、消防水池）',
            `belong_building_id` bigint(32) NULL DEFAULT NULL COMMENT '所在建筑id',
            `belong_building` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所在建筑',
            `belong_fighting_system_id` bigint(32) NULL DEFAULT NULL COMMENT '所属消防系统id',
            `belong_fighting_system` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属消防系统',
            `management_unit_id` bigint(32) NULL DEFAULT NULL COMMENT '管理单位id',
            `management_unit` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '管理单位',
            `maintenance_unit_id` bigint(32) NULL DEFAULT NULL COMMENT '维保单位id',
            `maintenance_unit` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '维保单位',
            `build_date` datetime(0) NULL DEFAULT NULL COMMENT '建造日期',
            `enable_date` datetime(0) NULL DEFAULT NULL COMMENT '启用日期',
            `orientation_img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '方位图',
            `reality_img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实景图',
            `contact_user` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人姓名',
            `contact_phone` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人电话',
            `is_iot` bit(1) NULL DEFAULT b'1' COMMENT '是否有物联参数（1有，0没有）',
            `rescue_org_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '消防救援机构_通用唯一识别码',
            `administrative_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '行政区划代码',
            `rec_user_id` bigint(32) NULL DEFAULT NULL COMMENT '更新人员id',
            `rec_user_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人员',
            `rec_date` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间',
            `is_delete` bit(1) NULL DEFAULT b'1' COMMENT '是否启用（1启用、0未启用）',
            `org_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组织机构代码',
            `longitude` double(18, 14) NULL DEFAULT NULL COMMENT '经度',
            `latitude` double(18, 14) NULL DEFAULT NULL COMMENT '纬度',
            `equip_id` bigint(20) NULL DEFAULT NULL COMMENT '设施定义',
            `equip_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设施定义名称',
            `equip_category_id` bigint(20) NULL DEFAULT NULL COMMENT '设施分类',
            `equip_category_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设施分类名称',
            `equip_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设施编码',
            `maintenance_period` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '维保周期',
            `biz_org_code` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构编码',
            `equip_category_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设施分类编码',
            `biz_org_name` varchar(104) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构/部门名称',
            `contact_user_id` bigint(20) NULL DEFAULT NULL COMMENT '联系人id',
            PRIMARY KEY (`sequence_nbr`) USING BTREE
            ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '水源基本信息' ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>

    <changeSet author="zs" id="202207220937-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="cb_water_resource_pool"/>
            </not>
        </preConditions>
        <comment>create table cb_water_resource_pool 水源关联的水池表</comment>
        <sql>
            CREATE TABLE `cb_water_resource_pool`  (
            `sequence_nbr` bigint(32) NOT NULL COMMENT '主键',
            `resource_id` bigint(32) NOT NULL COMMENT '资源id',
            `volume` float(10, 2) NULL DEFAULT NULL COMMENT '容积（m³）',
            `status_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '水源可用状态类别代码',
            `status` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '水源可用状态类别名称',
            `section` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属路段',
            `intake_form` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '取水方式',
            `intake_height` float(10, 1) NULL DEFAULT NULL COMMENT '取水高度(cm)',
            `elevation_difference` float(10, 1) NULL DEFAULT NULL COMMENT '水源标高差(cm)',
            `parking_position` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '停车位置',
            `parking_num` int(11) NULL DEFAULT NULL COMMENT '停车数量(个)',
            `pipe_type_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '消防给水管网形式类型代码',
            `pipe_type_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '消防给水管网形式类型名称',
            `water_supply_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '供水单位名称',
            `rec_user_id` bigint(32) NULL DEFAULT NULL COMMENT '更新人员id',
            `rec_user_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人员',
            `rec_date` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间',
            `is_delete` bit(1) NULL DEFAULT b'0' COMMENT '是否删除（1删除、0未删除）',
            `min_water_level` float(10, 2) NULL DEFAULT NULL COMMENT '最低报警水位',
            `max_water_level` float(10, 2) NULL DEFAULT NULL COMMENT '最高报警水位',
            `level_device_id` bigint(32) NULL DEFAULT NULL COMMENT '水池液位显示装置id',
            `level_device_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '水池液位显示装置名称',
            PRIMARY KEY (`sequence_nbr`) USING BTREE
            ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '消防水池' ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>
    <changeSet author="litw" id="2022-0804equ-ltw">
        <comment>更新表wl_form_group_column属性字段值</comment>
        <sql>
            UPDATE `wl_form_group_column` SET `field_name` = 'code', `field_label` = '储罐编号', `data_type` = 'String', `group_id` = 132828674824, `query_strategy` = 'like', `not_null` = b'0', `group_code` = 'r_tank', `creator_id` = 2581805, `create_date` = '2022-08-04 03:04:01' WHERE `id` = 133000000335;
        </sql>
    </changeSet>

    <changeSet author="ls" id="202208091354-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_detail" columnName="delivery_date"/>
            </not>
        </preConditions>
        <comment>新增字段 delivery_date</comment>
        <sql>
            alter table `wl_equipment_detail` add column `delivery_date` datetime DEFAULT NULL COMMENT '投运日期';
        </sql>
    </changeSet>
    <changeSet author="ltw" id="20220831-ltw22">
        <preConditions onFail="MARK_RAN">
               <tableExists tableName="wl_form_group_column"/>
        </preConditions>
        <comment>插入动态表单数据 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 ('133000000308', 'longitude', '经度', 'String', '132828674811', 'eq', b'0', 'fireControlRoom', '2581805', '2022-03-01 12:04:47');
            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 ('133000000309', 'longitude', '经度', 'String', '132828674812', 'eq', b'0', 'pool', '2581805', '2022-03-01 12:04:47');
            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 ('133000000310', 'longitude', '经度', 'String', '132828674813', 'eq', b'0', 'fireRoom', '2581805', '2022-03-01 12:04:47');
            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 ('133000000311', 'longitude', '经度', 'String', '132828674814', 'eq', b'0', 'rainRoom', '2581805', '2022-03-01 12:04:47');
            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 ('133000000312', 'longitude', '经度', 'String', '132828674815', 'eq', b'0', 'fireFoamRoom', '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 ('133000000313', 'latitude', '纬度', 'String', '132828674811', 'eq', b'0', 'fireControlRoom', '2581805', '2022-03-01 12:04:47');
            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 ('133000000314', 'latitude', '纬度', 'String', '132828674812', 'eq', b'0', 'pool', '2581805', '2022-03-01 12:04:47');
            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 ('133000000315', 'latitude', '纬度', 'String', '132828674813', 'eq', b'0', 'fireRoom', '2581805', '2022-03-01 12:04:47');
            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 ('133000000316', 'latitude', '纬度', 'String', '132828674814', 'eq', b'0', 'rainRoom', '2581805', '2022-03-01 12:04:47');
            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 ('133000000317', 'latitude', '纬度', 'String', '132828674815', 'eq', b'0', 'fireFoamRoom', '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 ('133000000318', 'address', '地址', 'String', '132828674811', 'eq', b'0', '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 ('133000000319', 'address', '地址', 'String', '132828674817', 'eq', b'0', 'r_fireControlRoom', '2581805', '2022-03-01 12:01:04');
        </sql>
    </changeSet>


    <changeSet author="zs" id="202210101651">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="cb_water_resource_pool"/>
        </preConditions>
        <comment>修改液位显示装置字段类型->需求2022 一个水池可选多个 装置</comment>
        <sql>
            ALTER TABLE `cb_water_resource_pool` MODIFY COLUMN `level_device_id` varchar(255) NULL DEFAULT NULL COMMENT '水池液位显示装置id';
        </sql>
    </changeSet>
    <changeSet author="ltw" id="202210111354-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="warranty_info"/>
            </not>
        </preConditions>
        <comment>新增字段 warranty_info,warranty_period</comment>
        <sql>
            alter table `wl_equipment_specific` add column `warranty_info` varchar(500) DEFAULT NULL COMMENT '质保信息';
            alter table `wl_equipment_specific` add column `warranty_period` datetime DEFAULT NULL COMMENT '质保周期';
        </sql>
    </changeSet>
    <changeSet author="ltw" id="202210111354-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment" columnName="expiry_date"/>
            </not>
        </preConditions>
        <comment>新增字段 expiry_date 报废期限</comment>
        <sql>
            alter table `wl_equipment` add column `expiry_date` decimal(12,0) DEFAULT NULL COMMENT '报废期限';
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="20221011-1729-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`, `image`) VALUES (1547790305762250754, '1438771726480601090', '93060600', '消防水箱', 0, NULL, NULL, '2022-07-15 11:49:00', '2', 'upload/equipment_category_icon/industryPool.png');
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="20221011-1729-2">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column"/>
        </preConditions>
        <comment>物联设备增加模拟量阈值 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 (133000000350, 'minLevel', '最低报警液位(m)', 'inputNumber', 132828674825, 'eq', b'0', '92031900', 2581805, '2022-10-09 09:24:35');
            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 (133000000351, 'maxLevel', '最高报警液位(m)', 'inputNumber', 132828674825, 'eq', b'0', '92031900', 2581805, '2022-10-09 09:24:36');
            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 (133000000352, 'volume', '泡沫液罐容积(m³)', 'inputNumber', 132828674825, 'eq', b'0', '92031900', 2581805, '2022-10-09 09:24:37');
            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 (133000000353, 'minPressure', '最低报警压力(Mpa)', 'inputNumber', 132828674826, 'eq', b'0', '92011000', 2581805, '2022-10-09 09:24:38');
            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 (133000000354, 'maxPressure', '最高报警压力(Mpa)', 'inputNumber', 132828674826, 'eq', b'0', '92011000', 2581805, '2022-10-09 09:24:39');
            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 (133000000355, 'minFlow', '最低报警流量(L/S)', 'inputNumber', 132828674827, 'eq', b'0', '92010700', 2581805, '2022-10-09 09:24:39');
            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 (133000000356, 'maxFlow', '最高报警流量(L/S)', 'inputNumber', 132828674827, 'eq', b'0', '92010700', 2581805, '2022-10-09 09:24:40');
        </sql>
    </changeSet>
    <changeSet author="tym" id="202210131720">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="cb_water_resource_pool"/>
        </preConditions>
        <comment>修改液位显示装置id和name字段长度</comment>
        <sql>
            ALTER TABLE `cb_water_resource_pool`
                MODIFY COLUMN `level_device_id` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '水池液位显示装置id',
                MODIFY COLUMN `level_device_name` varchar(1500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '水池液位显示装置名称';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="202210131721-1">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group"/>
        </preConditions>
        <comment>添加特殊设备字段</comment>
        <sql>
            REPLACE INTO `wl_form_group`(`id`, `group_name`, `group_code`, `group_type`, `allow_operation`, `creator_id`, `create_date`) VALUES (132828674825, 'CAFS泡沫罐', '92031900', 'equip', 'edit,delete', 2581805, '2022-10-09 03:36:43');
            REPLACE INTO `wl_form_group`(`id`, `group_name`, `group_code`, `group_type`, `allow_operation`, `creator_id`, `create_date`) VALUES (132828674826, '管网压力探测器', '92011000', 'equip', 'edit,delete', 2581805, '2022-10-09 03:36:44');
            REPLACE INTO `wl_form_group`(`id`, `group_name`, `group_code`, `group_type`, `allow_operation`, `creator_id`, `create_date`) VALUES (132828674827, '消防水池装置', '92010700', 'equip', 'edit,delete', 2581805, '2022-10-09 03:36:44');
        </sql>
    </changeSet>
    <changeSet author="keyong" id="202210131888-1">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_equipment"/>
        </preConditions>
        <comment>添加基础字段</comment>
        <sql>
            REPLACE INTO `wl_equipment`(`id`, `name`, `code`, `category_id`, `country`, `maintenance_cycle`, `check_cycle`, `remark`, `management_style`, `reviser_id`, `date_updated`, `creater_id`, `unit_id`, `made_in`, `manufacturer`, `img`, `video`, `mark_specification`, `supplier_id`, `pref_quota`, `create_date`, `company_name`, `department_orgcode`, `department_name`, `inspection_spec`, `maintenance_spec`, `area`, `is_iot`, `clean_type`, `expiry_date`) VALUES (1578945741864742914, '消防水箱', '93060600HQK44', 1547790305762250754, NULL, NULL, NULL, NULL, NULL, NULL, '2022-10-09 11:10:28', NULL, 55, NULL, NULL, 'upload/state_grid/studio_normalapp_3056965/D0D194CE38EA9F604B401F1BFCC31975.jpg', NULL, NULL, NULL, NULL, '2022-10-09 11:09:35', NULL, NULL, NULL, NULL, NULL, NULL, '1', '0', NULL);
        </sql>
    </changeSet>
    <changeSet author="keyong" id="202210131888-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm_log" columnName="defect_batch_id"/>
            </not>
        </preConditions>
        <comment>新增属性字段 defect_batch_id</comment>
        <sql>
            alter table `wl_equipment_specific_alarm_log` add column `defect_batch_id` varchar(64) DEFAULT NULL COMMENT '缺陷表批次号';
        </sql>
    </changeSet>


    <changeSet author="ls" id="202207221028-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_form_group_column_equip"/>
            </not>
        </preConditions>
        <comment>create table wl_form_group_column_equip 分组字段表</comment>
        <sql>
            CREATE TABLE `wl_form_group_column_equip`  (
            `id` bigint(20) NOT NULL,
            `field_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字段名',
            `field_label` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '中文名',
            `data_type` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '数据类型：文本，数字，枚举,日期',
            `group_id` bigint(20) NOT NULL COMMENT '字段分组主键',
            `query_strategy` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '查询策略;全等,模糊,区间',
            `not_null` bit(1) NOT NULL DEFAULT b'0' COMMENT '不能为空',
            `group_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '所属分组编号',
            `creator_id` bigint(20) NOT NULL COMMENT '创建者',
            `create_date` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建日期',
            PRIMARY KEY (`id`) USING BTREE,
            UNIQUE INDEX `unique_idx_group_code_file_name`(`group_code`, `field_name`) USING BTREE
            ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '分组字段表' ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>

    <changeSet author="ls" id="202207221028-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_form_group_equip"/>
            </not>
        </preConditions>
        <comment>create table wl_form_group_equip  分组表</comment>
        <sql>
            CREATE TABLE `wl_form_group_equip`  (
            `id` bigint(20) NOT NULL COMMENT '物理主键',
            `group_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '分组名称',
            `group_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '分组编号',
            `group_type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '分组类型（点位图过滤用）',
            `allow_operation` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '允许的操作（逗号分隔ids）',
            `creator_id` bigint(20) NOT NULL COMMENT '更新者id',
            `create_date` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新日期',
            PRIMARY KEY (`id`) USING BTREE,
            UNIQUE INDEX `unique_idx_group_code`(`group_code`) USING BTREE
            ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '分组表' ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>


    <changeSet author="ls" id="202207221028-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_form_instance_equip"/>
            </not>
        </preConditions>
        <comment>create table wl_form_instance_equip  实例表</comment>
        <sql>
            CREATE TABLE `wl_form_instance_equip`  (
            `id` bigint(20) NOT NULL,
            `field_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '字段名',
            `field_label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '中文名',
            `data_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '数据类型：文本，数字，枚举,日期',
            `group_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '分组类型(冗余字段便于查询）',
            `group_id` bigint(20) NOT NULL COMMENT '字段分组id',
            `field_value` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '动态配置字段的值',
            `instance_id` bigint(20) NOT NULL COMMENT '设备实例id',
            `group_column_id` bigint(20) NOT NULL COMMENT '字段定义信息的主键',
            `query_strategy` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '查询策略;全等,模糊,区间',
            `group_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '分组编号',
            `creator_id` bigint(20) NOT NULL COMMENT '创建者',
            `create_date` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建日期',
            PRIMARY KEY (`id`) USING BTREE,
            UNIQUE INDEX `u_idx_instance_id`(`instance_id`, `field_name`) USING BTREE,
            INDEX `idx_group_code`(`group_code`) USING BTREE,
            INDEX `pk_build_instance_id`(`instance_id`) USING BTREE
            ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '实例表' ROW_FORMAT = Dynamic;

        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="20221116-1152-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm_log" columnName="biz_org_name"/>
            </not>
        </preConditions>
        <comment>新增属性字段 biz_org_name</comment>
        <sql>
            ALTER TABLE `wl_equipment_specific_alarm_log` ADD COLUMN `biz_org_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构/部门名称' AFTER `defect_batch_id`;
        </sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="20221116-1152-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm_log" columnName="biz_org_code"/>
            </not>
        </preConditions>
        <comment>新增属性字段 biz_org_code</comment>
        <sql>
            ALTER TABLE `wl_equipment_specific_alarm_log` ADD COLUMN `biz_org_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构编码' AFTER `biz_org_name`;
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1668587039">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_equipment_specific_alarm_log" />
        </preConditions>
        <comment>sync field</comment>
        <sql>
            UPDATE wl_equipment_specific_alarm_log wesal
            SET wesal.biz_org_name = ( SELECT biz_org_name FROM wl_equipment_specific wes WHERE wes.id = wesal.equipment_specific_id ),
                wesal.biz_org_code = ( SELECT biz_org_code FROM wl_equipment_specific wes WHERE wes.id = wesal.equipment_specific_id );
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1668587039-1">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_equipment_specific_alarm_log" columnName="clean_time"/>
        </preConditions>
        <comment>sync field</comment>
        <sql>
            ALTER TABLE `wl_equipment_specific_alarm_log` MODIFY `clean_time` datetime DEFAULT NULL COMMENT '消除时间';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1668587039-2">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_equipment"/>
        </preConditions>
        <comment>添加基础字段</comment>
        <sql>
            REPLACE INTO `wl_equipment`(`id`, `name`, `code`, `category_id`, `country`, `maintenance_cycle`, `check_cycle`, `remark`, `management_style`, `reviser_id`, `date_updated`, `creater_id`, `unit_id`, `made_in`, `manufacturer`, `img`, `video`, `mark_specification`, `supplier_id`, `pref_quota`, `create_date`, `company_name`, `department_orgcode`, `department_name`, `inspection_spec`, `maintenance_spec`, `area`, `is_iot`, `clean_type`) VALUES (1463079835982106626, '消防水鹤', '93060200KOI44', 1438772365205991426, NULL, NULL, NULL, NULL, NULL, NULL, '2022-03-14 13:40:54', NULL, 55, NULL, NULL, 'upload/jcs/studio_normalapp_3157169/E5F46D5CF35D2DF1F62971DA166C18C.png', NULL, NULL, NULL, NULL, '2021-11-23 17:39:50', NULL, NULL, NULL, NULL, NULL, NULL, '0', '0');
            REPLACE INTO `wl_equipment`(`id`, `name`, `code`, `category_id`, `country`, `maintenance_cycle`, `check_cycle`, `remark`, `management_style`, `reviser_id`, `date_updated`, `creater_id`, `unit_id`, `made_in`, `manufacturer`, `img`, `video`, `mark_specification`, `supplier_id`, `pref_quota`, `create_date`, `company_name`, `department_orgcode`, `department_name`, `inspection_spec`, `maintenance_spec`, `area`, `is_iot`, `clean_type`) VALUES (1583285119978835970, '工业水池', '93060500F6A44', 1579292738841481218, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 104, NULL, NULL, 'upload/jcs/studio_normalapp_3157169/65BA2E0B6489024DA0B9F98EC189.png', NULL, NULL, NULL, NULL, '2022-10-21 10:32:43', NULL, NULL, NULL, NULL, NULL, NULL, '0', '0');
            REPLACE INTO `wl_equipment`(`id`, `name`, `code`, `category_id`, `country`, `maintenance_cycle`, `check_cycle`, `remark`, `management_style`, `reviser_id`, `date_updated`, `creater_id`, `unit_id`, `made_in`, `manufacturer`, `img`, `video`, `mark_specification`, `supplier_id`, `pref_quota`, `create_date`, `company_name`, `department_orgcode`, `department_name`, `inspection_spec`, `maintenance_spec`, `area`, `is_iot`, `clean_type`) VALUES (1463080224227856386, '天然水源', '93060300GJY44', 1438772459552665602, NULL, NULL, NULL, NULL, NULL, NULL, '2022-03-14 13:50:55', NULL, 55, NULL, NULL, 'upload/jcs/studio_normalapp_3157169/C8A1D43C46892D78B76315B4C2B67BC.png', NULL, NULL, NULL, NULL, '2021-11-23 17:41:23', NULL, NULL, NULL, NULL, NULL, NULL, '0', '0');
        </sql>
    </changeSet>

    <changeSet author="tw" id="20221121-01"  runAlways="true">
        <comment>`getBuildingParentIds`</comment>
        <sql endDelimiter="#">
            DROP FUNCTION IF EXISTS `getBuildingParentIds`#
            CREATE DEFINER=`root`@`%` FUNCTION `getBuildingParentIds`(rootId bigint) RETURNS varchar(1000) CHARSET utf8mb4
            DETERMINISTIC
            BEGIN
            DECLARE fid bigint default 0;
            DECLARE str varchar(1000) default  concat(rootId, '');

            WHILE rootId != 0  do
            SET fid =(SELECT parentid FROM get_building_tree WHERE instanceId = rootId);
            IF fid != 0 THEN
            SET str = concat(str, ',', fid);
            SET rootId = fid;
            ELSE
            SET rootId = fid;
            END IF;
            END WHILE;
            return str;
            END#
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1668587041">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm_log" columnName="station_name"/>
            </not>
        </preConditions>
        <comment>新增站属性字段</comment>
        <sql>
            ALTER TABLE `wl_equipment_specific_alarm_log` ADD COLUMN `station_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '换流站名称';
            ALTER TABLE `wl_equipment_specific_alarm_log` ADD COLUMN `station_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '换流站编码';
        </sql>
    </changeSet>

    <changeSet author="tw" id="20221208-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="idx_biz_station_info" columnName="warehouse_id"/>
            </not>
        </preConditions>
        <comment>新增属性字段 warehouse_id</comment>
        <sql>
            alter table `idx_biz_station_info` add column `warehouse_id` bigint(32)  COMMENT '仓库id';
        </sql>
    </changeSet>


    <changeSet author="tw" id="20221208-2">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="idx_biz_station_info"/>
        </preConditions>
        <comment>修改字段</comment>
        <sql>
            REPLACE  INTO `idx_biz_station_info`(`name`, `code`, `id`, `warehouse_id`) VALUES ('灵州换流站', 'GW290302', '1559085293783519233', 0);

        </sql>
    </changeSet>


<!--    未找到这个字段有 liqubase维护，已添加判断，字段存在的话就不走这-->
    <changeSet author="zs" id="2022-12-10-01">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="cb_org_usr" columnName="job_title"/>
            </not>
        </preConditions>
        <sql>
            alter table cb_org_usr add column job_title varchar(3000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '岗位名称'
        </sql>
    </changeSet>

    <changeSet author="zs" id="2022-12-10-02">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="cb_org_usr" columnName="job_title"/>
        </preConditions>
        <comment>修改属性字段 job_title</comment>
        <sql>
            alter table `cb_org_usr` MODIFY COLUMN `job_title` varchar(3000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '岗位名称';
        </sql>
    </changeSet>


    <changeSet author="tw" id="20221213-001">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="idx_biz_station_info" columnName="warehouse_id"/>
        </preConditions>
        <comment>删除字段</comment>
        <sql>
            alter table idx_biz_station_info DROP COLUMN warehouse_id;
        </sql>
    </changeSet>

    <changeSet author="tw" id="2022-12-12-21">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_video" columnName="address"/>
            </not>
        </preConditions>
        <sql>
            alter table `wl_video` MODIFY COLUMN `address` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '地址';
        </sql>
    </changeSet>

    <changeSet author="keyong" id="1670919999-1">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_equip"/>
        </preConditions>
        <comment>新增CAFS水箱属性字段</comment>
        <sql>
            REPLACE INTO `wl_form_group_equip`(`id`, `group_name`, `group_code`, `group_type`, `allow_operation`, `creator_id`, `create_date`) VALUES (132828674828, 'CAFS-水箱', '92032000', 'equip', 'edit,delete', 2581805, '2022-12-12 03:36:44');
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1670919999-2">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column_equip"/>
        </preConditions>
        <comment>新增CAFS水箱属性字段</comment>
        <sql>
            REPLACE INTO `wl_form_group_column_equip`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000357, 'minLevel', '最低报警液位(m)', 'inputNumber', 132828674828, 'eq', b'0', '92032000', 2581805, '2022-12-12 09:24:35');
            REPLACE INTO `wl_form_group_column_equip`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000358, 'maxLevel', '最高报警液位(m)', 'inputNumber', 132828674828, 'eq', b'0', '92032000', 2581805, '2022-12-12 09:24:36');
            REPLACE INTO `wl_form_group_column_equip`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000359, 'volume', '水箱容积(m³)', 'inputNumber', 132828674828, 'eq', b'0', '92032000', 2581805, '2022-12-12 09:24:37');
        </sql>
    </changeSet>
    <changeSet author="tianyiming" id="202212141220">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_alarm" columnName="biz_org_name"/>
            </not>
        </preConditions>
        <comment>新增站属性字段</comment>
        <sql>
            ALTER TABLE `wl_equipment_specific_alarm` ADD COLUMN `biz_org_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构/部门名称';
            ALTER TABLE `wl_equipment_specific_alarm` ADD COLUMN `biz_org_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构编码';
            ALTER TABLE `wl_equipment_specific_alarm` ADD COLUMN `station_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '换流站名称';
            ALTER TABLE `wl_equipment_specific_alarm` ADD COLUMN `station_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '换流站编码';
        </sql>
    </changeSet>

    <changeSet author="keyong" id="1672299479-1">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_equip"/>
        </preConditions>
        <comment>新增特殊三类装备字段</comment>
        <sql>
            REPLACE INTO `wl_form_group_equip`(`id`, `group_name`, `group_code`, `group_type`, `allow_operation`, `creator_id`, `create_date`) VALUES (132828674825, 'CAFS泡沫罐', '92031900', 'equip', 'edit,delete', 2581805, '2022-10-09 03:36:43');
            REPLACE INTO `wl_form_group_equip`(`id`, `group_name`, `group_code`, `group_type`, `allow_operation`, `creator_id`, `create_date`) VALUES (132828674826, '管网压力探测器', '92011000', 'equip', 'edit,delete', 2581805, '2022-10-09 03:36:44');
            REPLACE INTO `wl_form_group_equip`(`id`, `group_name`, `group_code`, `group_type`, `allow_operation`, `creator_id`, `create_date`) VALUES (132828674827, '消防水池装置', '92010700', 'equip', 'edit,delete', 2581805, '2022-10-09 03:36:44');
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1672299479-2">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_form_group_column_equip"/>
        </preConditions>
        <comment>新增特殊三类装备属性字段</comment>
        <sql>
            REPLACE INTO `wl_form_group_column_equip`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000350, 'minLevel', '最低报警液位(m)', 'inputNumber', 132828674825, 'eq', b'0', '92031900', 2581805, '2022-10-09 09:24:35');
            REPLACE INTO `wl_form_group_column_equip`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000351, 'maxLevel', '最高报警液位(m)', 'inputNumber', 132828674825, 'eq', b'0', '92031900', 2581805, '2022-10-09 09:24:36');
            REPLACE INTO `wl_form_group_column_equip`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000352, 'volume', '泡沫液罐容积(m³)', 'inputNumber', 132828674825, 'eq', b'0', '92031900', 2581805, '2022-10-09 09:24:37');
            REPLACE INTO `wl_form_group_column_equip`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000353, 'minPressure', '最低报警压力(Mpa)', 'inputNumber', 132828674826, 'eq', b'0', '92011000', 2581805, '2022-10-09 09:24:38');
            REPLACE INTO `wl_form_group_column_equip`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000354, 'maxPressure', '最高报警压力(Mpa)', 'inputNumber', 132828674826, 'eq', b'0', '92011000', 2581805, '2022-10-09 09:24:39');
            REPLACE INTO `wl_form_group_column_equip`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000355, 'minFlow', '最低报警流量(L/S)', 'inputNumber', 132828674827, 'eq', b'0', '92010700', 2581805, '2022-10-09 09:24:39');
            REPLACE INTO `wl_form_group_column_equip`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000356, 'maxFlow', '最高报警流量(L/S)', 'inputNumber', 132828674827, 'eq', b'0', '92010700', 2581805, '2022-10-09 09:24:40');
        </sql>
    </changeSet>

    <changeSet author="tianyiming" id="202301101653">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment" columnName="shbz_img"/>
            </not>
        </preConditions>
        <comment>新增四横八纵图片属性字段</comment>
        <sql>
            ALTER TABLE `wl_equipment` ADD COLUMN `shbz_img` varchar(255) NULL COMMENT '四横八纵图片' AFTER `img`;</sql>
    </changeSet>
    <changeSet author="gaojianqiang" id="20230113-02">
        <preConditions onFail="MARK_RAN">
            <columnExists tableName="wl_equipment" columnName="shbz_img"/>
        </preConditions>
        <comment>初始化四横八纵shbz_img图片属性字段</comment>
        <sql>
            -- ----------------------------
            -- Table structure for equipment_icon
            -- ----------------------------
            DROP TABLE IF EXISTS `equipment_icon`;
            CREATE TABLE `equipment_icon`  (
                                               `id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                               `sys_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                                               `type_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                                               `type_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                                               `icon` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                                               `sort` int(11) NULL DEFAULT NULL,
                                               PRIMARY KEY (`id`) USING BTREE
            ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

            -- ----------------------------
            -- Records of equipment_icon
            -- ----------------------------
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361070315945986', '排油注氮系统', 'ONL-交流电源', '921002000JK44', 'upload/state/dcfc/viewicon/jiaoLiuDianYuan.png', 1);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1578945741864742914', '排油注氮系统', '消防水箱', '93060600HQK44', 'upload/state/dcfc/viewicon/fireShuiXiang.png', 2);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1417377349053444098', '排油注氮系统', 'ONL-智能终端', '92101800NKO44', 'upload/state/dcfc/viewicon/zhunDuan.png', 3);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361071851061250', '排油注氮系统', 'ONL-排油注氮装置', '92100500RIP44', 'upload/state/dcfc/viewicon/paiyouzhudanzhuangzhi.png', 4);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361070907342850', '排油注氮系统', 'ONL-直流电源', '92100300MNL44', 'upload/state/dcfc/viewicon/zhiLiuDianYuan.png', 5);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361071419047937', '排油注氮系统', 'ONL-排油阀', '92100400VWE44', 'upload/state/dcfc/viewicon/benTiPaiYouFa.png', 6);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1404693507742093314', '排油注氮系统', 'ONL-采集模块', '92101400P3N44', 'upload/state/dcfc/viewicon/caiJiMuKuai.png', 7);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361063550533634', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-交换机', '92031300WFJ44', 'upload/state/dcfc/viewicon/jiaoHuanji.png', 8);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361062007029761', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-设备间', '92031000EXB44', 'upload/state/dcfc/viewicon/sheBeiJian.png', 9);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361061012979713', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-控制柜', '92030800K2R44', 'upload/state/dcfc/viewicon/kongZhiGui.png', 10);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361057749811202', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-炮阀', '92030200DOD44', 'upload/state/dcfc/viewicon/paofa.png', 11);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361058894856194', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-卷帘门', '92030400FTV44', 'upload/state/dcfc/viewicon/juanLianMen.png', 12);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361059477864450', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-产生装置', '92030500MG644', 'upload/state/dcfc/viewicon/chanshengzhuangzhi.png', 13);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361064620081153', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-电源', '92031500Z9E44', 'upload/state/dcfc/viewicon/power.png', 14);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361065161146370', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-AD通道', '92031600TQ244', 'upload/state/dcfc/viewicon/tongDao.png', 15);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361061486936066', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-电源柜', '92030900KYD44', 'upload/state/dcfc/viewicon/pwoerGui.png', 16);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361058299265025', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-切换阀', '92030300DI444', 'upload/state/dcfc/viewicon/qieHuanFa.png', 17);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361059951820801', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-泡沫泵', '92030600QO344', 'upload/state/dcfc/viewicon/paoMoPump.png', 18);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361060509663233', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-空压机', '92030700SFT44', 'upload/state/dcfc/viewicon/kongYaMachine.png', 19);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361062543900673', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-控制按钮', '92031100HQL44', 'upload/state/dcfc/viewicon/kongZhiButton.png', 20);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361065656074242', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-断路器', '92031700EGW44', 'upload/state/dcfc/viewicon/duanLuQi.png', 21);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1417377350970241025', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-直流系统', '92032400MWX44', 'upload/state/dcfc/viewicon/zhiliuSystem.png', 22);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392662055093518337', '消防给水及消火栓系统', 'FHS-稳压泵', '92010800KAL44', 'upload/state/dcfc/viewicon/wenYaBeng.png', 23);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1401866678450778114', '消防给水及消火栓系统', 'FHS-液位探测器', '92011100BIK44', 'upload/state/dcfc/viewicon/yeWeiDetecor.png', 24);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418444533010169858', '消防给水及消火栓系统', '消火栓', '31050000ZLF44', 'upload/state/dcfc/viewicon/fireMachine.png', 25);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418466180761026562', '压缩空气泡沫灭火系统（CAFS）', '压缩空气泡沫灭火系统', '92030000WEW44', 'upload/state/dcfc/viewicon/yasuokongqi.png', 26);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418505479128817666', '消防给水及消火栓系统', '消防供水设施', '92010000S0F44', 'upload/state/dcfc/viewicon/gongshuiSheShi.png', 27);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1527227300964233217', '消防给水及消火栓系统', '消火栓', '93060400CQX44', 'upload/state/dcfc/viewicon/fireMachine.png', 28);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361063101743105', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-插件', '92031200DMT44', 'upload/state/dcfc/viewicon/chaJian.png', 29);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361057196163073', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-主机', '92030100TGX44', 'upload/state/dcfc/viewicon/zhuji.png', 30);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1401866678975066113', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-CAFS消防炮', '92032200BUX44', 'upload/state/dcfc/viewicon/CAFSGun.png', 31);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361064016101378', '压缩空气泡沫灭火系统（CAFS）', 'CAFS-光纤', '92031400GMT44', 'upload/state/dcfc/viewicon/guangxian.png', 32);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1401866673925124097', '火灾自动报警系统', 'FAS-感温式火灾探测器', '92041200KNU44', 'upload/state/dcfc/viewicon/ganYanTanCeQi.png', 33);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361054348230658', '火灾自动报警系统', 'FAS-感温电缆', '92040700PEM44', 'upload/state/dcfc/viewicon/ganWenDianLan.png', 34);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1417377347702878209', '火灾自动报警系统', 'FAS-复位电源', '92042300YBA44', 'upload/state/dcfc/viewicon/fuWeiPower.png', 35);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418462802521784321', '火灾自动报警系统', '火灾自动报警系统', '92040000KPO44', 'upload/state/dcfc/viewicon/fireAutoAlarm.png', 36);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418464225015791617', '自动喷水灭火系统', '消防专用电话', '92120000GYI44', 'upload/state/dcfc/viewicon/fireMobile.png', 37);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418465438318886913', '自动喷水灭火系统', '雨淋阀', '92110900V9B44', 'upload/state/dcfc/viewicon/yuLinFa.png', 38);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1417377345773498370', '火灾自动报警系统', 'FAS-强切设备', '92042200EKM44', 'upload/state/dcfc/viewicon/qiangQieShebei.png', 39);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418466508642353153', '自动喷水灭火系统', '自动喷水灭火系统', '92130000YCG44', 'upload/state/dcfc/viewicon/autoPenShui.png', 40);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361056457965569', '火灾自动报警系统', 'FAS-声光报警器', '92041000LCW44', 'upload/state/dcfc/viewicon/shengGuangBaoJingQi.png', 41);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418822147562434562', '自动喷水灭火系统', '消防水池', '92010000XBB44', 'upload/state/dcfc/viewicon/xiaoFangShuiChi.png', 42);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361052318187522', '火灾自动报警系统', 'FAS-手动报警器', '920404002PU44', 'upload/state/dcfc/viewicon/shouDongBaoJingQi.png', 43);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361051122810882', '火灾自动报警系统', 'FAS-烟雾报警器', '920402009EM44', 'upload/state/dcfc/viewicon/ganYanTanCeQi.png', 44);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1401866678102650882', '自动喷水灭火系统', 'FHS-压力开关', '92010900K8G44', 'upload/state/dcfc/viewicon/yaLiKaiGuan.png', 45);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361049260539906', '自动喷水灭火系统', 'FHS-消防泵', '920106007GV44', 'upload/state/dcfc/viewicon/firePump.png', 46);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1417377352845094913', '火灾自动报警系统', 'FAS-切电设备', '92042400X2V44', 'upload/state/dcfc/viewicon/cutPower.png', 47);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1401866680124305409', '火灾自动报警系统', 'AIRCS-空调', '92200100VAC44', 'upload/state/dcfc/viewicon/airCondition.png', 48);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1404693508211855361', '火灾自动报警系统', 'FAS-感光式火灾探测器', '92041900GNS44', 'upload/state/dcfc/viewicon/ziWaiHuoYanTanCeQi.png', 49);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1401866675300855810', '火灾自动报警系统', 'FAS-备用设备', '92041800CK844', 'upload/state/dcfc/viewicon/spareEquipment.png', 50);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1404693508639674370', '火灾自动报警系统', 'FAS-模块', '92042000YVN44', 'upload/state/dcfc/viewicon/module.png', 51);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361052926361602', '火灾自动报警系统', 'FAS-空气采样探测器', '920405002O544', 'upload/state/dcfc/viewicon/AirSamplingDetector.png', 52);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392662045933158401', '火灾自动报警系统', 'SCS-防火阀', '92160200J4244', 'upload/state/dcfc/viewicon/fireDamper.png', 53);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392662052493049858', '自动喷水灭火系统', 'FFS-雨淋蝶阀', '92110900ATW44', 'upload/state/dcfc/viewicon/DelugeButterflyValve.png', 54);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392662028300304385', '自动喷水灭火系统', 'WSS-雨淋阀', '92130300BH644', 'upload/state/dcfc/viewicon/delugeValve.png', 55);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418465836974899202', '其他系统', '消防小室', '92990000AQT44', 'upload/state/dcfc/viewicon/fireCompartment.png', 56);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418496226158649346', '其他系统', '灭火器巡检', '92990000N2844', 'upload/state/dcfc/viewicon/fireExtinguisherInspection.png', 57);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418497428988567554', '其他系统', '消火栓系统', '92990000RIN44', 'upload/state/dcfc/viewicon/fireWaterSystem.png', 58);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418464823584915458', '其他系统', '防火分隔设施', '92990000UVR44', 'upload/state/dcfc/viewicon/separationFacility.png', 59);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1404693512771063809', '其他系统', 'FPMS-配电开关', '922206009JO44', 'upload/state/dcfc/viewicon/distributionSwitch.png', 60);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418445233194696705', '其他系统', '灭火器', '31040000PV244', 'upload/state/dcfc/viewicon/fireExtinguisher.png', 61);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1450756152672518146', '其他系统', 'FHS-无线液位探测器', '92011500EBH44', 'upload/state/dcfc/viewicon/wirelessLiquidLevelDetector.png', 62);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392662054481149954', '其他系统', 'FHS-消防水池装置', '92010700SHY44', 'upload/state/dcfc/viewicon/poolInstallation.png', 63);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361066734010370', '其他系统', 'CAFS-泡沫罐', '92031900INJ44', 'upload/state/dcfc/viewicon/foamTank.png', 64);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1401866678308171778', '其他系统', 'FHS-管网压力探测器', '92011000T5Q44', 'upload/state/dcfc/viewicon/guanWangYaLi.png', 65);
            INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392662048705593345', '其他系统', 'ES-电梯', '92170100NKI44', 'upload/state/dcfc/viewicon/elevator.png', 66);

            UPDATE wl_equipment e SET e.shbz_img = (SELECT ei.icon FROM equipment_icon ei WHERE e.`code` = ei.`type_code`);

            DROP TABLE IF EXISTS `equipment_icon`;
        </sql>
    </changeSet>

    <changeSet author="keyong" id="1673609612-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_index" columnName="unit"/>
            </not>
        </preConditions>
        <comment>新增属性字段 unit</comment>
        <sql>
            alter table `wl_equipment_specific_index` add column `unit` varchar(50) DEFAULT NULL COMMENT '指标单位(冗余字段)';
        </sql>
    </changeSet>
    <changeSet author="keyong" id="1673609612-2">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_equipment_specific_index" />
        </preConditions>
        <comment>sync field</comment>
        <sql>
            UPDATE wl_equipment_specific_index wesi
            SET wesi.unit = ( SELECT unit FROM wl_equipment_index wei WHERE wei.id = wesi.equipment_index_id );
        </sql>
    </changeSet>

    <changeSet author="litengwei" id="20230303-12322-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_video" columnName="video_type"/>
            </not>
        </preConditions>
        <comment>新增属性字段 video_type</comment>
        <sql>
            alter table `wl_video` add column `video_type` varchar(100) DEFAULT 'flv' COMMENT '视频格式: 1.flv,2.rtsp,3.hls，4.other';
        </sql>
    </changeSet>
    
    <changeSet author="maoy" id="202300511-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific" columnName="equip_status"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific新增属性字段 equip_status</comment>
        <sql>
          ALTER TABLE `wl_equipment_specific`
		ADD COLUMN `equip_status`  varchar(20) NULL DEFAULT 0 COMMENT '物联设备实时状态，默认0表示正常（绿色），1为故障类（黄色），2为火警类（红色）' ;
        </sql>
    </changeSet>
     <changeSet author="maoy" id="202300511-2">
        <preConditions onFail="MARK_RAN">
              <columnExists tableName="wl_equipment_specific" columnName="equip_status"/>
        </preConditions>
        <comment>wl_equipment_specific字段 equip_status 初始化</comment>
        <sql>
        
		UPDATE wl_equipment_specific es SET es.equip_status = IFNULL((
			SELECT
				(
					CASE
					WHEN find_in_set(
						'FIREALARM',
						GROUP_CONCAT(esa.type)
					) > 0 THEN
						'2'
					ELSE
						'1'
					END
				) s
			FROM
				`wl_equipment_specific_alarm` esa
			WHERE
				esa.equipment_specific_id = es.id
			AND esa.`status` = TRUE
			GROUP BY
				esa.equipment_specific_id
			),'0') ;
        </sql>
    </changeSet>

    <changeSet author="keyong" id="1684921528">
        <preConditions onFail="MARK_RAN">
            <tableExists tableName="wl_signal_classify" />
        </preConditions>
        <comment>更改属性值</comment>
        <sql>
            UPDATE wl_signal_classify wsc SET wsc.is_alarm = true, wsc.emergency_level_color = '#E8D639', wsc.emergency_level = '3', wsc.emergency_level_describe = '轻微' WHERE wsc.id IN (20220241, 20220243);
            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_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 );
        </sql>
    </changeSet>

    <changeSet author="LiuLin" id="1686212667">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_index" columnName="index_address"/>
            </not>
        </preConditions>
        <comment>新增属性字段 index_address</comment>
        <sql>
            alter table `wl_equipment_specific_index` add column `index_address` varchar(50) COMMENT '信号的索引键key，用于唯一索引信号';
        </sql>
    </changeSet>

    <changeSet author="LiuLin" id="1686212667-1">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_index" columnName="quality"/>
            </not>
        </preConditions>
        <comment>新增属性字段 quality</comment>
        <sql>
            alter table `wl_equipment_specific_index` add column `quality` tinyint(4) DEFAULT NULL COMMENT '品质，0为有效，1为无效';
        </sql>
    </changeSet>

    <changeSet author="LiuLin" id="1686212667-2">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_index" columnName="data_type"/>
            </not>
        </preConditions>
        <comment>新增属性字段 data_type</comment>
        <sql>
            alter table `wl_equipment_specific_index` add column `data_type` varchar(10) DEFAULT NULL COMMENT '测点类型，analog/state';
        </sql>
    </changeSet>

    <changeSet author="LiuLin" id="1686212667-3">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_index" columnName="time_stamp"/>
            </not>
        </preConditions>
        <comment>新增属性字段 time_stamp</comment>
        <sql>
            alter table `wl_equipment_specific_index` add column `time_stamp` varchar(32) COMMENT '时间';
        </sql>
    </changeSet>

    <changeSet author="LiuLin" id="1686564561">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_index" columnName="value_enum"/>
            </not>
        </preConditions>
        <comment>wl_equipment_specific_index add `value_enum`</comment>
        <sql>
            ALTER TABLE `wl_equipment_specific_index` ADD COLUMN `value_enum` text NULL COMMENT '指标值枚举' AFTER `value_label`;
        </sql>
    </changeSet>

    <changeSet author="LiuLin" id="1686650059">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_index" columnName="gateway_id"/>
            </not>
        </preConditions>
        <comment>新增属性字段 gateway_id</comment>
        <sql>
            alter table `wl_equipment_specific_index` add column `gateway_id` varchar(50) COMMENT '网关标识ID';
        </sql>
    </changeSet>

    <!--<changeSet author="20230620" id="20230620-1"  runAlways="true">
        <comment>`dz_point_system`</comment>
        <sql endDelimiter="#">
            CREATE TABLE `dz_point_system`  (
            `id` bigint(0) NOT NULL,
            `station` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '场站',
            `number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '型号',
            `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '类型',
            `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '地址',
            `point_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '测点类型',
            `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '测点值',
            `function_num` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '功能码',
            `kks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'kks码',
            `create_date` datetime(0) NULL DEFAULT NULL,
            PRIMARY KEY (`id`) USING BTREE
            ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
        </sql>
    </changeSet>-->

<!--    <changeSet author="20230629" id="20230629-1">-->
<!--        <preConditions onFail="MARK_RAN">-->
<!--            <not>-->
<!--                <columnExists tableName="dz_point_system" columnName="gateway_id"/>-->
<!--            </not>-->
<!--        </preConditions>-->
<!--        <comment>新增属性字段 gateway_id</comment>-->
<!--        <sql>-->
<!--            alter table `dz_point_system` add column `gateway_id` varchar(50) COMMENT '网关标识ID';-->
<!--        </sql>-->
<!--    </changeSet>-->


    <changeSet author="cz" id="202307030001">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="wl_equip_qrcode_record"/>
            </not>
        </preConditions>
        <comment>create table wl_form_instance_equip  实例表</comment>
        <sql>
            CREATE TABLE `wl_equip_qrcode_record` (
            `id` bigint NOT NULL COMMENT '唯一标识',
            `clean_time` datetime DEFAULT NULL COMMENT '消除时间',
            `equip_id` bigint DEFAULT NULL COMMENT '设备id',
            `status` varchar(255) DEFAULT NULL COMMENT '状态(0:绿码,1:黄码,2:红码)',
            `source` varchar(255) DEFAULT NULL COMMENT '来源',
            `source_id` varchar(255) DEFAULT NULL,
            `alarm_time` datetime DEFAULT NULL COMMENT '告警时间',
            `biz_org_code` varchar(255) DEFAULT NULL COMMENT '所属单位code',
            `biz_org_name` varchar(255) DEFAULT NULL COMMENT '所属单位',
            `system_code` varchar(255) DEFAULT NULL COMMENT '所属系统',
            `create_date` datetime DEFAULT NULL COMMENT '创建时间',
            `clean_reason` text COMMENT '消除原因',
            `equip_index` varchar(255) DEFAULT NULL COMMENT '装备指标',
            PRIMARY KEY (`id`)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
        </sql>
    </changeSet>

    <changeSet author="ky" id="20230808">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="f_fire_fighting_system" columnName="system_status"/>
            </not>
        </preConditions>
        <comment>f_fire_fighting_system新增属性字段 system_status</comment>
        <sql>
            ALTER TABLE `f_fire_fighting_system` ADD COLUMN `system_status` varchar(20) NULL DEFAULT 0 COMMENT '消防系统状态，默认0表示正常（绿色），1为故障类（黄色），2为火警类（红色）';
            ALTER TABLE `cb_water_resource` ADD COLUMN `water_status` varchar(20) NULL DEFAULT 0 COMMENT '水源状态，默认0表示正常（绿色），1为故障类（黄色），2为火警类（红色）';
        </sql>
    </changeSet>

    <changeSet author="keyong" id="1694056741">
        <preConditions onFail="MARK_RAN">
            <not>
                <columnExists tableName="wl_equipment_specific_index" columnName="type_code"/>
            </not>
        </preConditions>
        <comment>新增字段 type_code</comment>
        <sql>
            alter table `wl_equipment_specific_index` add column `type_code` varchar(50) COMMENT '指标类型编码';
            UPDATE wl_equipment_specific_index esi SET esi.type_code = ( SELECT type_code FROM wl_equipment_index wei WHERE esi.equipment_index_id = wei.id );
        </sql>
    </changeSet>
</databaseChangeLog>