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

59 lines
6.9 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 '接收到数据时间',
`device_time` datetime NULL DEFAULT NULL COMMENT '设备时间。\r\n寄存器地址3:00003:00013:00023:00033:00043:0005\r\n',
`run_mode` smallint NULL DEFAULT NULL COMMENT '运行模式:\r\n0手动模式 \r\n1定时器模式 \r\n2计时器模式 \r\n3压力模式\r\n4柱塞模式\r\n5时压模式',
`well_status` smallint NULL DEFAULT NULL COMMENT '气井状态:\r\n0关闭 \r\n1打开',
`plug_status` smallint NULL DEFAULT NULL COMMENT '柱塞状态:\r\n0离开\r\n1上升中\r\n2到达',
`status_start_time` varchar(10) NULL DEFAULT NULL COMMENT '当前状态开始时间',
`status_end_time` varchar(10) 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` smallint 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',
`timer_able1` smallint NULL DEFAULT NULL COMMENT '定时模式定时器1使能\r\n0禁止 disable\r\n1使能 enable',
`timer_able2` smallint NULL DEFAULT NULL COMMENT '定时模式定时器2使能\r\n0禁止 disable\r\n1使能 ',
`timer_open1` varchar(10) NULL DEFAULT NULL COMMENT '时0~23分0~59秒0~59',
`timer_close1` varchar(10) NULL DEFAULT NULL COMMENT '时0~23分0~59秒0~59',
`timer_open2` varchar(10) NULL DEFAULT NULL COMMENT '时0~23分0~59秒0~59',
`timer_close2` varchar(10) NULL DEFAULT NULL COMMENT '时0~23分0~59秒0~59',
`timing_open` varchar(10) NULL DEFAULT NULL COMMENT '时0~23分0~59秒0~59',
`timing_close` varchar(10) NULL DEFAULT NULL COMMENT '时0~23分0~59秒0~59',
`timing_delay` varchar(10) NULL DEFAULT NULL COMMENT '时0~23分0~59秒0~59',
`presource` smallint 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` smallint NULL DEFAULT NULL COMMENT '压力触发类型:\n0大于开井压力开井、小于关井压力关井 gre_less\n1大于开井压力开井、大于关井压力关井 gre_gre\n2小于开井压力开井、小于关井压力关井 less_less\n3小于开井压力开井、大于关井压力关井 less_gre',
`stability_time` int NULL DEFAULT NULL COMMENT '传感器压力稳定时间:秒',
`max_open_well` varchar(10) NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`max_close_well` varchar(10) NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`min_open_well` varchar(10) NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`min_close_well` varchar(10) NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`prespro_tect` smallint NULL DEFAULT NULL COMMENT '开井压力保护使能:\r\n0禁止 disable\r\n1使能 enable',
`prespro_source` smallint 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` smallint NULL DEFAULT NULL COMMENT '柱塞模式初始气井状态:\r\n0关井 close_well\r\n1开井 open_well',
`plug_sustain_time` varchar(10) NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`plug_close_time` varchar(10) NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`tp_init_status` smallint NULL DEFAULT NULL COMMENT '时压模式初始气井状态:\r\n0关井 close_well\r\n1开井 open_well',
`tp_open_source` smallint 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` smallint NULL DEFAULT NULL COMMENT '时压模式开井压力触发模式:\r\n0大于压力触发\r\n1小于压力触发',
`tp_open_pressure` smallint NULL DEFAULT NULL COMMENT '时压模式开井压力',
`tp_open_time` varchar(10) NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`tp_close_source` smallint 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` smallint NULL DEFAULT NULL COMMENT '时压模式关井压力触发模式:\r\n0大于压力触发 max_pressure\r\n1小于压力触发 min_pressure',
`tp_close_pressure` smallint NULL DEFAULT NULL COMMENT '时压模式关井压力',
`tp_close_time` varchar(10) NULL DEFAULT NULL COMMENT '时0~999分0~59秒0~59',
`tp_stability_time` smallint NULL DEFAULT NULL COMMENT '时压模式压力稳定时长:秒',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `udx_device_create_time` (`device_id` ASC, `collection_time` ASC) USING BTREE COMMENT '设备采集数据唯一键'
) ENGINE = InnoDB COMMENT = '设备ID$DeviceId$的采集数据'