gasWellWatch/src/main/resources/sql/CREATE_KNPCV1.sql

61 lines
7.2 KiB
MySQL
Raw Normal View History

2024-11-24 18:51:30 +08:00
CREATE TABLE `$TableName$`
(
`id` bigint NOT NULL COMMENT '主键',
`device_id` int NOT NULL COMMENT '设备标识',
`created_time` datetime NOT NULL COMMENT '数据落库时间',
`collection_time` datetime NOT NULL COMMENT '采集指令下发时间',
`receive_time` datetime NOT NULL COMMENT '接收到数据时间',
`status` tinyint NULL DEFAULT NULL COMMENT '开关井。寄存器地址0:0001允许值0关井 1开井',
`device_time` datetime NULL DEFAULT NULL COMMENT '设备时间。\r\n寄存器地址3:00003:00013:00023:00033:00043:0005\r\n',
`run_mode` tinyint NULL DEFAULT NULL COMMENT '运行模式:\r\n0手动模式 \r\n1定时器模式 \r\n2计时器模式 \r\n3压力模式\r\n4柱塞模式\r\n5时压模式',
`gas_status` tinyint NULL DEFAULT NULL COMMENT '气井状态:\r\n0关闭 \r\n1打开',
`plug_status` tinyint NULL DEFAULT NULL COMMENT '柱塞状态:\r\n0离开\r\n1上升中\r\n2到达',
`status_start_time` time NULL DEFAULT NULL COMMENT '当前状态开始时间',
`status_end_time` time NULL DEFAULT NULL COMMENT '当前状态结束时间',
`oil_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '油压单位Mpa',
`cas_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '套压单位Mpa',
`pre_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '输压单位Mpa',
`pipe_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '管压单位Mpa',
`liquid_level` decimal(10, 2) NULL DEFAULT NULL COMMENT '流量单位mm',
`temperature` decimal(10, 2) NULL DEFAULT NULL COMMENT '温度:单位℃,*100最高位表示正负0正1负即零下的温度加32768',
`humidity` decimal(10, 2) NULL DEFAULT NULL COMMENT '湿度:单位%',
`op_mode` tinyint NULL DEFAULT NULL COMMENT '运行模式:\r\n0 手动模式 hand_mode\r\n1定时器模式 timer_mode\r\n2计时器模式 t2mode\r\n3压力模式 pressure_mode\r\n4柱塞模式 piston_mode\r\n5时压模式 tp_mode',
`well_ctl` tinyint NULL DEFAULT NULL COMMENT '开关井,保持现有的模式,同显示屏按钮:\r\n0关井 close_well\r\n1开井 open_well',
`timer_able1` tinyint NULL DEFAULT NULL COMMENT '定时模式定时器1使能\r\n0禁止 disable\r\n1使能 enable',
`timer_able2` tinyint NULL DEFAULT NULL COMMENT '定时模式定时器2使能\r\n0禁止 disable\r\n1使能 ',
`timer_open1` time NULL DEFAULT NULL COMMENT '时0~23分0~59秒0~59',
`timer_close1` time NULL DEFAULT NULL COMMENT '时0~23分0~59秒0~59',
`timer_open2` time NULL DEFAULT NULL COMMENT '时0~23分0~59秒0~59',
`timer_close2` time NULL DEFAULT NULL COMMENT '时0~23分0~59秒0~59',
`timing_open` time NULL DEFAULT NULL COMMENT '时0~23分0~59秒0~59',
`timing_close` time NULL DEFAULT NULL COMMENT '时0~23分0~59秒0~59',
`timing_delay` time NULL DEFAULT NULL COMMENT '时0~23分0~59秒0~59',
`presource` tinyint NULL DEFAULT NULL COMMENT '触发压力源:\r\n0油压 oil_pressure\r\n1套压 cas_pressure\r\n2输压 pre_pressure\r\n3差压 diff_pressure',
`pressure_open` decimal(10, 2) NULL DEFAULT NULL COMMENT '开井压力单位Mpa*100',
`pressure_close` decimal(10, 2) NULL DEFAULT NULL COMMENT '关井压力: 单位Mpa*100',
`trigger_type` tinyint NULL DEFAULT NULL COMMENT '压力触发类型:\n0大于开井压力开井、小于关井压力关井 gre_less\n1大于开井压力开井、大于关井压力关井 gre_gre\n2小于开井压力开井、小于关井压力关井 less_less\n3小于开井压力开井、大于关井压力关井 less_gre',
`stability_time` smallint NULL DEFAULT NULL COMMENT '传感器压力稳定时间:秒',
`max_open_well` time NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`max_close_well` time NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`min_open_well` time NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`min_close_well` time NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`prespro_tect` tinyint NULL DEFAULT NULL COMMENT '开井压力保护使能:\r\n0禁止 disable\r\n1使能 enable',
`prespro_source` tinyint NULL DEFAULT NULL COMMENT '开井压力保护源:\r\n0油压 oil_pressure\r\n1套压 cas_pressure\r\n2输压 pre_pressure\r\n3差压 diff_pressure',
`open_well_limit_max` decimal(10, 2) NULL DEFAULT NULL COMMENT '开井压力限制上限单位MPa *100',
`open_well_limit_min` decimal(10, 2) NULL DEFAULT NULL COMMENT '开井压力限制下限单位MPa *100',
`plug_init_status` tinyint NULL DEFAULT NULL COMMENT '柱塞模式初始气井状态:\r\n0关井 close_well\r\n1开井 open_well',
`plug_sustain_time` time NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`plug_close_time` time NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`tp_init_status` tinyint NULL DEFAULT NULL COMMENT '时压模式初始气井状态:\r\n0关井 close_well\r\n1开井 open_well',
`tp_open_source` tinyint NULL DEFAULT NULL COMMENT '时压模式开井源:\r\n0油压 oil_pressure\r\n1套压 cas_pressure\r\n2输压 pre_pressure\r\n3差压 diff_pressure\r\n4时间 time_pressure',
`tp_open_trigger` tinyint NULL DEFAULT NULL COMMENT '时压模式开井压力触发模式:\r\n0大于压力触发\r\n1小于压力触发',
`tp_open_pressure` tinyint NULL DEFAULT NULL COMMENT '时压模式开井压力',
`tp_open_time` time NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`tp_close_source` tinyint NULL DEFAULT NULL COMMENT '时压模式关井源:\r\n0油压 oil_pressure\r\n1套压 cas_pressure\r\n2输压 pre_pressure\r\n3差压 diff_pressure\r\n4时间 time_pressure',
`tp_close_trigger` tinyint NULL DEFAULT NULL COMMENT '时压模式关井压力触发模式:\r\n0大于压力触发 max_pressure\r\n1小于压力触发 min_pressure',
`tp_close_pressure` smallint NULL DEFAULT NULL COMMENT '时压模式关井压力',
`tp_close_time` time NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`tp_stability_time` tinyint NULL DEFAULT NULL COMMENT '时压模式压力稳定时长:秒',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `udx_device_create_time` (`device_id` ASC, `created_time` ASC) USING BTREE COMMENT '设备采集数据唯一键'
) ENGINE = InnoDB COMMENT = '设备ID1的采集数据';