-- 用户实时画面记录表
CREATE TABLE IF NOT EXISTS `hzims_station_frame_record`  (
    `ID` bigint(20) NOT NULL COMMENT '主键ID',
    `STATION_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点ID',
    `STATION_NAME` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点名称',
    `FRAME_ID` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实时画面ID',
    `FRAME_NAME` varchar(516) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实时画面名称',
    `FRAME_ADDRESS` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实时画面地址',
    `TYPE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点类型:  区分站点v3、v4',
    `PIC_SOURCE` tinyint(2) NULL DEFAULT NULL COMMENT '画面来源： 0云组态 、1 hz3000v3.0、 2 hz3000v4.0',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
    `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态 ',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

-- 用户站点视频记录
CREATE TABLE IF NOT EXISTS `hzims_station_video_record`  (
    `ID` bigint(20) NOT NULL COMMENT '主键ID',
    `STATION_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点ID',
    `STATION_NAME` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点名称',
    `VIDEO_IDS` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频保存配置ID,用逗号分割',
    `VIDEO_NAMES` varchar(516) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频保存名称,用逗号分割',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
    `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态 ',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

-- 用户站点视频轮播方案表
CREATE TABLE IF NOT EXISTS `hzims_station_video_carousel`  (
    `ID` bigint(20) NOT NULL COMMENT '主键ID',
    `CAROUSEL_ID` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频轮播保存配置ID',
    `CAROUSEL_NAME` varchar(516) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频轮播保存配置名称',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
    `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态 ',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

-- 用户默认机构配置表
CREATE TABLE IF NOT EXISTS `hzims_user_dept_config`  (
    `ID` bigint(20) NOT NULL COMMENT '主键ID',
    `DEPT_ID` bigint(20) NULL DEFAULT NULL COMMENT '机构ID',
    `DEPT_NAME` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构名称',
    `DEPT_CATEGORY` int(2) NULL DEFAULT NULL COMMENT '机构类型',
    `STATION_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点编号',
    `STATION_NAME` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点名称',
    `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
    `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
    `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
    `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
    `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
    `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态 ',
    `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
    PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

-- 站点表增加离线状态
ALTER TABLE `hzims_operation`.`hzims_station` ADD COLUMN `ON_LINE` tinyint(1) UNSIGNED ZEROFILL NULL DEFAULT 0 COMMENT '站点在线状态 0-在线 1-离线' AFTER `DISCHARGE`;
