段飞宇
2 years ago
10 changed files with 176 additions and 120 deletions
@ -0,0 +1,73 @@
|
||||
SET FOREIGN_KEY_CHECKS=0; |
||||
|
||||
CREATE TABLE `dev_equipment`.`hzims_em_association` ( |
||||
`ID` bigint(20) NOT NULL COMMENT '主键Id', |
||||
`EM_ID` bigint(20) NULL DEFAULT NULL COMMENT '设备Id', |
||||
`FDP_EM_ID` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'FDP设备Id', |
||||
`FDP_EM_NAME` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'PDF设备名称', |
||||
`TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID', |
||||
`CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', |
||||
`UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', |
||||
`CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人', |
||||
`UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人', |
||||
`CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门', |
||||
`STATUS` int(2) NULL DEFAULT 0 COMMENT '状态', |
||||
`IS_DELETED` int(2) NULL DEFAULT 0 COMMENT '是否已删除: 0、否; 1、是', |
||||
PRIMARY KEY (`ID`) USING BTREE |
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '设备关联表' ROW_FORMAT = Dynamic; |
||||
|
||||
CREATE TABLE `dev_equipment`.`hzims_em_association_detail` ( |
||||
`PID` bigint(20) NOT NULL COMMENT '父id', |
||||
`ID` bigint(20) NOT NULL COMMENT '主键Id', |
||||
`EM_POINT_ID` bigint(20) NOT NULL COMMENT '设备点Id', |
||||
`FDP_EM_POINT_ID` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'FDP点Id', |
||||
`FDP_EM_POINT_NAME` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'FDP监测点名称', |
||||
`FDP_EM_POINT_ORD` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'FDP监测点位置', |
||||
`PRO_TYPE` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性类型:yc、yx、soe', |
||||
`TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID', |
||||
`CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', |
||||
`UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', |
||||
`CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人', |
||||
`UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人', |
||||
`CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门', |
||||
`STATUS` int(2) NULL DEFAULT 0 COMMENT '状态', |
||||
`IS_DELETED` int(2) NULL DEFAULT 0 COMMENT '是否已删除: 0、否; 1、是', |
||||
PRIMARY KEY (`ID`) USING BTREE |
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '设备关联明细表' ROW_FORMAT = Dynamic; |
||||
|
||||
ALTER TABLE `dev_equipment`.`hzims_em_info` ADD COLUMN `em_index` tinyint(4) NULL DEFAULT NULL COMMENT '设备序号' AFTER `CREATE_DEPT`; |
||||
|
||||
ALTER TABLE `dev_equipment`.`hzims_em_info` ADD COLUMN `DEVICE_INSTANCE_ID` bigint(20) NULL DEFAULT NULL COMMENT '设备实例化Id' AFTER `em_index`; |
||||
|
||||
ALTER TABLE `dev_equipment`.`hzims_em_info` ADD COLUMN `em_type` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备类型' AFTER `DEVICE_INSTANCE_ID`; |
||||
|
||||
ALTER TABLE `dev_equipment`.`hzims_em_info` ADD COLUMN `set_type` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '机组类型' AFTER `em_type`; |
||||
|
||||
ALTER TABLE `dev_equipment`.`hzims_em_info` MODIFY COLUMN `NUMBER` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '设备编号' AFTER `ID`; |
||||
|
||||
ALTER TABLE `dev_equipment`.`hzims_em_info` MODIFY COLUMN `HOME_PAGE_DISPLAY` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '首页展示' AFTER `LINKER_PHONE`; |
||||
|
||||
ALTER TABLE `dev_equipment`.`hzims_em_info` MODIFY COLUMN `GRADE_CODE` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备等级' AFTER `MANAGER`; |
||||
|
||||
ALTER TABLE `dev_equipment`.`hzims_em_info` MODIFY COLUMN `RUN_STATUS` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '2' COMMENT '运行状态' AFTER `INS_LOCATION`; |
||||
|
||||
CREATE TABLE `dev_equipment`.`hzims_workshop_equipment` ( |
||||
`ID` bigint(20) NOT NULL COMMENT '主键ID', |
||||
`WORKSHOP_ID` bigint(20) NOT NULL COMMENT '厂房ID', |
||||
`WORKSHOP_NAME` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '厂房名称', |
||||
`EM_ID` bigint(20) NOT NULL COMMENT '设备ID', |
||||
`EM_NAME` varchar(100) CHARACTER SET utf8 COLLATE utf8_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 '状态 0-启用 1-停用', |
||||
`CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门', |
||||
PRIMARY KEY (`ID`) USING BTREE |
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; |
||||
|
||||
CREATE ALGORITHM = UNDEFINED DEFINER = `root`@`%` SQL SECURITY DEFINER VIEW `dev_equipment`.`v_hzims_fdp_fualt` AS (select `t1`.`ID` AS `ID`,`t1`.`FDP_ID` AS `FDP_ID`,`t1`.`NAME` AS `NAME`,`t1`.`INFO` AS `INFO`,`t1`.`EM_CODE` AS `EM_CODE`,`t1`.`DETECTABILITY` AS `DETECTABILITY`,`t1`.`SEVERITY` AS `SEVERITY`,`t1`.`FDP_DEVICE_ID` AS `FDP_DEVICE_ID`,`t1`.`FDP_DEVICE_NAME` AS `FDP_DEVICE_NAME`,`t1`.`ORD` AS `ORD`,`t1`.`DISPLAY` AS `DISPLAY`,`t1`.`TENANT_ID` AS `TENANT_ID`,`t1`.`CREATE_TIME` AS `CREATE_TIME`,`t1`.`UPDATE_TIME` AS `UPDATE_TIME`,`t1`.`CREATE_USER` AS `CREATE_USER`,`t1`.`UPDATE_USER` AS `UPDATE_USER`,`t1`.`IS_DELETED` AS `IS_DELETED`,`t1`.`STATUS` AS `STATUS`,`t1`.`CREATE_DEPT` AS `CREATE_DEPT`,`t2`.`FAULT_AMOUNT` AS `FAULT_AMOUNT` from (`dev_equipment`.`hzims_fdp_fault` `t1` join (select `t`.`NAME` AS `name`,count(`t`.`NAME`) AS `FAULT_AMOUNT` from `dev_equipment`.`hzims_fdp_fault` `t` group by `t`.`NAME` order by count(`t`.`NAME`) desc) `t2`) where (`t1`.`NAME` = `t2`.`name`) order by `t2`.`FAULT_AMOUNT` desc); |
||||
|
||||
SET FOREIGN_KEY_CHECKS=1; |
Loading…
Reference in new issue