-- ----------------------------
-- 设备表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_stp_device`;
CREATE TABLE mortals_stp_device(
    `id` bigint(20)   AUTO_INCREMENT  COMMENT '主键ID，主键，自增长',
    `deviceName` varchar(20) NOT NULL    COMMENT '设备名称',
    `deviceCode` varchar(256)     COMMENT '设备编码',
    `deviceType` tinyint(2) NOT NULL    COMMENT '设备类型（1.呼叫器，2.窗口屏, 3.评价器，4.集中屏, 5.排号机，6.im设备, 7.样表设备，8.取件柜, 9.信息发布,10.导视机,11.开标室设备,12.背靠背）',
    `deviceMac` varchar(64)     COMMENT '设备的MAC地址',
    `ip` varchar(64)     COMMENT '设备访问ip',
    `centernum` varchar(64)     COMMENT '中心设备编码',
    `port` varchar(64)     COMMENT '端口',
    `siteNum` varchar(64)     COMMENT '站点编号',
    `deviceFirmId` bigint(20)     COMMENT '设备生产厂商ID',
    `deviceFirmname` varchar(20)     COMMENT '设备生产厂商名称',
    `deviceOnlineStatus` tinyint(2) NOT NULL    COMMENT '在线状态 (0.离线，1.在线)',
    `status` tinyint(2) NOT NULL    COMMENT '启用状态 (0.停止，1.启用)',
    `deviceRemark` varchar(256)     COMMENT '备注',
    `onlineTime` datetime     COMMENT '最近上线时间',
    `offlineTime` datetime     COMMENT '最近离线时间',
    `createUserId` bigint(20) NOT NULL    COMMENT '创建用户',
    `createTime` datetime NOT NULL    COMMENT '创建时间',
    `updateUserId` bigint(20)     COMMENT '更新用户',
    `updateTime` datetime     COMMENT '更新时间',
PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备';
-- ----------------------------
-- 设备生产厂商表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_stp_firm`;
CREATE TABLE mortals_stp_firm(
    `id` bigint(20)   AUTO_INCREMENT  COMMENT '主键ID，主键，自增长',
    `firmName` varchar(128) NOT NULL    COMMENT '设备生产厂商名称',
    `firmCode` varchar(128)     COMMENT '设备生产商编码',
    `firmRemark` varchar(64)     COMMENT '备注',
    `createUserId` bigint(20) NOT NULL    COMMENT '创建用户',
    `createTime` datetime NOT NULL    COMMENT '创建时间',
    `updateUserId` bigint(20)     COMMENT '更新用户',
    `updateTime` datetime     COMMENT '更新时间',
PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备生产厂商';
-- ----------------------------
-- 设备日志表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_device_log`;
CREATE TABLE mortals_xhx_device_log(
    `id` bigint(20)   AUTO_INCREMENT  COMMENT '主键ID，主键，自增长',
    `deviceId` bigint(20)    COMMENT '设备ID',
    `deviceNum` varchar(32) NOT NULL    COMMENT '设备编号',
    `deviceName` varchar(32) NOT NULL    COMMENT '设备名称，设置设备名称。',
    `logType` tinyint(2) NOT NULL    COMMENT '日志类型，(0.上报事件，1.下发服务)',
    `content` varchar(2048)     COMMENT '内容',
    `createTime` datetime NOT NULL    COMMENT '创建时间',
PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备日志';


-- ----------------------------
-- 设备菜单 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_menu` VALUES (null, '设备', '/device/list', 0, 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL);

-- ----------------------------
-- 设备资源路径 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备-菜单管理-查看', '/device/list,/device/view,/device/info,/device/export,/device/exportExcel,/device/downloadTemplate,/device/download', 3, 0, NULL, NULL, NULL, 0);
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备-菜单管理-维护', '/device/add,/device/edit,/device/delete,/device/logicDelete,/device/save,/device/importData', 3, 0, NULL, NULL, NULL, 0);
-- ----------------------------
-- 设备生产厂商菜单 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_menu` VALUES (null, '设备生产厂商', '/firm/list', 0, 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL);

-- ----------------------------
-- 设备生产厂商资源路径 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备生产厂商-菜单管理-查看', '/firm/list,/firm/view,/firm/info,/firm/export,/firm/exportExcel,/firm/downloadTemplate,/firm/download', 3, 0, NULL, NULL, NULL, 0);
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备生产厂商-菜单管理-维护', '/firm/add,/firm/edit,/firm/delete,/firm/logicDelete,/firm/save,/firm/importData', 3, 0, NULL, NULL, NULL, 0);
-- ----------------------------
-- 设备日志菜单 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_menu` VALUES (null, '设备日志', '/device/log/list', 0, 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL);

-- ----------------------------
-- 设备日志资源路径 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备日志-菜单管理-查看', '/device/log/list,/device/log/view,/device/log/info,/device/log/export,/device/log/exportExcel,/device/log/downloadTemplate,/device/log/download', 3, 0, NULL, NULL, NULL, 0);
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备日志-菜单管理-维护', '/device/log/add,/device/log/edit,/device/log/delete,/device/log/logicDelete,/device/log/save,/device/log/importData', 3, 0, NULL, NULL, NULL, 0);


-- ----------------------------
-- 设备参数 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '1', '呼叫器', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '2', '窗口屏', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '3', '评价器', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '4', '集中屏', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '5', '排号机', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '6', 'im设备', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '7', '样表设备', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '8', '取件柜', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '9', '信息发布', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '10', '导视机', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '11', '开标室设备', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '12', '背靠背', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '在线状态 ', 'Device', 'deviceOnlineStatus', '0', '离线', 1, 4, 0, 'deviceOnlineStatus', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '在线状态 ', 'Device', 'deviceOnlineStatus', '1', '在线', 1, 4, 0, 'deviceOnlineStatus', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '启用状态 ', 'Device', 'status', '0', '停止', 1, 4, 0, 'status', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '启用状态 ', 'Device', 'status', '1', '启用', 1, 4, 0, 'status', NULL, NULL, NULL);

-- ----------------------------
-- 设备生产厂商参数 SQL
-- ----------------------------

-- ----------------------------
-- 设备日志参数 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_param` VALUES (null, '日志类型，', 'DeviceLog', 'logType', '0', '上报事件', 1, 4, 0, 'logType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '日志类型，', 'DeviceLog', 'logType', '1', '下发服务', 1, 4, 0, 'logType', NULL, NULL, NULL);



