/*
 Navicat Premium Data Transfer

 Source Server         : 公司pg
 Source Server Type    : PostgreSQL
 Source Server Version : 180003 (180003)
 Source Host           : 192.168.2.9:5432
 Source Catalog        : toflymeterdata
 Source Schema         : public

 Target Server Type    : PostgreSQL
 Target Server Version : 180003 (180003)
 File Encoding         : 65001

 Date: 15/04/2026 16:45:50
*/


-- ----------------------------
-- Table structure for tofly_nb_data_report
-- ----------------------------
DROP TABLE IF EXISTS "public"."tofly_nb_data_report";
CREATE TABLE "public"."tofly_nb_data_report" (
  "id" int8 NOT NULL,
  "device_id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "collection_time" varchar(30) COLLATE "pg_catalog"."default" NOT NULL,
  "mid" int4,
  "afn" int4,
  "report_trigger_mode" int4,
  "total_positive_water" numeric(10,3),
  "total_reverse_water" numeric(10,3),
  "daily_max_instant_flow" numeric(10,3),
  "daily_max_instant_time" varchar(20) COLLATE "pg_catalog"."default",
  "water_temperature" numeric(5,2),
  "water_pressure" numeric(5,2) DEFAULT 0.00,
  "battery_voltage" numeric(5,2),
  "version" varchar(20) COLLATE "pg_catalog"."default",
  "diameter" int4,
  "channel_number" int4,
  "main_server_ip" varchar(50) COLLATE "pg_catalog"."default",
  "main_server_port" int4,
  "sub_server_ip" varchar(50) COLLATE "pg_catalog"."default",
  "sub_server_port" int4,
  "report_base_time" varchar(20) COLLATE "pg_catalog"."default",
  "report_interval_minutes" int4,
  "dma_report_start_time" varchar(20) COLLATE "pg_catalog"."default",
  "dma_report_end_time" varchar(20) COLLATE "pg_catalog"."default",
  "dma_report_interval_minutes" int4,
  "settlement_day" int4,
  "high_temperature_alarm_threshold" numeric(5,2),
  "low_temperature_alarm_threshold" numeric(5,2),
  "large_flow_alarm_threshold" numeric(10,3),
  "large_flow_continuous_monitor_time" int4,
  "continuous_flow_continuous_monitor_time" int4,
  "leakage_flow_alarm_threshold" numeric(10,3),
  "leakage_flow_continuous_monitor_time" int4,
  "high_pressure_alarm_threshold" numeric(5,2) DEFAULT 0.00,
  "low_pressure_alarm_threshold" numeric(5,2) DEFAULT 0.00,
  "have_pressure_sensor" int4,
  "imei" varchar(20) COLLATE "pg_catalog"."default" NOT NULL,
  "cell_id" int4,
  "pci" int4,
  "rsrp" int4,
  "snr" int4,
  "csq" int4,
  "iccid" varchar(30) COLLATE "pg_catalog"."default",
  "error_no" int4,
  "create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  "update_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  "create_user" int8,
  "update_user" int8,
  "deleted" int4 DEFAULT 0,
  "is_sync" int2 DEFAULT 0
)
;
COMMENT ON COLUMN "public"."tofly_nb_data_report"."id" IS '主键ID（雪花算法）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."device_id" IS '设备ID（等于IMEI）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."collection_time" IS '数据采集时间（等于currentDateTime）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."mid" IS '消息ID';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."afn" IS 'AFN功能码';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."report_trigger_mode" IS '上报触发模式（1-定时上报，2-事件上报）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."total_positive_water" IS '累计正向总水量（立方米）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."total_reverse_water" IS '累计反向总水量（立方米）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."daily_max_instant_flow" IS '日最高瞬时流量（立方米/小时）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."daily_max_instant_time" IS '日最高瞬时时间';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."water_temperature" IS '水表当前水温（摄氏度）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."water_pressure" IS '当前水表压力（MPa）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."battery_voltage" IS '电池电压（V）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."version" IS '版本号';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."diameter" IS '水表口径（mm）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."channel_number" IS '通道数量';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."main_server_ip" IS '主服务器IP';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."main_server_port" IS '主服务器端口';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."sub_server_ip" IS '从服务器IP';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."sub_server_port" IS '从服务器端口';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."report_base_time" IS '上报起始基准时间';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."report_interval_minutes" IS '上报间隔时间（分钟）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."dma_report_start_time" IS 'DMA上报开始时间';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."dma_report_end_time" IS 'DMA上报结束时间';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."dma_report_interval_minutes" IS 'DMA上报间隔时间（分钟）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."settlement_day" IS '结算日（1-31）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."high_temperature_alarm_threshold" IS '高温报警阈值（摄氏度）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."low_temperature_alarm_threshold" IS '低温报警阈值（摄氏度）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."large_flow_alarm_threshold" IS '大流量告警阈值（立方米/小时）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."large_flow_continuous_monitor_time" IS '大流量持续监测时间（秒）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."continuous_flow_continuous_monitor_time" IS '持续流量持续监测时间（秒）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."leakage_flow_alarm_threshold" IS '渗漏流量告警阈值（立方米/小时）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."leakage_flow_continuous_monitor_time" IS '渗漏流量持续监测时间（秒）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."high_pressure_alarm_threshold" IS '高压力报警阈值（MPa）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."low_pressure_alarm_threshold" IS '低压力报警阈值（MPa）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."have_pressure_sensor" IS '是否带水压传感器（0-否，1-是）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."imei" IS '设备IMEI';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."cell_id" IS '基站ID';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."pci" IS '小区物理ID';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."rsrp" IS '信号功率（dBm）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."snr" IS '信噪比（dB）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."csq" IS '信号质量（0-31）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."iccid" IS 'SIM卡号';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."error_no" IS '异常代码';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."create_user" IS '创建人';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."update_user" IS '更新人';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."deleted" IS '逻辑删除标志（0-未删除，1-已删除）';
COMMENT ON COLUMN "public"."tofly_nb_data_report"."is_sync" IS '是否同步0否1是';
COMMENT ON TABLE "public"."tofly_nb_data_report" IS '同飞NB-IoT水表数据上报主表';
