-- ----------------------------
2023-06-21
-- ----------------------------
ALTER TABLE mortals_xhx_device
    ADD COLUMN `deviceFirmId` bigint(20) DEFAULT NULL COMMENT '设备生产厂商ID' AFTER siteName;
ALTER TABLE mortals_xhx_device
    ADD COLUMN `deviceFirmname` varchar(200) DEFAULT NULL COMMENT '设备生产厂商名称' AFTER deviceFirmId;

ALTER TABLE mortals_xhx_device
    ADD COLUMN `ip` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '设备访问ip' AFTER deviceFirmname;

ALTER TABLE mortals_xhx_device
    ADD COLUMN `port` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '端口' AFTER ip;
ALTER TABLE mortals_xhx_device
    ADD COLUMN `enabled` tinyint(2) DEFAULT NULL COMMENT '启用状态 (0.停止，1.启用)' AFTER port;

ALTER TABLE mortals_xhx_device
    ADD COLUMN `onlineTime` datetime DEFAULT NULL COMMENT '最近上线时间' AFTER deviceRemark;
ALTER TABLE mortals_xhx_device
    ADD COLUMN `offlineTime` datetime DEFAULT NULL COMMENT '最近离线时间' AFTER onlineTime;


-- ----------------------------
-- 材料分类表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_datum_category`;
CREATE TABLE mortals_xhx_datum_category(
    `id` bigint(20)   AUTO_INCREMENT   COMMENT '主键ID，主键，自增长',
    `categoryId` bigint(20)      COMMENT '分类id',
    `categoryName` varchar(256)      COMMENT '分类名称',
    `materialId` bigint(20)      COMMENT '材料Id',
    `materialName` varchar(256)      COMMENT '材料名称',
    `sort` int(4)    DEFAULT '0'  COMMENT '排序字段',
    `createTime` datetime      COMMENT '创建时间',
    `createUserId` bigint(20)      COMMENT '创建用户',
    `updateUserId` bigint(20)      COMMENT '更新用户',
    `updateTime` datetime      COMMENT '更新时间',
PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='材料分类';
-- ----------------------------
-- 事项材料分类表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_matter_category`;
CREATE TABLE mortals_xhx_matter_category(
    `id` bigint(20)   AUTO_INCREMENT   COMMENT '主键ID，主键，自增长',
    `categoryCode` varchar(20)      COMMENT '分类编码',
    `categoryName` varchar(256)      COMMENT '分类名称',
    `matterId` bigint(20)      COMMENT '事项Id',
    `matterName` varchar(256)      COMMENT '事项名称',
    `sort` int(4)    DEFAULT '0'  COMMENT '排序字段',
    `createTime` datetime      COMMENT '创建时间',
    `createUserId` bigint(20)      COMMENT '创建用户',
    `updateUserId` bigint(20)      COMMENT '更新用户',
    `updateTime` datetime      COMMENT '更新时间',
PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='事项材料分类';
