CREATE TABLE "SHZH_IOT"."E_RULE"
(
    "ID" INT IDENTITY(1, 1) NOT NULL,
    "NAME" VARCHAR(50),
    "ITEM" VARCHAR(50),
    "MIN" VARCHAR(50),
    "MAX" VARCHAR(50),
    "DIFF_MAX" VARCHAR(50),
    "DURATION" INTEGER,
    "CREATETIME" DATETIME(0),
    "DEL" VARCHAR(2) DEFAULT 1,
    "LEADING_TIME" INTEGER,
    "LAG_TIME" INTEGER);

COMMENT ON TABLE "SHZH_IOT"."E_RULE" IS '规则表';
COMMENT ON COLUMN "SHZH_IOT"."E_RULE"."ID" IS '主键id';
COMMENT ON COLUMN "SHZH_IOT"."E_RULE"."NAME" IS '规则名称';
COMMENT ON COLUMN "SHZH_IOT"."E_RULE"."ITEM" IS '测站类型';
COMMENT ON COLUMN "SHZH_IOT"."E_RULE"."MIN" IS '最小值';
COMMENT ON COLUMN "SHZH_IOT"."E_RULE"."MAX" IS '最小值';
COMMENT ON COLUMN "SHZH_IOT"."E_RULE"."DIFF_MAX" IS '两条数据之间的最大差值';
COMMENT ON COLUMN "SHZH_IOT"."E_RULE"."DURATION" IS '时间段, 单位 s';
COMMENT ON COLUMN "SHZH_IOT"."E_RULE"."CREATETIME" IS '创建时间';
COMMENT ON COLUMN "SHZH_IOT"."E_RULE"."DEL" IS '1: 未删除 0: 删除';
COMMENT ON COLUMN "SHZH_IOT"."E_RULE"."LEADING_TIME" IS '接收超出时间,单位: s ,指接收时间超前范围';
COMMENT ON COLUMN "SHZH_IOT"."E_RULE"."LAG_TIME" IS '接收滞后时间,单位: s ,指接收时间滞后范围';


CREATE TABLE "SHZH_IOT"."E_STATION_RULES"
(
    "ID" INT IDENTITY(1, 1) NOT NULL,
    "STCD" VARCHAR(50),
    "RULE_ID" INTEGER,
    "SORT" INTEGER,
    "CREATETIME" DATETIME(0),
    "DEL" INT DEFAULT 0) ;

COMMENT ON TABLE "SHZH_IOT"."E_STATION_RULES" IS '测站关联规则表';
COMMENT ON COLUMN "SHZH_IOT"."E_STATION_RULES"."ID" IS '主键id';
COMMENT ON COLUMN "SHZH_IOT"."E_STATION_RULES"."STCD" IS '测站编码';
COMMENT ON COLUMN "SHZH_IOT"."E_STATION_RULES"."RULE_ID" IS '规则id';
COMMENT ON COLUMN "SHZH_IOT"."E_STATION_RULES"."SORT" IS '顺序';
COMMENT ON COLUMN "SHZH_IOT"."E_STATION_RULES"."CREATETIME" IS '创建时间';
COMMENT ON COLUMN "SHZH_IOT"."E_STATION_RULES"."DEL" IS '1: 未删除 0: 删除';


