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:0000,3:0001,3:0002,3:0003,3:0004,3:0005\r\n', `run_mode` smallint NULL DEFAULT NULL COMMENT '运行模式:\r\n0:手动模式 \r\n1:定时器模式 \r\n2:计时器模式 \r\n3:压力模式\r\n4:柱塞模式\r\n5:时压模式', `gas_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$的采集数据'