Commit 01ca0f31 authored by 吴文龙's avatar 吴文龙

整理PG语句

parent 1c8ffdf0
CREATE TABLE "public"."hs_asset_extension" (
"id" uuid NOT NULL,
"bg_images" varchar(100000) COLLATE "pg_catalog"."default",
"logo_icon" varchar(255) COLLATE "pg_catalog"."default",
"logo_images" varchar(1000000) COLLATE "pg_catalog"."default",
"created_user" uuid,
"created_time" int8 NOT NULL,
"updated_time" varchar(255) COLLATE "pg_catalog"."default",
"updated_user" uuid,
"tenant_id" uuid NOT NULL,
CONSTRAINT "hs_asset_extension_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."hs_asset_extension"
OWNER TO "postgres";
COMMENT ON COLUMN "public"."hs_asset_extension"."id" IS '资产标识';
COMMENT ON COLUMN "public"."hs_asset_extension"."bg_images" IS '背景图片';
CREATE TABLE "public"."hs_customer_extension" (
"id" uuid NOT NULL,
"logo_icon" varchar(2000000) COLLATE "pg_catalog"."default",
"logo_images" varchar(1000000) COLLATE "pg_catalog"."default",
"remark" varchar(1000) COLLATE "pg_catalog"."default",
"tenant_id" uuid NOT NULL,
"updated_time" varchar(255) COLLATE "pg_catalog"."default",
"updated_user" uuid,
"created_time" varchar(255) COLLATE "pg_catalog"."default",
"created_user" uuid,
CONSTRAINT "hs_customer_extension_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."hs_customer_extension"
OWNER TO "postgres";
COMMENT ON COLUMN "public"."hs_customer_extension"."id" IS '客户标识(工厂标识)';
CREATE TABLE "public"."hs_device_electric" (
"created_user" varchar(255) COLLATE "pg_catalog"."default",
"updated_time" int8,
"updated_user" varchar(255) COLLATE "pg_catalog"."default",
"tenant_id" uuid,
"factory_id" uuid,
"peak" varchar(255) COLLATE "pg_catalog"."default",
"device_id" uuid,
"valley" varchar(255) COLLATE "pg_catalog"."default",
"day_used" varchar(255) COLLATE "pg_catalog"."default",
"time" int8,
"id" uuid NOT NULL,
"created_time" int8,
"group_id" uuid,
"workshop_id" uuid,
"gateway_id" uuid,
CONSTRAINT "hs_device_electric_pkey" PRIMARY KEY ("id"),
CONSTRAINT "uk_device_electric" UNIQUE ("device_id", "time")
)
;
ALTER TABLE "public"."hs_device_electric"
OWNER TO "postgres";
CREATE INDEX "idx_device_electric_device" ON "public"."hs_device_electric" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"device_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_device_electric_factory" ON "public"."hs_device_electric" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"factory_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
COMMENT ON COLUMN "public"."hs_device_electric"."created_user" IS '创建人';
COMMENT ON COLUMN "public"."hs_device_electric"."updated_time" IS '更新时间';
COMMENT ON COLUMN "public"."hs_device_electric"."updated_user" IS '更新人';
COMMENT ON COLUMN "public"."hs_device_electric"."tenant_id" IS '租户Id';
COMMENT ON COLUMN "public"."hs_device_electric"."factory_id" IS '工厂id';
COMMENT ON COLUMN "public"."hs_device_electric"."peak" IS '峰用电';
COMMENT ON COLUMN "public"."hs_device_electric"."device_id" IS '设备Id';
COMMENT ON COLUMN "public"."hs_device_electric"."valley" IS '谷用电';
COMMENT ON COLUMN "public"."hs_device_electric"."day_used" IS '总日用电';
COMMENT ON COLUMN "public"."hs_device_electric"."time" IS '时间';
COMMENT ON COLUMN "public"."hs_device_electric"."id" IS 'Id';
COMMENT ON COLUMN "public"."hs_device_electric"."created_time" IS '创建时间';
COMMENT ON COLUMN "public"."hs_device_electric"."group_id" IS '分组id';
COMMENT ON COLUMN "public"."hs_device_electric"."workshop_id" IS '车间id';
COMMENT ON COLUMN "public"."hs_device_electric"."gateway_id" IS '网关id';
CREATE TABLE "public"."hs_device_electric_hour" (
"created_user" varchar(255) COLLATE "pg_catalog"."default",
"updated_time" int8,
"updated_user" varchar(255) COLLATE "pg_catalog"."default",
"tenant_id" uuid,
"factory_id" uuid,
"peak" varchar(255) COLLATE "pg_catalog"."default",
"device_id" uuid,
"valley" varchar(255) COLLATE "pg_catalog"."default",
"hour_used" varchar(255) COLLATE "pg_catalog"."default",
"time" int8,
"id" uuid NOT NULL,
"created_time" int8,
"hour_time" int8,
"value" varchar(255) COLLATE "pg_catalog"."default",
"group_id" uuid,
"workshop_id" uuid,
"gateway_id" uuid,
CONSTRAINT "hs_device_electric_hour_pkey" PRIMARY KEY ("id"),
CONSTRAINT "uk_device_electric_hour" UNIQUE ("device_id", "hour_time")
)
;
ALTER TABLE "public"."hs_device_electric_hour"
OWNER TO "postgres";
CREATE INDEX "idx_device_electric_hour_device" ON "public"."hs_device_electric_hour" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"device_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"hour_time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_device_electric_hour_factory" ON "public"."hs_device_electric_hour" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"factory_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"hour_time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
COMMENT ON COLUMN "public"."hs_device_electric_hour"."created_user" IS '创建人';
COMMENT ON COLUMN "public"."hs_device_electric_hour"."updated_time" IS '更新时间';
COMMENT ON COLUMN "public"."hs_device_electric_hour"."updated_user" IS '更新人';
COMMENT ON COLUMN "public"."hs_device_electric_hour"."tenant_id" IS '租户Id';
COMMENT ON COLUMN "public"."hs_device_electric_hour"."factory_id" IS '工厂id';
COMMENT ON COLUMN "public"."hs_device_electric_hour"."peak" IS '峰用电';
COMMENT ON COLUMN "public"."hs_device_electric_hour"."device_id" IS '设备Id';
COMMENT ON COLUMN "public"."hs_device_electric_hour"."valley" IS '谷用电';
COMMENT ON COLUMN "public"."hs_device_electric_hour"."hour_used" IS '小时用电';
COMMENT ON COLUMN "public"."hs_device_electric_hour"."time" IS '时间';
COMMENT ON COLUMN "public"."hs_device_electric_hour"."created_time" IS '创建时间';
COMMENT ON COLUMN "public"."hs_device_electric_hour"."hour_time" IS '小时';
COMMENT ON COLUMN "public"."hs_device_electric_hour"."value" IS '值';
COMMENT ON COLUMN "public"."hs_device_electric_hour"."group_id" IS '分组id';
COMMENT ON COLUMN "public"."hs_device_electric_hour"."workshop_id" IS '车间id';
COMMENT ON COLUMN "public"."hs_device_electric_hour"."gateway_id" IS '网关id';
-- ----------------------------
-- Table structure for hs_device_extension
-- ----------------------------
DROP TABLE IF EXISTS "public"."hs_device_extension";
CREATE TABLE "public"."hs_device_extension" (
"id" uuid NOT NULL,
"workshop_id" uuid,
"group_id" uuid,
"picture" varchar(10000000) COLLATE "pg_catalog"."default",
"icon" varchar(255) COLLATE "pg_catalog"."default",
"created_user" uuid,
"updated_time" int8,
"updated_user" uuid,
"comment" varchar(255) COLLATE "pg_catalog"."default",
"sn" varchar(255) COLLATE "pg_catalog"."default",
"device_type" varchar(255) COLLATE "pg_catalog"."default",
"created_time" int8,
"factory_id" uuid,
"tenant_id" uuid NOT NULL,
"sort" int4 DEFAULT 1000,
"model_id" uuid
)
;
ALTER TABLE "public"."hs_device_extension" OWNER TO "postgres";
COMMENT ON COLUMN "public"."hs_device_extension"."id" IS '设备标识';
COMMENT ON COLUMN "public"."hs_device_extension"."workshop_id" IS '车间标识';
COMMENT ON COLUMN "public"."hs_device_extension"."group_id" IS '分组标识';
COMMENT ON COLUMN "public"."hs_device_extension"."picture" IS '图片';
COMMENT ON COLUMN "public"."hs_device_extension"."icon" IS '图标';
COMMENT ON COLUMN "public"."hs_device_extension"."comment" IS '备注';
COMMENT ON COLUMN "public"."hs_device_extension"."device_type" IS '设备类型';
COMMENT ON COLUMN "public"."hs_device_extension"."created_time" IS '创建时间';
COMMENT ON COLUMN "public"."hs_device_extension"."factory_id" IS '工厂标识(客户标识)';
COMMENT ON COLUMN "public"."hs_device_extension"."sort" IS '排序';
COMMENT ON COLUMN "public"."hs_device_extension"."model_id" IS '模型id';
COMMENT ON TABLE "public"."hs_device_extension" IS '设备信息扩展表';
-- ----------------------------
-- Primary Key structure for table hs_device_extension
-- ----------------------------
ALTER TABLE "public"."hs_device_extension" ADD CONSTRAINT "hs_device_ extension_pkey" PRIMARY KEY ("id");
CREATE TABLE "public"."hs_device_gas" (
"created_user" varchar(255) COLLATE "pg_catalog"."default",
"updated_time" int8,
"updated_user" varchar(255) COLLATE "pg_catalog"."default",
"tenant_id" uuid,
"factory_id" uuid,
"device_id" uuid,
"day_used" varchar(255) COLLATE "pg_catalog"."default",
"time" int8,
"id" uuid NOT NULL,
"created_time" int8,
"group_id" uuid,
"workshop_id" uuid,
"gateway_id" uuid,
CONSTRAINT "hs_device_gas_pkey" PRIMARY KEY ("id"),
CONSTRAINT "uk_device_gas" UNIQUE ("device_id", "time")
)
;
ALTER TABLE "public"."hs_device_gas"
OWNER TO "postgres";
CREATE INDEX "idx_device_gas_device" ON "public"."hs_device_gas" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"device_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_device_gas_factory" ON "public"."hs_device_gas" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"factory_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
COMMENT ON COLUMN "public"."hs_device_gas"."created_user" IS '创建人';
COMMENT ON COLUMN "public"."hs_device_gas"."updated_time" IS '更新时间';
COMMENT ON COLUMN "public"."hs_device_gas"."updated_user" IS '更新人';
COMMENT ON COLUMN "public"."hs_device_gas"."tenant_id" IS '租户Id';
COMMENT ON COLUMN "public"."hs_device_gas"."factory_id" IS '工厂id';
COMMENT ON COLUMN "public"."hs_device_gas"."device_id" IS '设备Id';
COMMENT ON COLUMN "public"."hs_device_gas"."day_used" IS '总日用水';
COMMENT ON COLUMN "public"."hs_device_gas"."time" IS '时间';
COMMENT ON COLUMN "public"."hs_device_gas"."id" IS 'Id';
COMMENT ON COLUMN "public"."hs_device_gas"."created_time" IS '创建时间';
COMMENT ON COLUMN "public"."hs_device_gas"."group_id" IS '分组id';
COMMENT ON COLUMN "public"."hs_device_gas"."workshop_id" IS '车间id';
COMMENT ON COLUMN "public"."hs_device_gas"."gateway_id" IS '网关id';
CREATE TABLE "public"."hs_device_gas_hour" (
"created_user" varchar(255) COLLATE "pg_catalog"."default",
"updated_time" int8,
"updated_user" varchar(255) COLLATE "pg_catalog"."default",
"tenant_id" uuid,
"factory_id" uuid,
"device_id" uuid,
"hour_used" varchar(255) COLLATE "pg_catalog"."default",
"time" int8,
"id" uuid NOT NULL,
"created_time" int8,
"hour_time" int8,
"value" varchar(255) COLLATE "pg_catalog"."default",
"group_id" uuid,
"workshop_id" uuid,
"gateway_id" uuid,
CONSTRAINT "hs_device_gas_hour_pkey" PRIMARY KEY ("id"),
CONSTRAINT "uk_device_gas_hour" UNIQUE ("device_id", "hour_time")
)
;
ALTER TABLE "public"."hs_device_gas_hour"
OWNER TO "postgres";
CREATE INDEX "idx_device_gas_hour_device" ON "public"."hs_device_gas_hour" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"device_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"hour_time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_device_gas_hour_factory" ON "public"."hs_device_gas_hour" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"factory_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"hour_time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
COMMENT ON COLUMN "public"."hs_device_gas_hour"."value" IS '值';
COMMENT ON COLUMN "public"."hs_device_gas_hour"."group_id" IS '分组id';
COMMENT ON COLUMN "public"."hs_device_gas_hour"."workshop_id" IS '车间id';
COMMENT ON COLUMN "public"."hs_device_gas_hour"."gateway_id" IS '网关id';
CREATE TABLE "public"."hs_device_switch" (
"created_user" varchar(255) COLLATE "pg_catalog"."default",
"updated_time" int8,
"updated_user" varchar(255) COLLATE "pg_catalog"."default",
"tenant_id" uuid,
"factory_id" uuid,
"device_id" uuid,
"time" int8,
"id" uuid NOT NULL,
"created_time" int8,
"off_line_time" int8,
"group_id" uuid,
"workshop_id" uuid,
"gateway_id" uuid,
"off_switch_time" int8,
"on_switch_time" int8,
CONSTRAINT "hs_device_switch_pkey" PRIMARY KEY ("id"),
CONSTRAINT "uk_device_switch" UNIQUE ("device_id", "time")
)
;
ALTER TABLE "public"."hs_device_switch"
OWNER TO "postgres";
CREATE INDEX "idx_device_switch_device" ON "public"."hs_device_switch" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"device_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_device_switch_factory" ON "public"."hs_device_switch" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"factory_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
COMMENT ON COLUMN "public"."hs_device_switch"."created_user" IS '创建人';
COMMENT ON COLUMN "public"."hs_device_switch"."updated_time" IS '更新时间';
COMMENT ON COLUMN "public"."hs_device_switch"."updated_user" IS '更新人';
COMMENT ON COLUMN "public"."hs_device_switch"."tenant_id" IS '租户Id';
COMMENT ON COLUMN "public"."hs_device_switch"."factory_id" IS '工厂id';
COMMENT ON COLUMN "public"."hs_device_switch"."device_id" IS '设备Id';
COMMENT ON COLUMN "public"."hs_device_switch"."time" IS '时间';
COMMENT ON COLUMN "public"."hs_device_switch"."id" IS 'Id';
COMMENT ON COLUMN "public"."hs_device_switch"."created_time" IS '创建时间';
COMMENT ON COLUMN "public"."hs_device_switch"."off_line_time" IS '离线时长';
COMMENT ON COLUMN "public"."hs_device_switch"."group_id" IS '分组id';
COMMENT ON COLUMN "public"."hs_device_switch"."workshop_id" IS '车间id';
COMMENT ON COLUMN "public"."hs_device_switch"."gateway_id" IS '网关id';
COMMENT ON COLUMN "public"."hs_device_switch"."off_switch_time" IS '停机时长';
COMMENT ON COLUMN "public"."hs_device_switch"."on_switch_time" IS '开机时长';
CREATE TABLE "public"."hs_device_switch_hour" (
"created_user" varchar(255) COLLATE "pg_catalog"."default",
"updated_time" int8,
"updated_user" varchar(255) COLLATE "pg_catalog"."default",
"tenant_id" uuid,
"device_id" uuid,
"hour_time" int8,
"time" int8,
"id" uuid NOT NULL,
"created_time" int8,
"factory_id" uuid,
"group_id" uuid,
"workshop_id" uuid,
"gateway_id" uuid,
"off_line_time" int8,
"off_switch_time" int8,
"on_switch_time" int8,
CONSTRAINT "hs_device_switch_hour_pkey" PRIMARY KEY ("id"),
CONSTRAINT "uk_device_switch_hour" UNIQUE ("device_id", "hour_time")
)
;
ALTER TABLE "public"."hs_device_switch_hour"
OWNER TO "postgres";
CREATE INDEX "idx_device_switch_hour_device" ON "public"."hs_device_switch_hour" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"device_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"hour_time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_device_switch_hour_factory" ON "public"."hs_device_switch_hour" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"factory_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"hour_time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
COMMENT ON COLUMN "public"."hs_device_switch_hour"."created_user" IS '创建人';
COMMENT ON COLUMN "public"."hs_device_switch_hour"."updated_time" IS '更新时间';
COMMENT ON COLUMN "public"."hs_device_switch_hour"."updated_user" IS '更新人';
COMMENT ON COLUMN "public"."hs_device_switch_hour"."tenant_id" IS '租户Id';
COMMENT ON COLUMN "public"."hs_device_switch_hour"."device_id" IS '设备Id';
COMMENT ON COLUMN "public"."hs_device_switch_hour"."hour_time" IS '小时';
COMMENT ON COLUMN "public"."hs_device_switch_hour"."time" IS '时间';
COMMENT ON COLUMN "public"."hs_device_switch_hour"."id" IS 'Id';
COMMENT ON COLUMN "public"."hs_device_switch_hour"."created_time" IS '创建时间';
COMMENT ON COLUMN "public"."hs_device_switch_hour"."factory_id" IS '工厂Id';
COMMENT ON COLUMN "public"."hs_device_switch_hour"."group_id" IS '分组id';
COMMENT ON COLUMN "public"."hs_device_switch_hour"."workshop_id" IS '车间id';
COMMENT ON COLUMN "public"."hs_device_switch_hour"."gateway_id" IS '网关id';
COMMENT ON COLUMN "public"."hs_device_switch_hour"."off_line_time" IS '离线时长';
COMMENT ON COLUMN "public"."hs_device_switch_hour"."off_switch_time" IS '停机时长';
COMMENT ON COLUMN "public"."hs_device_switch_hour"."on_switch_time" IS '开机时长';
CREATE TABLE "public"."hs_device_switch_trend" (
"created_user" varchar(255) COLLATE "pg_catalog"."default",
"updated_time" int8,
"updated_user" varchar(255) COLLATE "pg_catalog"."default",
"tenant_id" uuid,
"factory_id" uuid,
"device_id" uuid,
"id" uuid NOT NULL,
"created_time" int8,
"group_id" uuid,
"workshop_id" uuid,
"gateway_id" uuid,
"status" varchar(255) COLLATE "pg_catalog"."default",
"start_time" int8,
"end_time" int8,
CONSTRAINT "hs_device_switch_trend_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."hs_device_switch_trend"
OWNER TO "postgres";
CREATE INDEX "idx_device_switch_trend" ON "public"."hs_device_switch_trend" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"device_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"start_time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
COMMENT ON COLUMN "public"."hs_device_switch_trend"."created_user" IS '创建人';
COMMENT ON COLUMN "public"."hs_device_switch_trend"."updated_time" IS '更新时间';
COMMENT ON COLUMN "public"."hs_device_switch_trend"."updated_user" IS '更新人';
COMMENT ON COLUMN "public"."hs_device_switch_trend"."tenant_id" IS '租户Id';
COMMENT ON COLUMN "public"."hs_device_switch_trend"."factory_id" IS '工厂id';
COMMENT ON COLUMN "public"."hs_device_switch_trend"."device_id" IS '设备Id';
COMMENT ON COLUMN "public"."hs_device_switch_trend"."id" IS 'Id';
COMMENT ON COLUMN "public"."hs_device_switch_trend"."created_time" IS '创建时间';
COMMENT ON COLUMN "public"."hs_device_switch_trend"."group_id" IS '分组id';
COMMENT ON COLUMN "public"."hs_device_switch_trend"."workshop_id" IS '车间id';
COMMENT ON COLUMN "public"."hs_device_switch_trend"."gateway_id" IS '网关id';
COMMENT ON COLUMN "public"."hs_device_switch_trend"."status" IS '状态(OFF_LINE, OFF_SWITCH, ON_SWITCH)';
COMMENT ON COLUMN "public"."hs_device_switch_trend"."start_time" IS '开始时间';
COMMENT ON COLUMN "public"."hs_device_switch_trend"."end_time" IS '结束时间';
CREATE TABLE "public"."hs_device_ts" (
"created_user" varchar(255) COLLATE "pg_catalog"."default",
"updated_time" int8,
"updated_user" varchar(255) COLLATE "pg_catalog"."default",
"tenant_id" uuid,
"factory_id" uuid,
"device_id" uuid,
"num" int8,
"time" int8,
"id" uuid NOT NULL,
"created_time" int8,
"group_id" uuid,
"workshop_id" uuid,
"gateway_id" uuid,
CONSTRAINT "hs_device_ts_pkey" PRIMARY KEY ("id"),
CONSTRAINT "uk_device_ts" UNIQUE ("device_id", "time")
)
;
ALTER TABLE "public"."hs_device_ts"
OWNER TO "postgres";
CREATE INDEX "idx_device_ts_device" ON "public"."hs_device_ts" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"device_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_device_ts_factory" ON "public"."hs_device_ts" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"factory_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
COMMENT ON COLUMN "public"."hs_device_ts"."created_user" IS '创建人';
COMMENT ON COLUMN "public"."hs_device_ts"."updated_time" IS '更新时间';
COMMENT ON COLUMN "public"."hs_device_ts"."updated_user" IS '更新人';
COMMENT ON COLUMN "public"."hs_device_ts"."tenant_id" IS '租户Id';
COMMENT ON COLUMN "public"."hs_device_ts"."factory_id" IS '工厂id';
COMMENT ON COLUMN "public"."hs_device_ts"."device_id" IS '设备Id';
COMMENT ON COLUMN "public"."hs_device_ts"."num" IS '数量';
COMMENT ON COLUMN "public"."hs_device_ts"."time" IS '时间';
COMMENT ON COLUMN "public"."hs_device_ts"."created_time" IS '创建时间';
COMMENT ON COLUMN "public"."hs_device_ts"."group_id" IS '分组id';
COMMENT ON COLUMN "public"."hs_device_ts"."workshop_id" IS '车间id';
COMMENT ON COLUMN "public"."hs_device_ts"."gateway_id" IS '网关id';
CREATE TABLE "public"."hs_device_ts_hour" (
"created_user" varchar(255) COLLATE "pg_catalog"."default",
"updated_time" int8,
"updated_user" varchar(255) COLLATE "pg_catalog"."default",
"tenant_id" uuid,
"factory_id" uuid,
"device_id" uuid,
"num" int8,
"time" int8,
"hour_time" int8,
"id" uuid NOT NULL,
"created_time" int8,
"group_id" uuid,
"workshop_id" uuid,
"gateway_id" uuid,
"value" int8,
CONSTRAINT "hs_device_ts_hour_pkey" PRIMARY KEY ("id"),
CONSTRAINT "uk_device_ts_hour" UNIQUE ("device_id", "hour_time")
)
;
ALTER TABLE "public"."hs_device_ts_hour"
OWNER TO "postgres";
CREATE INDEX "idx_device_ts_hour_device" ON "public"."hs_device_ts_hour" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"device_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"hour_time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_device_ts_hour_factory" ON "public"."hs_device_ts_hour" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"factory_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"hour_time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
COMMENT ON COLUMN "public"."hs_device_ts_hour"."group_id" IS '分组id';
COMMENT ON COLUMN "public"."hs_device_ts_hour"."workshop_id" IS '车间id';
COMMENT ON COLUMN "public"."hs_device_ts_hour"."gateway_id" IS '网关id';
COMMENT ON COLUMN "public"."hs_device_ts_hour"."value" IS '值';
CREATE TABLE "public"."hs_device_water" (
"created_user" varchar(255) COLLATE "pg_catalog"."default",
"updated_time" int8,
"updated_user" varchar(255) COLLATE "pg_catalog"."default",
"tenant_id" uuid,
"factory_id" uuid,
"device_id" uuid,
"day_used" varchar(255) COLLATE "pg_catalog"."default",
"time" int8,
"id" uuid NOT NULL,
"created_time" int8,
"group_id" uuid,
"workshop_id" uuid,
"gateway_id" uuid,
CONSTRAINT "hs_device_water_pkey" PRIMARY KEY ("id"),
CONSTRAINT "uk_device_water" UNIQUE ("device_id", "time")
)
;
ALTER TABLE "public"."hs_device_water"
OWNER TO "postgres";
CREATE INDEX "idx_device_water_device" ON "public"."hs_device_water" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"device_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_device_water_factory" ON "public"."hs_device_water" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"factory_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
COMMENT ON COLUMN "public"."hs_device_water"."created_user" IS '创建人';
COMMENT ON COLUMN "public"."hs_device_water"."updated_time" IS '更新时间';
COMMENT ON COLUMN "public"."hs_device_water"."updated_user" IS '更新人';
COMMENT ON COLUMN "public"."hs_device_water"."tenant_id" IS '租户Id';
COMMENT ON COLUMN "public"."hs_device_water"."factory_id" IS '工厂id';
COMMENT ON COLUMN "public"."hs_device_water"."device_id" IS '设备Id';
COMMENT ON COLUMN "public"."hs_device_water"."day_used" IS '总日用水';
COMMENT ON COLUMN "public"."hs_device_water"."time" IS '时间';
COMMENT ON COLUMN "public"."hs_device_water"."created_time" IS '创建时间';
COMMENT ON COLUMN "public"."hs_device_water"."group_id" IS '分组id';
COMMENT ON COLUMN "public"."hs_device_water"."workshop_id" IS '车间id';
COMMENT ON COLUMN "public"."hs_device_water"."gateway_id" IS '网关id';
CREATE TABLE "public"."hs_device_water_hour" (
"created_user" varchar(255) COLLATE "pg_catalog"."default",
"updated_time" int8,
"updated_user" varchar(255) COLLATE "pg_catalog"."default",
"tenant_id" uuid,
"factory_id" uuid,
"device_id" uuid,
"hour_used" varchar(255) COLLATE "pg_catalog"."default",
"time" int8,
"id" uuid NOT NULL,
"created_time" int8,
"hour_time" int8,
"value" varchar(255) COLLATE "pg_catalog"."default",
"group_id" uuid,
"workshop_id" uuid,
"gateway_id" uuid,
CONSTRAINT "hs_device_water_hour_pkey" PRIMARY KEY ("id"),
CONSTRAINT "uk_device_water_hour" UNIQUE ("device_id", "hour_time")
)
;
ALTER TABLE "public"."hs_device_water_hour"
OWNER TO "postgres";
CREATE INDEX "idx_device_water_hour_device" ON "public"."hs_device_water_hour" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"device_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"hour_time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "idx_device_water_hour_factory" ON "public"."hs_device_water_hour" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"factory_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"hour_time" "pg_catalog"."int8_ops" ASC NULLS LAST
);
COMMENT ON COLUMN "public"."hs_device_water_hour"."value" IS '值';
COMMENT ON COLUMN "public"."hs_device_water_hour"."group_id" IS '分组id';
COMMENT ON COLUMN "public"."hs_device_water_hour"."workshop_id" IS '车间id';
COMMENT ON COLUMN "public"."hs_device_water_hour"."gateway_id" IS '网关id';
CREATE TABLE "public"."hs_external_interface" (
"id" uuid NOT NULL,
"created_time" int8,
"created_user" uuid,
"tenant_id" uuid,
"updated_time" int8,
"updated_user" uuid,
"app_id" varchar(255) COLLATE "pg_catalog"."default",
"app_key" varchar(255) COLLATE "pg_catalog"."default",
"app_secret" varchar(255) COLLATE "pg_catalog"."default",
"apply_name" varchar(255) COLLATE "pg_catalog"."default",
"enable_status" bool,
"notes" varchar(255) COLLATE "pg_catalog"."default",
"project_describe" varchar(255) COLLATE "pg_catalog"."default",
"project_telephone" varchar(255) COLLATE "pg_catalog"."default",
"project_user" varchar(255) COLLATE "pg_catalog"."default",
"statistic_value" int8,
CONSTRAINT "hs_external_interface_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."hs_external_interface"
OWNER TO "postgres";
CREATE TABLE "public"."hs_last_expand_extension" (
"key_id" int4 NOT NULL,
"entity_id" uuid NOT NULL,
"created_time" int8,
"tenant_id" uuid,
"updated_time" int8,
"device_name" varchar(255) COLLATE "pg_catalog"."default",
"device_type" varchar(255) COLLATE "pg_catalog"."default",
"enable" bool,
"factory_id" uuid,
"factory_name" varchar(255) COLLATE "pg_catalog"."default",
"gateway_id" uuid,
"gateway_name" varchar(255) COLLATE "pg_catalog"."default",
"group_id" uuid,
"group_name" varchar(255) COLLATE "pg_catalog"."default",
"history_lower" varchar(255) COLLATE "pg_catalog"."default",
"history_upper" varchar(255) COLLATE "pg_catalog"."default",
"key" varchar(255) COLLATE "pg_catalog"."default",
"unit_name" varchar(255) COLLATE "pg_catalog"."default",
"volume_on_day" int8,
"workshop_id" uuid,
"workshop_name" varchar(255) COLLATE "pg_catalog"."default",
CONSTRAINT "hs_last_expand_extension_pkey" PRIMARY KEY ("key_id", "entity_id")
)
;
ALTER TABLE "public"."hs_last_expand_extension"
OWNER TO "postgres";
COMMENT ON COLUMN "public"."hs_last_expand_extension"."key_id" IS 'keyId';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."entity_id" IS '设备id';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."created_time" IS '创建时间(表设计基础字段)';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."tenant_id" IS '租户id(表设计基础字段)';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."updated_time" IS '修改时间(表设计基础字段)';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."device_name" IS '设备名称';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."device_type" IS '0是设备,1是网关';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."enable" IS '是否启用(默认启用)';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."factory_id" IS '工厂id';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."factory_name" IS '工厂名称';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."group_id" IS '分组id';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."group_name" IS '分组名称';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."history_lower" IS '历史最小值';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."history_upper" IS '历史最大值';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."key" IS '遥测的名称';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."unit_name" IS '单位名称';
COMMENT ON COLUMN "public"."hs_last_expand_extension"."volume_on_day" IS '当日遥测量(条数)';
CREATE TABLE "public"."hs_push_conf_table" (
"id" uuid NOT NULL,
"created_time" int8,
"created_user" uuid,
"tenant_id" uuid,
"updated_time" int8,
"updated_user" uuid,
"kafka_ip" varchar(255) COLLATE "pg_catalog"."default",
"kafka_names" varchar(255) COLLATE "pg_catalog"."default",
"kafka_port" varchar(255) COLLATE "pg_catalog"."default",
"kafka_status" bool,
"kafka_topic_pre" varchar(255) COLLATE "pg_catalog"."default",
"mqtt_ip" varchar(255) COLLATE "pg_catalog"."default",
"mqtt_port" varchar(255) COLLATE "pg_catalog"."default",
"mqtt_qos_type" varchar(255) COLLATE "pg_catalog"."default",
"mqtt_status" bool,
"mqtt_user_name" varchar(255) COLLATE "pg_catalog"."default",
"mqtt_password" varchar(255) COLLATE "pg_catalog"."default",
"notes" varchar(255) COLLATE "pg_catalog"."default",
"statistic_value" int8,
CONSTRAINT "hs_push_conf_table_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."hs_push_conf_table"
OWNER TO "postgres";
CREATE TABLE "public"."hs_role" (
"id" uuid NOT NULL,
"created_time" int8,
"created_user" uuid,
"tenant_id" uuid,
"updated_time" int8,
"updated_user" uuid,
"role_code" varchar(255) COLLATE "pg_catalog"."default",
"role_desc" varchar(255) COLLATE "pg_catalog"."default",
"role_name" varchar(255) COLLATE "pg_catalog"."default",
"factory_id" uuid,
"system_tab" varchar(255) COLLATE "pg_catalog"."default",
"type" varchar(255) COLLATE "pg_catalog"."default",
"operation_type" int4 DEFAULT 0,
"user_level" int4 DEFAULT 0,
"virtual_code" int4,
CONSTRAINT "hs_role_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."hs_role"
OWNER TO "postgres";
CREATE TABLE "public"."hs_weather" (
"id" uuid NOT NULL,
"created_time" int8,
"created_user" varchar(255) COLLATE "pg_catalog"."default",
"updated_time" int8,
"updated_user" varchar(255) COLLATE "pg_catalog"."default",
"tenant_id" uuid,
"factory_id" uuid,
"weather" varchar(255) COLLATE "pg_catalog"."default",
"temperature" varchar(255) COLLATE "pg_catalog"."default",
"wind_direction" varchar(255) COLLATE "pg_catalog"."default",
"wind_power" varchar(255) COLLATE "pg_catalog"."default",
"humidity" varchar(255) COLLATE "pg_catalog"."default",
"report_time_str" varchar(255) COLLATE "pg_catalog"."default",
"report_time" int8,
CONSTRAINT "hs_weather_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."hs_weather"
OWNER TO "postgres";
CREATE INDEX "idx_weather" ON "public"."hs_weather" USING btree (
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"factory_id" "pg_catalog"."uuid_ops" ASC NULLS LAST
);
COMMENT ON COLUMN "public"."hs_weather"."id" IS 'Id';
COMMENT ON COLUMN "public"."hs_weather"."created_time" IS '创建时间';
COMMENT ON COLUMN "public"."hs_weather"."created_user" IS '创建人';
COMMENT ON COLUMN "public"."hs_weather"."updated_time" IS '更新时间';
COMMENT ON COLUMN "public"."hs_weather"."updated_user" IS '更新人';
COMMENT ON COLUMN "public"."hs_weather"."tenant_id" IS '租户Id';
COMMENT ON COLUMN "public"."hs_weather"."factory_id" IS '工厂id';
COMMENT ON COLUMN "public"."hs_weather"."weather" IS '天气';
COMMENT ON COLUMN "public"."hs_weather"."temperature" IS '温度';
COMMENT ON COLUMN "public"."hs_weather"."wind_direction" IS '风向';
COMMENT ON COLUMN "public"."hs_weather"."wind_power" IS '风力';
COMMENT ON COLUMN "public"."hs_weather"."humidity" IS '湿度';
COMMENT ON COLUMN "public"."hs_weather"."report_time_str" IS '报告时间';
COMMENT ON COLUMN "public"."hs_weather"."report_time" IS '报告时间';
COMMENT ON TABLE "public"."hs_weather" IS '天气';
CREATE TABLE IF NOT EXISTS public.tb_menu
(
id uuid NOT NULL,
code character varying(255) COLLATE pg_catalog."default" NOT NULL,
name character varying(255) COLLATE pg_catalog."default",
level bigint NOT NULL,
sort bigint NOT NULL,
url character varying(1000) COLLATE pg_catalog."default",
parent_id uuid,
menu_icon character varying(255) COLLATE pg_catalog."default",
menu_images character varying(1000) COLLATE pg_catalog."default",
region character varying(255) COLLATE pg_catalog."default",
created_time bigint NOT NULL,
created_user uuid,
updated_time character varying(255) COLLATE pg_catalog."default",
updated_user uuid,
menu_type character varying(255) COLLATE pg_catalog."default",
path character varying(255) COLLATE pg_catalog."default" DEFAULT NULL::character varying,
is_button boolean DEFAULT false,
lang_key character varying(255) COLLATE pg_catalog."default"
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.tb_menu
OWNER to postgres;
-- Table: public.tb_tenant_menu
-- DROP TABLE IF EXISTS public.tb_tenant_menu;
CREATE TABLE IF NOT EXISTS public.tb_tenant_menu
(
id uuid NOT NULL,
tenant_id uuid NOT NULL,
sys_menu_id uuid,
sys_menu_code character varying(255) COLLATE pg_catalog."default",
sys_menu_name character varying(255) COLLATE pg_catalog."default",
tenant_menu_name character varying(255) COLLATE pg_catalog."default",
tenant_menu_code character varying(255) COLLATE pg_catalog."default" NOT NULL,
level bigint NOT NULL,
sort bigint NOT NULL,
url character varying(1000) COLLATE pg_catalog."default",
parent_id uuid,
tenant_menu_icon character varying(255) COLLATE pg_catalog."default",
tenant_menu_images character varying(1000) COLLATE pg_catalog."default",
region character varying(255) COLLATE pg_catalog."default",
created_time bigint NOT NULL,
created_user uuid,
updated_time character varying(255) COLLATE pg_catalog."default",
updated_user uuid,
menu_type character varying(255) COLLATE pg_catalog."default",
path character varying(255) COLLATE pg_catalog."default" DEFAULT NULL::character varying,
is_button boolean DEFAULT false,
lang_key character varying(255) COLLATE pg_catalog."default",
has_children boolean DEFAULT false,
CONSTRAINT tb_tenant_menu_pkey PRIMARY KEY (id)
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.tb_tenant_menu
OWNER to postgres;
-- Table: public.tb_tenant_menu_role
-- DROP TABLE IF EXISTS public.tb_tenant_menu_role;
CREATE TABLE IF NOT EXISTS public.tb_tenant_menu_role
(
id uuid NOT NULL,
created_time bigint,
created_user uuid,
tenant_id uuid,
updated_time bigint,
updated_user uuid,
remark character varying(255) COLLATE pg_catalog."default",
tenant_menu_id uuid,
tenant_sys_role_id uuid,
flg character varying(255) COLLATE pg_catalog."default",
CONSTRAINT tb_tenant_menu_role_pkey PRIMARY KEY (id)
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.tb_tenant_menu_role
OWNER to postgres;
ALTER TABLE public.hs_last_expand_extension ADD volume_on_yesterday int8 NOT NULL DEFAULT 0;
ALTER TABLE public.hs_last_expand_extension ADD volume_on_history int8 NOT NULL DEFAULT 0;
CREATE TABLE "public"."hs_config_table" (
"id" uuid NOT NULL,
"created_time" int8,
"created_user" uuid,
"tenant_id" uuid,
"updated_time" int8,
"updated_user" uuid,
"key" varchar(255) COLLATE "pg_catalog"."default",
"notes" varchar(255) COLLATE "pg_catalog"."default",
"json_value" varchar COLLATE "pg_catalog"."default",
CONSTRAINT "hs_config_table_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."hs_config_table" OWNER TO "postgres";
ALTER TABLE "public"."hs_device_switch" ADD COLUMN "on_line_time" int8;
COMMENT ON COLUMN "public"."hs_device_switch"."on_line_time" IS '在线时长';
ALTER TABLE "public"."hs_device_switch_hour" ADD COLUMN "on_line_time" int8;
COMMENT ON COLUMN "public"."hs_device_switch_hour"."on_line_time" IS '在线时长';
CREATE TABLE "public"."hs_level_role" (
"role_id" uuid NOT NULL,
"p_id" uuid NOT NULL,
CONSTRAINT "hs_level_role_pkey" PRIMARY KEY ("role_id", "p_id")
)
;
ALTER TABLE "public"."hs_level_role" OWNER TO "postgres";
ALTER TABLE "public"."hs_role" ADD COLUMN "role_public" bool;
ALTER TABLE "public"."hs_role" DROP COLUMN "factory_id";
ALTER TABLE "public"."hs_role" DROP COLUMN "type";
ALTER TABLE "public"."hs_role" DROP COLUMN "user_level";
CREATE TABLE "public"."hs_role_menu_relation" (
"id" uuid NOT NULL,
"created_time" int8,
"created_user" uuid,
"tenant_id" uuid,
"updated_time" int8,
"updated_user" uuid,
"menu_id" uuid,
"notes" varchar(255) COLLATE "pg_catalog"."default",
"role_id" uuid,
"flg" varchar(255) COLLATE "pg_catalog"."default",
CONSTRAINT "role_menu_relation_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."hs_role_menu_relation" OWNER TO "postgres";
CREATE TABLE "public"."hs_user_extension" (
"id" uuid NOT NULL,
"created_time" int8,
"created_user" uuid,
"tenant_id" uuid,
"updated_time" int8,
"updated_user" uuid,
"address" varchar(255) COLLATE "pg_catalog"."default",
"avatar" varchar(255) COLLATE "pg_catalog"."default",
"bind_time" int8,
"include_nick_name" varchar(255) COLLATE "pg_catalog"."default",
"open_id" varchar(255) COLLATE "pg_catalog"."default",
"phone_number" varchar(255) COLLATE "pg_catalog"."default",
"registrate_applet" varchar(255) COLLATE "pg_catalog"."default",
"user_code" varchar(255) COLLATE "pg_catalog"."default",
"user_id" uuid,
"user_name" varchar(255) COLLATE "pg_catalog"."default",
"virtual_code" int4,
"wechat_nick_name" varchar(255) COLLATE "pg_catalog"."default",
"wechat_sign_status" varchar(255) COLLATE "pg_catalog"."default",
CONSTRAINT "hs_user_extension_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."hs_user_extension" OWNER TO "postgres";
CREATE TABLE "public"."hs_user_role_relation" (
"id" uuid NOT NULL,
"created_time" int8,
"created_user" uuid,
"tenant_id" uuid,
"updated_time" int8,
"updated_user" uuid,
"notes" varchar(255) COLLATE "pg_catalog"."default",
"role_id" uuid,
"user_id" uuid,
CONSTRAINT "user_role_relation_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."hs_user_role_relation" OWNER TO "postgres";
CREATE TABLE "public"."hs_wechat_apply_history" (
"id" uuid NOT NULL,
"created_time" int8,
"created_user" uuid,
"tenant_id" uuid,
"updated_time" int8,
"updated_user" uuid,
"apply_info" varchar(255) COLLATE "pg_catalog"."default",
"avatar" varchar(255) COLLATE "pg_catalog"."default",
"factory_id" uuid,
"wechat_nick_name" varchar(255) COLLATE "pg_catalog"."default",
"notes" varchar(255) COLLATE "pg_catalog"."default",
"open_id" varchar(255) COLLATE "pg_catalog"."default",
"review_status" varchar(255) COLLATE "pg_catalog"."default",
"sex" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."hs_wechat_apply_history" OWNER TO "postgres";
CREATE TABLE "public"."role_menu_relation" (
"id" uuid NOT NULL,
"created_time" int8,
"created_user" uuid,
"tenant_id" uuid,
"updated_time" int8,
"updated_user" uuid,
"menu_id" uuid,
"notes" varchar(255) COLLATE "pg_catalog"."default",
"role_id" uuid,
CONSTRAINT "role_menu_relation_pkey1" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."role_menu_relation" OWNER TO "postgres";
CREATE TABLE "public"."tcode_model" (
"id" uuid NOT NULL,
"gid" uuid,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"name" varchar(255) COLLATE "pg_catalog"."default",
"created_user" uuid,
"updated_user" uuid,
"driver_version" varchar(255) COLLATE "pg_catalog"."default",
"tenant_id" uuid,
"updated_time" int8,
"created_time" int8,
CONSTRAINT "tcode_model_pkey" PRIMARY KEY ("id", "code")
)
;
ALTER TABLE "public"."tcode_model" OWNER TO "postgres";
CREATE TABLE "public"."tcode_model_detail" (
"id" uuid NOT NULL,
"gid" uuid,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"grpcode" varchar(255) COLLATE "pg_catalog"."default",
"unit_id" uuid,
"kup" varchar(255) COLLATE "pg_catalog"."default",
"kdwn" varchar(255) COLLATE "pg_catalog"."default",
"ksetup" varchar(255) COLLATE "pg_catalog"."default",
"sort" varchar(255) COLLATE "pg_catalog"."default" DEFAULT '1000'::character varying,
"halt" char(1) COLLATE "pg_catalog"."default" DEFAULT 'F'::bpchar,
"ex_s1" varchar(255) COLLATE "pg_catalog"."default",
"ex_s2" varchar(255) COLLATE "pg_catalog"."default",
"ex_s3" varchar(255) COLLATE "pg_catalog"."default",
"ex_s4" varchar(255) COLLATE "pg_catalog"."default",
"ex_s5" varchar(255) COLLATE "pg_catalog"."default",
"created_user" uuid,
"updated_user" uuid,
"standard" varchar(255) COLLATE "pg_catalog"."default",
"hour" bool,
"day" bool,
"change" bool,
"tenant_id" uuid,
"val" varchar(255) COLLATE "pg_catalog"."default",
"created_time" int8,
"updated_time" int8,
"kup_time" int8,
"ksetup_time" int8,
"kdwn_time" int8,
CONSTRAINT "tcode_model_detail_pkey" PRIMARY KEY ("id", "code", "key")
)
;
ALTER TABLE "public"."tcode_model_detail" OWNER TO "postgres";
COMMENT ON COLUMN "public"."tcode_model_detail"."id" IS '属性ID';
COMMENT ON COLUMN "public"."tcode_model_detail"."gid" IS '网关ID';
COMMENT ON COLUMN "public"."tcode_model_detail"."code" IS '模型代码';
COMMENT ON COLUMN "public"."tcode_model_detail"."key" IS '属性key';
COMMENT ON COLUMN "public"."tcode_model_detail"."grpcode" IS '分组ID';
COMMENT ON COLUMN "public"."tcode_model_detail"."unit_id" IS '单位ID';
COMMENT ON COLUMN "public"."tcode_model_detail"."kup" IS '上限值';
COMMENT ON COLUMN "public"."tcode_model_detail"."kdwn" IS '下限值';
COMMENT ON COLUMN "public"."tcode_model_detail"."ksetup" IS '设定值';
COMMENT ON COLUMN "public"."tcode_model_detail"."sort" IS '排序';
COMMENT ON COLUMN "public"."tcode_model_detail"."halt" IS '是否停用';
COMMENT ON COLUMN "public"."tcode_model_detail"."ex_s1" IS '扩展字段1';
COMMENT ON COLUMN "public"."tcode_model_detail"."ex_s2" IS '扩展字段2';
COMMENT ON COLUMN "public"."tcode_model_detail"."ex_s3" IS '扩展字段3';
COMMENT ON COLUMN "public"."tcode_model_detail"."ex_s4" IS '扩展字段4';
COMMENT ON COLUMN "public"."tcode_model_detail"."ex_s5" IS '扩展字段5';
COMMENT ON COLUMN "public"."tcode_model_detail"."standard" IS '标准值';
COMMENT ON COLUMN "public"."tcode_model_detail"."hour" IS '每小时存储';
COMMENT ON COLUMN "public"."tcode_model_detail"."day" IS '每天存储';
COMMENT ON COLUMN "public"."tcode_model_detail"."change" IS '属性值变化存储';
COMMENT ON COLUMN "public"."tcode_model_detail"."val" IS '属性名';
COMMENT ON COLUMN "public"."tcode_model_detail"."kup_time" IS '上限值时间';
COMMENT ON COLUMN "public"."tcode_model_detail"."ksetup_time" IS '设定值更新时间';
COMMENT ON COLUMN "public"."tcode_model_detail"."kdwn_time" IS '下限值设定时间';
CREATE TABLE "public"."tcode_unit" (
"id" uuid NOT NULL,
"descript" varchar(255) COLLATE "pg_catalog"."default",
"created_time" int8,
"updated_time" int8,
"created_user" uuid,
"updated_user" uuid,
"tenant_id" uuid,
CONSTRAINT "tcode_unit_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."tcode_unit" OWNER TO "postgres";
CREATE TABLE "public"."tmsg" (
"msg" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."tmsg" OWNER TO "postgres";
CREATE TABLE "public"."user_role_relation" (
"id" uuid NOT NULL,
"created_time" int8,
"created_user" uuid,
"tenant_id" uuid,
"updated_time" int8,
"updated_user" uuid,
"notes" varchar(255) COLLATE "pg_catalog"."default",
"role_id" uuid,
"user_id" uuid,
CONSTRAINT "user_role_relation_pkey1" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."user_role_relation" OWNER TO "postgres";
ALTER TABLE "public"."hs_level_role" ADD CONSTRAINT "fkdksrna0gfh9ct8lth5gq8inyb" FOREIGN KEY ("role_id") REFERENCES "public"."hs_role" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "public"."hs_level_role" ADD CONSTRAINT "fkkn8ks2krh0ktkoxf0itq8yx9a" FOREIGN KEY ("p_id") REFERENCES "public"."hs_role" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
SELECT setval('"public"."ts_kv_dictionary_key_id_seq"', 543, true);
CREATE VIEW "public"."vcode_key_detail" AS SELECT hs.tenant_id AS tid,
hs.factory_id AS fid,
hs.factory_name AS fname,
hs.workshop_id AS wid,
hs.workshop_name AS wname,
hs.group_id AS grpid,
hs.group_name AS grpname,
hs.gateway_id AS gid,
hs.gateway_name AS gname,
hs.key,
hs.key_id,
hs.entity_id AS did,
hs.enable,
hs.device_name AS dname,
hs.device_type,
hs.history_lower,
hs.history_upper,
hs.volume_on_day,
concat(ts1.dbl_v, ts1.long_v, ts1.str_v) AS val,
ts1.dbl_v,
ts1.long_v,
ts1.str_v,
ts1.bool_v,
to_jsonb(ts1.json_v) AS json_v,
ts1.ts,
to_char(timezone('UTC-8'::text, to_timestamp((ts1.ts / 1000)::double precision)), 'yyyy-MM-dd HH24:MI:SS'::text) AS update_time
FROM ts_kv_latest ts1,
hs_last_expand_extension hs
WHERE ts1.entity_id = hs.entity_id AND ts1.key = hs.key_id AND NOT ((hs.entity_id, hs.key::text) IN ( SELECT ak.entity_id,
ak.attribute_key
FROM attribute_kv ak
WHERE ak.attribute_type::text = 'CLIENT_SCOPE'::text AND ak.entity_type::text = 'DEVICE'::text))
UNION
SELECT hde.tenant_id AS tid,
hde.factory_id AS fid,
c.title AS fname,
hde.workshop_id AS wid,
a.name AS wname,
hde.group_id AS grpid,
a1.name AS grpname,
NULL::uuid AS gid,
NULL::character varying AS gname,
ak.attribute_key AS key,
NULL::integer AS key_id,
ak.entity_id AS did,
NULL::boolean AS enable,
d.name AS dname,
NULL::character varying AS device_type,
NULL::character varying AS history_lower,
NULL::character varying AS history_upper,
NULL::bigint AS volume_on_day,
concat(ak.dbl_v, ak.long_v, ak.str_v) AS val,
ak.dbl_v,
ak.long_v,
ak.str_v,
ak.bool_v,
to_jsonb(ak.json_v) AS json_v,
ak.last_update_ts AS ts,
to_char(timezone('UTC-8'::text, to_timestamp((ak.last_update_ts / 1000)::double precision)), 'yyyy-MM-dd HH24:MI:SS'::text) AS update_time
FROM attribute_kv ak
LEFT JOIN hs_device_extension hde ON hde.id = ak.entity_id
JOIN device d ON hde.id = d.id
LEFT JOIN customer c ON hde.factory_id = c.id
LEFT JOIN asset a ON hde.workshop_id = a.id AND a.type::text = 'workshop'::text
LEFT JOIN asset a1 ON hde.group_id = a1.id AND a.type::text = 'group'::text
WHERE ak.attribute_type::text = 'CLIENT_SCOPE'::text AND ak.entity_type::text = 'DEVICE'::text;
ALTER TABLE "public"."vcode_key_detail" OWNER TO "postgres";
CREATE VIEW "public"."v_device" AS SELECT c.id,
c.name,
c.tenant_id,
c.group_id,
c.group_name,
c.workshop_id,
c.workshop_name,
CASE
WHEN c.gateway = 'false'::text THEN c.factory_id
ELSE d.id
END AS factory_id,
CASE
WHEN c.gateway = 'false'::text THEN c.factory_name
ELSE d.title
END AS factory_name,
c.gateway,
c.created_time,
c.created_time_format
FROM ( SELECT a.id,
a.name,
a.tenant_id,
b.id AS group_id,
b.name AS group_name,
c_1.id AS workshop_id,
c_1.name AS workshop_name,
d_1.id AS factory_id,
d_1.title AS factory_name,
CASE
WHEN (a.additional_info::jsonb ->> 'gateway'::text) IS NOT NULL THEN a.additional_info::jsonb ->> 'gateway'::text
ELSE 'false'::text
END AS gateway,
a.created_time,
to_char(to_timestamp((a.created_time / 1000)::double precision), 'YYYY-MM-DD HH24:MI:SS'::text) AS created_time_format
FROM device a
LEFT JOIN relation ab ON ab.to_id = a.id AND ab.to_type::text = 'DEVICE'::text AND ab.from_type::text = 'ASSET'::text AND ab.relation_type_group::text = 'COMMON'::text AND ab.relation_type::text = 'Contains'::text
LEFT JOIN ( SELECT b_1.id,
b_1.created_time,
b_1.additional_info,
b_1.customer_id,
b_1.name,
b_1.label,
b_1.search_text,
b_1.tenant_id,
b_1.type,
b_1.external_id,
b_1.asset_profile_id
FROM asset b_1
WHERE b_1.type::text = 'group'::text) b ON b.id = ab.from_id
LEFT JOIN relation bc ON bc.to_id = b.id AND bc.to_type::text = 'ASSET'::text AND bc.from_type::text = 'ASSET'::text AND bc.relation_type_group::text = 'COMMON'::text AND bc.relation_type::text = 'Contains'::text
LEFT JOIN ( SELECT b_1.id,
b_1.created_time,
b_1.additional_info,
b_1.customer_id,
b_1.name,
b_1.label,
b_1.search_text,
b_1.tenant_id,
b_1.type,
b_1.external_id,
b_1.asset_profile_id
FROM asset b_1
WHERE b_1.type::text = 'workshop'::text) c_1 ON c_1.id = bc.from_id
LEFT JOIN relation cd_1 ON cd_1.to_id = c_1.id AND cd_1.to_type::text = 'ASSET'::text AND cd_1.from_type::text = 'CUSTOMER'::text AND cd_1.relation_type_group::text = 'COMMON'::text AND cd_1.relation_type::text = 'Contains'::text
LEFT JOIN customer d_1 ON d_1.id = cd_1.from_id) c
LEFT JOIN relation cd ON cd.to_id = c.id AND c.gateway = 'true'::text AND cd.to_type::text = 'DEVICE'::text AND cd.from_type::text = 'CUSTOMER'::text AND cd.relation_type_group::text = 'COMMON'::text AND cd.relation_type::text = 'Contains'::text
LEFT JOIN customer d ON d.id = cd.from_id;
ALTER TABLE "public"."v_device" OWNER TO "postgres";
CREATE VIEW "public"."v_device_from_gateway" AS SELECT a.id,
a.name,
a.tenant_id,
a.factory_id,
a.factory_name,
a.workshop_id,
a.workshop_name,
a.group_id,
a.group_name,
a.created_time,
a.created_time_format,
a.gid::uuid AS gid,
b.name AS gname,
c.factory_id AS g_factory_id,
c.factory_name AS g_factory_name
FROM ( SELECT a_1.id,
a_1.name,
a_1.tenant_id,
a_1.factory_id,
a_1.factory_name,
a_1.workshop_id,
a_1.workshop_name,
a_1.group_id,
a_1.group_name,
a_1.gateway,
a_1.created_time,
a_1.created_time_format,
CASE
WHEN (b_1.additional_info::jsonb ->> 'lastConnectedGateway'::text) IS NOT NULL THEN b_1.additional_info::jsonb ->> 'lastConnectedGateway'::text
ELSE NULL::text
END AS gid
FROM v_device a_1,
device b_1
WHERE a_1.id = b_1.id AND a_1.gateway <> 'true'::text) a
LEFT JOIN device b ON a.gid = b.id::text
LEFT JOIN v_device c ON b.id = c.id AND c.gateway = 'true'::text;
ALTER TABLE "public"."v_device_from_gateway" OWNER TO "postgres";
CREATE UNIQUE INDEX "tcode_model_index" ON "public"."tcode_model" USING btree (
"id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE UNIQUE INDEX "tcode_unit_index" ON "public"."tcode_unit" USING btree (
"id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"descript" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('ad4cd5a0-37dc-11ed-b2f0-013aa5277d02', 'XTCD1663565645807', '仪表看板', 0, 1, NULL, NULL, 'dashboard', NULL, 'Global', 1663565645833, '85088750-1ea1-11ed-a8be-71239561244e', '1663565645833', NULL, 'PC', NULL, 'f', 'dashboard.dashboard-view');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('cfb48340-37dc-11ed-b2f0-013aa5277d02', 'XTCD1663565703539', '大屏看板', 1, 2, NULL, 'ad4cd5a0-37dc-11ed-b2f0-013aa5277d02', 'mdi:large-screen-dashboard', NULL, 'Global', 1663569960126, '85088750-1ea1-11ed-a8be-71239561244e', '1663569960126', '85088750-1ea1-11ed-a8be-71239561244e', 'PC', '/largeScreenDashboard', 'f', 'dashboard.largescreen-dashboard');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('bdba8e90-37e2-11ed-b2f0-013aa5277d02', 'XTCD1663568250360', 'PC仪表看板', 1, 3, NULL, 'ad4cd5a0-37dc-11ed-b2f0-013aa5277d02', 'mdi:monitor-dashboard', NULL, 'Global', 1663569968676, '85088750-1ea1-11ed-a8be-71239561244e', '1663569968676', '85088750-1ea1-11ed-a8be-71239561244e', 'PC', '/dashboardView', 'f', 'dashboard.dashboard-view-pc');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('18036750-37e8-11ed-9cee-ab412dc6d429', 'XTCD1663570549299', '工厂管理', 1, 5, NULL, 'f6ad4630-37e6-11ed-9cee-ab412dc6d429', 'mdi:factory', NULL, 'Global', 1663570574334, '85088750-1ea1-11ed-a8be-71239561244e', '1663570574334', '85088750-1ea1-11ed-a8be-71239561244e', 'PC', '/factories', 'f', 'factory.factory-mng');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('4c5da7e0-37e8-11ed-9cee-ab412dc6d429', 'XTCD1663570637148', '设备列表', 1, 6, NULL, 'f6ad4630-37e6-11ed-9cee-ab412dc6d429', 'mdi:devices', NULL, 'Global', 1663570646671, '85088750-1ea1-11ed-a8be-71239561244e', '1663570646671', '85088750-1ea1-11ed-a8be-71239561244e', 'PC', '/deviceList', 'f', 'device.device-list');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('782a4590-37e8-11ed-aa50-33c3c4d399b5', 'XTCD1663570710633', '网关列表', 1, 7, NULL, 'f6ad4630-37e6-11ed-9cee-ab412dc6d429', 'router', NULL, 'Global', 1663570710695, '85088750-1ea1-11ed-a8be-71239561244e', '1663570710695', NULL, 'PC', '/gateway', 'f', 'gateway.gateway-devices');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('f6ad4630-37e6-11ed-9cee-ab412dc6d429', 'XTCD1663570063876', '设备管理', 0, 4, NULL, NULL, 'devices', NULL, 'Global', 1663570725071, '85088750-1ea1-11ed-a8be-71239561244e', '1663570725071', '85088750-1ea1-11ed-a8be-71239561244e', 'PC', NULL, 'f', 'device.management');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('b1a8e650-37e8-11ed-aa50-33c3c4d399b5', 'XTCD1663570807093', '权限管理', 0, 8, NULL, NULL, 'verified_user', NULL, 'Global', 1663570819083, '85088750-1ea1-11ed-a8be-71239561244e', '1663570819083', '85088750-1ea1-11ed-a8be-71239561244e', 'PC', NULL, 'f', 'auth-mng.auth-mng');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('13243100-37e9-11ed-aa50-33c3c4d399b5', 'XTCD1663570970640', '小程序申请', 1, 9, NULL, 'b1a8e650-37e8-11ed-aa50-33c3c4d399b5', 'mdi:applet', NULL, 'Global', 1663570970641, '85088750-1ea1-11ed-a8be-71239561244e', '1663570970641', NULL, 'PC', '/authManagement/appletManagement', 'f', 'auth-mng.applet-mng');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('296c1450-37e9-11ed-aa50-33c3c4d399b5', 'XTCD1663571008021', '用户管理', 1, 10, NULL, 'b1a8e650-37e8-11ed-aa50-33c3c4d399b5', 'people', NULL, 'Global', 1663571008022, '85088750-1ea1-11ed-a8be-71239561244e', '1663571008022', NULL, 'PC', '/authManagement/userManagement', 'f', 'auth-mng.user-mng');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('546905f0-37e9-11ed-aa50-33c3c4d399b5', 'XTCD1663571080143', '角色管理', 1, 11, NULL, 'b1a8e650-37e8-11ed-aa50-33c3c4d399b5', 'mdi:shield-account', NULL, 'Global', 1663571080144, '85088750-1ea1-11ed-a8be-71239561244e', '1663571080144', NULL, 'PC', '/authManagement/roleManagemnet', 'f', 'auth-mng.role-mng');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('8b394f90-37e9-11ed-aa50-33c3c4d399b5', 'XTCD1663571172105', '平台管理', 0, 12, NULL, NULL, 'mdi:platform-mng', NULL, 'Global', 1663571172106, '85088750-1ea1-11ed-a8be-71239561244e', '1663571172106', NULL, 'PC', NULL, 'f', 'platform.platform-mng');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('0cbcb0e0-f2d2-11ed-8683-bfc262abdbec', 'XTCD1684121948907', '大屏管理', 1, 47, NULL, '8b394f90-37e9-11ed-aa50-33c3c4d399b5', 'mdi:monitor-dashboard', NULL, 'Global', 1684121949056, 'abd5b000-38ce-11ed-be80-751173af0b60', '1684121949056', NULL, 'PC', '/platformManagement/dashboardManagement', 'f', 'platform-mng.dashboard-mng');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('01c89170-37ea-11ed-aa50-33c3c4d399b5', 'XTCD1663571371015', '规则链库', 1, 14, NULL, '8b394f90-37e9-11ed-aa50-33c3c4d399b5', 'settings_ethernet', NULL, 'Global', 1663571371016, '85088750-1ea1-11ed-a8be-71239561244e', '1663571371016', NULL, 'PC', '/ruleChains', 'f', 'rulechain.rulechains');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('ff09f130-37ea-11ed-aa50-33c3c4d399b5', 'XTCD1663571795907', '实体视图', 1, 15, NULL, '8b394f90-37e9-11ed-aa50-33c3c4d399b5', 'view_quilt', NULL, 'Global', 1663571795907, '85088750-1ea1-11ed-a8be-71239561244e', '1663571795907', NULL, 'PC', '/entityViews', 'f', 'entity-view.entity-views');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('12f8c950-37eb-11ed-aa50-33c3c4d399b5', 'XTCD1663571829349', '部件库', 1, 16, NULL, '8b394f90-37e9-11ed-aa50-33c3c4d399b5', 'now_widgets', NULL, 'Global', 1663571829350, '85088750-1ea1-11ed-a8be-71239561244e', '1663571829350', NULL, 'PC', '/widgets-bundles', 'f', 'widget.widget-library');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('bbab6e90-37eb-11ed-aa50-33c3c4d399b5', 'XTCD1663572112377', '仪表板库', 1, 17, NULL, '8b394f90-37e9-11ed-aa50-33c3c4d399b5', 'dashboards', NULL, 'Global', 1663572112378, '85088750-1ea1-11ed-a8be-71239561244e', '1663572112378', NULL, 'PC', '/dashboards', 'f', 'dashboard.dashboards');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('372e63b0-37ec-11ed-aa50-33c3c4d399b5', 'XTCD1663572319595', '日志', 1, 18, NULL, '8b394f90-37e9-11ed-aa50-33c3c4d399b5', 'track_changes', NULL, 'Global', 1663572319595, '85088750-1ea1-11ed-a8be-71239561244e', '1663572319595', NULL, 'PC', '/auditLogs', 'f', 'audit-log.audit-logs');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('842cc710-37ec-11ed-aa50-33c3c4d399b5', 'XTCD1663572448768', 'Api使用统计', 1, 19, NULL, '8b394f90-37e9-11ed-aa50-33c3c4d399b5', 'insert_chart', NULL, 'Global', 1663572460669, '85088750-1ea1-11ed-a8be-71239561244e', '1663572460669', '85088750-1ea1-11ed-a8be-71239561244e', 'PC', '/usage', 'f', 'api-usage.api-usage');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('ebe275d0-37ec-11ed-aa50-33c3c4d399b5', 'XTCD1663572622765', '系统设置', 0, 20, NULL, NULL, 'settings', NULL, 'Global', 1663572622766, '85088750-1ea1-11ed-a8be-71239561244e', '1663572622766', NULL, 'PC', NULL, 'f', 'admin.system-settings');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('66bafa20-37ed-11ed-aa50-33c3c4d399b5', 'XTCD1663572828866', '首页设置', 1, 21, NULL, 'ebe275d0-37ec-11ed-aa50-33c3c4d399b5', 'settings_applications', NULL, 'Global', 1663572828866, '85088750-1ea1-11ed-a8be-71239561244e', '1663572828866', NULL, 'PC', '/settings/home', 'f', 'admin.home-settings');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('1fd0dfc0-37ee-11ed-aa50-33c3c4d399b5', 'XTCD1663573139388', '资源库', 1, 22, NULL, 'ebe275d0-37ec-11ed-aa50-33c3c4d399b5', 'folder', NULL, 'Global', 1663573139389, '85088750-1ea1-11ed-a8be-71239561244e', '1663573139389', NULL, 'PC', '/settings/resources-library', 'f', 'resource.resources-library');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('918f86c0-37ee-11ed-aa50-33c3c4d399b5', 'XTCD1663573330220', '对外接口', 0, 23, NULL, NULL, 'mdi:open-api', NULL, 'Global', 1663573330221, '85088750-1ea1-11ed-a8be-71239561244e', '1663573330221', NULL, 'PC', NULL, 'f', 'open-api.open-api');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('fdabc3f0-37ee-11ed-aa50-33c3c4d399b5', 'XTCD1663573511599', '外部应用管理', 1, 24, NULL, '918f86c0-37ee-11ed-aa50-33c3c4d399b5', 'mdi:app-mng', NULL, 'Global', 1663573511600, '85088750-1ea1-11ed-a8be-71239561244e', '1663573511600', NULL, 'PC', '/openApi/externalApplicationManagement', 'f', 'open-api.external-apps-mng');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('1b13fe80-37ef-11ed-aa50-33c3c4d399b5', 'XTCD1663573560936', '推送配置', 1, 25, NULL, '918f86c0-37ee-11ed-aa50-33c3c4d399b5', 'mdi:push', NULL, 'Global', 1663573560937, '85088750-1ea1-11ed-a8be-71239561244e', '1663573560937', NULL, 'PC', '/openApi/pushProfile', 'f', 'open-api.push-profile');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('1ca72bc0-7091-11ed-8bf2-4f22d574b734', 'XTCD1669800407163', '设备开停机报表', 1, 41, 'https://lowcode-engine.textile-saas.huansi.net/view.html?scenarioName=index&pageKey=junlin_day_sta_detail', '5faac9b0-3fa7-11ed-bef7-83ea816b6ac8', NULL, NULL, 'Global', 1669800407222, 'abd5b000-38ce-11ed-be80-751173af0b60', '1669800407222', NULL, 'PC', '/iframe/repSta', 'f', '设备开停机报表');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('3a59bc60-b456-11ed-84b0-43c6c676219c', 'XTCD1677251795750', '区间能耗报表', 1, 42, 'https://lowcode-engine.textile-saas.huansi.net/view.html?scenarioName=index&pageKey=pub_column_report', '5faac9b0-3fa7-11ed-bef7-83ea816b6ac8', NULL, NULL, 'Global', 1677251795770, 'abd5b000-38ce-11ed-be80-751173af0b60', '1677251795770', NULL, 'PC', '/iframe/columnReport', 'f', '区间能耗报表');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('6c4ef570-3e16-11ed-8c31-db1f098c911c', 'XTCD1664250154566', '电能看板', 0, 27, NULL, NULL, NULL, NULL, 'Global', 1664250154578, '85088750-1ea1-11ed-a8be-71239561244e', '1664250154578', NULL, 'APP', NULL, 'f', NULL);
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('79945400-3e16-11ed-8c31-db1f098c911c', 'XTCD1664250176832', '能耗看板', 0, 27, NULL, NULL, NULL, NULL, 'Global', 1664250176833, '85088750-1ea1-11ed-a8be-71239561244e', '1664250176833', NULL, 'APP', NULL, 'f', NULL);
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('8173dc90-3e16-11ed-8c31-db1f098c911c', 'XTCD1664250190041', '遥测点', 0, 27, NULL, NULL, NULL, NULL, 'Global', 1664250190042, '85088750-1ea1-11ed-a8be-71239561244e', '1664250190042', NULL, 'APP', NULL, 'f', NULL);
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('872e3b30-3e16-11ed-8c31-db1f098c911c', 'XTCD1664250199651', '抄表看板', 0, 27, NULL, NULL, NULL, NULL, 'Global', 1664250199653, '85088750-1ea1-11ed-a8be-71239561244e', '1664250199653', NULL, 'APP', NULL, 'f', NULL);
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('8d86ae90-3e16-11ed-8c31-db1f098c911c', 'XTCD1664250210297', '设备开停机', 0, 27, NULL, NULL, NULL, NULL, 'Global', 1664250210298, '85088750-1ea1-11ed-a8be-71239561244e', '1664250210298', NULL, 'APP', NULL, 'f', NULL);
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('b8b97ef0-3a81-11ed-a00f-a93ec7a146a6', 'XTCD1663856434271', '设备', 1, 26, NULL, 'f6ad4630-37e6-11ed-9cee-ab412dc6d429', 'mdi:devices', NULL, 'Global', 1664422385939, 'abd5b000-38ce-11ed-be80-751173af0b60', '1664422385939', 'abd5b000-38ce-11ed-be80-751173af0b60', 'PC', '/devices', 'f', 'device.devices');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('fb26e390-4a12-11ed-bc92-4daafd9d668b', 'XTCD1665568090185', '信息维护', 0, 30, NULL, NULL, 'mdi:maintenance', NULL, 'Global', 1665568090195, 'abd5b000-38ce-11ed-be80-751173af0b60', '1665568090195', NULL, 'PC', NULL, 'f', 'system-mng.system-mng');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('1891dd40-4a13-11ed-bc92-4daafd9d668b', 'XTCD1665568139540', '参数配置', 1, 31, NULL, 'fb26e390-4a12-11ed-bc92-4daafd9d668b', 'mdi:property-conf', NULL, 'Global', 1665568139541, 'abd5b000-38ce-11ed-be80-751173af0b60', '1665568139541', NULL, 'PC', '/systemManagement/properties', 'f', 'system-mng.property-configuration');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('2ff62d10-4a13-11ed-bc92-4daafd9d668b', 'XTCD1665568178785', '物模型', 1, 32, NULL, 'fb26e390-4a12-11ed-bc92-4daafd9d668b', 'mdi:digital-model', NULL, 'Global', 1665568178786, 'abd5b000-38ce-11ed-be80-751173af0b60', '1665568178786', NULL, 'PC', '/systemManagement/models', 'f', 'system-mng.digital-model');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('475dd840-4a13-11ed-bc92-4daafd9d668b', 'XTCD1665568218052', '电能看板', 1, 33, NULL, 'cfb48340-37dc-11ed-b2f0-013aa5277d02', 'mdi:large-screen-dashboard', NULL, 'Global', 1665568218053, 'abd5b000-38ce-11ed-be80-751173af0b60', '1665568218053', NULL, 'PC', NULL, 't', 'dashboard.electric-dashboard');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('5cb456b0-4a13-11ed-bc92-4daafd9d668b', 'XTCD1665568253851', '能耗看板', 1, 34, NULL, 'cfb48340-37dc-11ed-b2f0-013aa5277d02', 'mdi:large-screen-dashboard', NULL, 'Global', 1665568253852, 'abd5b000-38ce-11ed-be80-751173af0b60', '1665568253852', NULL, 'PC', NULL, 't', 'dashboard.energy-dashboard');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('77313120-4a13-11ed-bc92-4daafd9d668b', 'XTCD1665568298290', '设备开停机看板', 1, 35, NULL, 'cfb48340-37dc-11ed-b2f0-013aa5277d02', 'mdi:large-screen-dashboard', NULL, 'Global', 1665568298290, 'abd5b000-38ce-11ed-be80-751173af0b60', '1665568298290', NULL, 'PC', NULL, 't', 'dashboard.open-shutdown-dashboard');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('9fe4ddb0-c001-11ed-a07d-c3cbf506f4d9', 'XTCD1678534872835', '电子抄表', 1, 43, 'https://lowcode-engine.textile-saas.huansi.net/view.html?scenarioName=index&pageKey=pub_last_report', '5faac9b0-3fa7-11ed-bef7-83ea816b6ac8', NULL, NULL, 'Global', 1678534872853, 'abd5b000-38ce-11ed-be80-751173af0b60', '1678534872853', NULL, 'PC', '/iframe/lastReport', 'f', '电子抄表');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('531bd690-1642-11ee-b727-edc9b1890b14', 'XTCD1688018461303', 'OTA升级', 1, 48, NULL, '8b394f90-37e9-11ed-aa50-33c3c4d399b5', 'memory', NULL, 'Global', 1688018552390, 'abd5b000-38ce-11ed-be80-751173af0b60', '1688018552390', 'abd5b000-38ce-11ed-be80-751173af0b60', 'PC', '/otaUpdates', 'f', 'ota-update.ota-updates');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('5faac9b0-3fa7-11ed-bef7-83ea816b6ac8', 'XTCD1664422361547', '设备报表-低代码', 0, 27, NULL, NULL, 'mdi:table', NULL, 'Global', 1666144392728, 'abd5b000-38ce-11ed-be80-751173af0b60', '1666144392728', 'abd5b000-38ce-11ed-be80-751173af0b60', 'PC', NULL, 'f', '设备报表');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('8b33ceb0-3fa7-11ed-bef7-83ea816b6ac8', 'XTCD1664422434587', '班组能耗', 1, 28, 'https://lowcode-engine.textile-saas.huansi.net/view.html?scenarioName=index&pageKey=junlin_group_detail', '5faac9b0-3fa7-11ed-bef7-83ea816b6ac8', '', NULL, 'Global', 1666158658234, 'abd5b000-38ce-11ed-be80-751173af0b60', '1666158658234', 'abd5b000-38ce-11ed-be80-751173af0b60', 'PC', '/iframe/groupEnergy', 'f', '班组能耗');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('66ab57e0-4842-11ed-af8a-cbe90563c5e2', 'XTCD1665368554590', '会计月度能耗', 1, 29, 'https://lowcode-engine.textile-saas.huansi.net/view.html?scenarioName=index&pageKey=junlin_month_detail', '5faac9b0-3fa7-11ed-bef7-83ea816b6ac8', NULL, NULL, 'Global', 1666158681840, 'abd5b000-38ce-11ed-be80-751173af0b60', '1666158681840', 'abd5b000-38ce-11ed-be80-751173af0b60', 'PC', '/iframe/repMonth', 'f', '会计月度能耗');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('e334a4f0-6166-11ed-8164-8f17526c0b6f', 'XTCD1668133004479', 'API管理', 1, 40, 'http://iot.dbapi.v3.textile-saas.huansi.net/#/api', '8b394f90-37e9-11ed-aa50-33c3c4d399b5', 'mdi:api', NULL, 'Global', 1668133004501, 'abd5b000-38ce-11ed-be80-751173af0b60', '1668133004501', NULL, 'PC', '/iframe/apiManagement', 'f', 'db-api.db-api');
INSERT INTO "public"."tb_menu" ("id", "code", "name", "level", "sort", "url", "parent_id", "menu_icon", "menu_images", "region", "created_time", "created_user", "updated_time", "updated_user", "menu_type", "path", "is_button", "lang_key") VALUES ('e5562890-37e9-11ed-aa50-33c3c4d399b5', 'XTCD1663571323289', '设备配置', 1, 13, NULL, '8b394f90-37e9-11ed-aa50-33c3c4d399b5', 'mdi:alpha-d-box', NULL, 'Global', 1683277031369, '85088750-1ea1-11ed-a8be-71239561244e', '1683277031369', 'abd5b000-38ce-11ed-be80-751173af0b60', 'PC', '/profiles/deviceProfiles', 'f', 'device-profile.device-profiles');
\ No newline at end of file
CREATE TABLE "public"."hs_device_order_statistical" (
"id" uuid NOT NULL,
"device_id" uuid NOT NULL,
"order_no" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"statistic_val" numeric(10,4),
"current_val" varchar(255) COLLATE "pg_catalog"."default",
"first_val" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"order_status" varchar(255) COLLATE "pg_catalog"."default" DEFAULT 'underway'::character varying,
"device_name" varchar(255) COLLATE "pg_catalog"."default",
"order_array" varchar(1000) COLLATE "pg_catalog"."default",
"tenant_id" uuid,
"start_time" timestamp(6),
"end_time" timestamp(6),
"created_time" int8,
"updated_time" int8 NOT NULL,
CONSTRAINT "hs_device_order_statistical_pkey" PRIMARY KEY ("id"),
CONSTRAINT "hs_device_order_statistical_device_id_order_no_code_key" UNIQUE ("device_id", "order_no", "code")
)
;
ALTER TABLE "public"."hs_device_order_statistical"
OWNER TO "postgres";
COMMENT ON COLUMN "public"."hs_device_order_statistical"."device_id" IS '设备标识';
COMMENT ON COLUMN "public"."hs_device_order_statistical"."order_no" IS '订单号';
COMMENT ON COLUMN "public"."hs_device_order_statistical"."code" IS 'water-水;electric-电;vapor-蒸汽;output-产量';
COMMENT ON COLUMN "public"."hs_device_order_statistical"."statistic_val" IS '统计值';
COMMENT ON COLUMN "public"."hs_device_order_statistical"."current_val" IS '采集值';
COMMENT ON COLUMN "public"."hs_device_order_statistical"."first_val" IS '订单开始时首次采集值';
COMMENT ON COLUMN "public"."hs_device_order_statistical"."order_status" IS '订单状态(underway-进行中;close-结束)';
COMMENT ON COLUMN "public"."hs_device_order_statistical"."device_name" IS '设备名称';
COMMENT ON COLUMN "public"."hs_device_order_statistical"."order_array" IS '订单明细';
COMMENT ON COLUMN "public"."hs_device_order_statistical"."tenant_id" IS '租户标识';
COMMENT ON COLUMN "public"."hs_device_order_statistical"."start_time" IS '开始时间';
COMMENT ON COLUMN "public"."hs_device_order_statistical"."end_time" IS '结束时间';
COMMENT ON COLUMN "public"."hs_device_order_statistical"."created_time" IS '创建时间戳';
COMMENT ON COLUMN "public"."hs_device_order_statistical"."updated_time" IS '修改时间戳';
COMMENT ON TABLE "public"."hs_device_order_statistical" IS '统计设备订单的能耗产量(kafka)';
CREATE TABLE "public"."hs_order_statistical" (
"id" uuid NOT NULL,
"order_no" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"order_status" varchar(255) COLLATE "pg_catalog"."default" DEFAULT 'underway'::character varying,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"statistic_val" numeric(10,4) NOT NULL DEFAULT 0,
"start_time" timestamp(6),
"end_time" timestamp(6),
"created_time" int8,
"updated_time" int8 NOT NULL,
"tenant_id" uuid NOT NULL,
"order_array" varchar(1000) COLLATE "pg_catalog"."default",
CONSTRAINT "hs_order_statistical_pkey" PRIMARY KEY ("id"),
CONSTRAINT "hs_order_statistical_order_no_code_key" UNIQUE ("order_no", "code")
)
;
ALTER TABLE "public"."hs_order_statistical"
OWNER TO "postgres";
COMMENT ON COLUMN "public"."hs_order_statistical"."order_status" IS '订单状态(underway-进行中;close-结束)';
COMMENT ON COLUMN "public"."hs_order_statistical"."code" IS 'water-水;electric-电;vapor-蒸汽;output-产量';
COMMENT ON COLUMN "public"."hs_order_statistical"."statistic_val" IS '统计值';
COMMENT ON COLUMN "public"."hs_order_statistical"."tenant_id" IS '租户标识';
COMMENT ON COLUMN "public"."hs_order_statistical"."order_array" IS '订单明细';
COMMENT ON TABLE "public"."hs_order_statistical" IS '统计订单的能耗产量(kafka)';
ALTER TABLE hs_customer_extension ADD COLUMN "sort" int4 DEFAULT 1000;
ALTER TABLE tcode_group ADD COLUMN "id" uuid NOT NULL;
ALTER TABLE tcode_group ADD CONSTRAINT "tcode_group_pkey" PRIMARY KEY ("id");
-- ----------------------------
-- Table structure for hs_db_conf
-- ----------------------------
DROP TABLE IF EXISTS "public"."hs_db_conf";
CREATE TABLE "public"."hs_db_conf" (
"id" uuid NOT NULL,
"created_time" int8,
"tenant_id" uuid NOT NULL,
"host" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"port" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"user" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"password" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"database" varchar(255) COLLATE "pg_catalog"."default" NOT NULL
)
;
ALTER TABLE "public"."hs_db_conf" OWNER TO "postgres";
COMMENT ON COLUMN "public"."hs_db_conf"."id" IS '设备标识';
COMMENT ON COLUMN "public"."hs_db_conf"."created_time" IS '创建时间';
COMMENT ON COLUMN "public"."hs_db_conf"."tenant_id" IS '租户';
COMMENT ON COLUMN "public"."hs_db_conf"."host" IS '地址';
COMMENT ON COLUMN "public"."hs_db_conf"."port" IS '端口';
COMMENT ON COLUMN "public"."hs_db_conf"."user" IS '用户';
COMMENT ON COLUMN "public"."hs_db_conf"."password" IS '密码';
COMMENT ON COLUMN "public"."hs_db_conf"."database" IS '数据库';
COMMENT ON TABLE "public"."hs_db_conf" IS '租户同步数据到对应数据库配置表';
-- ----------------------------
-- Primary Key structure for table hs_db_conf
-- ----------------------------
ALTER TABLE "public"."hs_db_conf" ADD CONSTRAINT "hs_device_syn_conf_copy1_pkey" PRIMARY KEY ("id");
-- ----------------------------
-- Table structure for hs_board_manage
-- ----------------------------
DROP TABLE IF EXISTS "public"."hs_board_manage";
CREATE TABLE "public"."hs_board_manage" (
"id" uuid NOT NULL,
"name" varchar(255) COLLATE "pg_catalog"."default",
"url" varchar(255) COLLATE "pg_catalog"."default",
"images" varchar(10000000) COLLATE "pg_catalog"."default",
"created_time" int8,
"created_user" uuid,
"tenant_id" uuid,
"updated_time" int8,
"updated_user" uuid,
"sort" int4 DEFAULT 0
)
;
ALTER TABLE "public"."hs_board_manage" OWNER TO "postgres";
COMMENT ON COLUMN "public"."hs_board_manage"."name" IS '看板名称';
COMMENT ON COLUMN "public"."hs_board_manage"."url" IS '看板地址';
COMMENT ON COLUMN "public"."hs_board_manage"."images" IS '看板缩略图';
COMMENT ON COLUMN "public"."hs_board_manage"."sort" IS '排序值';
COMMENT ON TABLE "public"."hs_board_manage" IS '看板配置管理';
-- ----------------------------
-- Table structure for hs_board_manage_role
-- ----------------------------
DROP TABLE IF EXISTS "public"."hs_board_manage_role";
CREATE TABLE "public"."hs_board_manage_role" (
"id" uuid NOT NULL,
"board_id" uuid,
"role_id" uuid,
"images" varchar(10000000) COLLATE "pg_catalog"."default",
"created_time" int8,
"created_user" uuid,
"tenant_id" uuid,
"updated_time" int8,
"updated_user" uuid
)
;
ALTER TABLE "public"."hs_board_manage_role" OWNER TO "postgres";
COMMENT ON COLUMN "public"."hs_board_manage_role"."id" IS '主键';
COMMENT ON COLUMN "public"."hs_board_manage_role"."board_id" IS '看板标识';
COMMENT ON COLUMN "public"."hs_board_manage_role"."role_id" IS '角色标识';
COMMENT ON COLUMN "public"."hs_board_manage_role"."images" IS '看板缩略图';
COMMENT ON TABLE "public"."hs_board_manage_role" IS '看板角色关系';
-- ----------------------------
-- Primary Key structure for table hs_board_manage
-- ----------------------------
ALTER TABLE "public"."hs_board_manage" ADD CONSTRAINT "hs_board_manage_pkey" PRIMARY KEY ("id");
-- ----------------------------
-- Primary Key structure for table hs_board_manage_role
-- ----------------------------
ALTER TABLE "public"."hs_board_manage_role" ADD CONSTRAINT "hs_board_manage_copy1_pkey" PRIMARY KEY ("id");
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
Navicat Premium Data Transfer
Source Server : 47.99.83.75(v3生产)
Source Server Type : PostgreSQL
Source Server Version : 120009
Source Host : 47.99.83.75:30433
Source Catalog : hsiotdb
Source Schema : public
Target Server Type : PostgreSQL
Target Server Version : 120009
File Encoding : 65001
Date: 28/11/2022 22:27:44
*/
-- ----------------------------
-- Table structure for tcode_base
-- ----------------------------
DROP TABLE IF EXISTS "public"."tcode_base";
CREATE TABLE "public"."tcode_base" (
"id" uuid NOT NULL,
"item" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"val" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"def" varchar(255) COLLATE "pg_catalog"."default",
"descript" varchar(255) COLLATE "pg_catalog"."default",
"sort" varchar(255) COLLATE "pg_catalog"."default",
"halt" varchar(255) COLLATE "pg_catalog"."default",
"created_user" uuid,
"updated_user" uuid,
"tenant_id" uuid NOT NULL,
"created_time" int8 DEFAULT 0,
"updated_time" int8 DEFAULT 0
)
;
ALTER TABLE "public"."tcode_base" OWNER TO "postgres";
COMMENT ON COLUMN "public"."tcode_base"."item" IS '项目';
COMMENT ON COLUMN "public"."tcode_base"."code" IS '代码';
COMMENT ON COLUMN "public"."tcode_base"."val" IS '参数值';
COMMENT ON COLUMN "public"."tcode_base"."def" IS '默认值';
COMMENT ON COLUMN "public"."tcode_base"."descript" IS '描述';
COMMENT ON COLUMN "public"."tcode_base"."halt" IS '是否停用(T-是;F-否)';
-- ----------------------------
-- Table structure for tcode_device
-- ----------------------------
DROP TABLE IF EXISTS "public"."tcode_device";
CREATE TABLE "public"."tcode_device" (
"id" uuid NOT NULL,
"gid" uuid,
"did" uuid NOT NULL,
"dname" varchar(255) COLLATE "pg_catalog"."default",
"knumb" int8,
"kcnt" int8,
"sort" varchar(255) COLLATE "pg_catalog"."default",
"halt" varchar(50) COLLATE "pg_catalog"."default",
"htime" timestamp(6),
"created_time" int8 DEFAULT 0,
"updated_time" int8 DEFAULT 0,
"created_user" uuid,
"updated_user" uuid,
"tenant_id" uuid NOT NULL,
"mcode" varchar(255) COLLATE "pg_catalog"."default" NOT NULL
)
;
ALTER TABLE "public"."tcode_device" OWNER TO "postgres";
COMMENT ON COLUMN "public"."tcode_device"."id" IS '主键';
COMMENT ON COLUMN "public"."tcode_device"."gid" IS '网关ID';
COMMENT ON COLUMN "public"."tcode_device"."did" IS '设备ID';
COMMENT ON COLUMN "public"."tcode_device"."dname" IS '设备名称';
COMMENT ON COLUMN "public"."tcode_device"."knumb" IS '设备属性数量';
COMMENT ON COLUMN "public"."tcode_device"."kcnt" IS '属性采集总量';
COMMENT ON COLUMN "public"."tcode_device"."sort" IS '排序';
COMMENT ON COLUMN "public"."tcode_device"."halt" IS '停用:默认F,T为停用';
COMMENT ON COLUMN "public"."tcode_device"."htime" IS '心跳时间';
COMMENT ON COLUMN "public"."tcode_device"."mcode" IS '物模型代码';
-- ----------------------------
-- Table structure for tcode_group
-- ----------------------------
DROP TABLE IF EXISTS "public"."tcode_group";
CREATE TABLE "public"."tcode_group" (
"tid" uuid NOT NULL,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"descript" varchar(255) COLLATE "pg_catalog"."default",
"arr" time(6),
"dep" time(6),
"tdays" int4 DEFAULT 0
)
;
ALTER TABLE "public"."tcode_group" OWNER TO "postgres";
COMMENT ON COLUMN "public"."tcode_group"."tid" IS '租户ID';
COMMENT ON COLUMN "public"."tcode_group"."code" IS '代码';
COMMENT ON COLUMN "public"."tcode_group"."descript" IS '班组描述';
COMMENT ON COLUMN "public"."tcode_group"."arr" IS '开始时间';
COMMENT ON COLUMN "public"."tcode_group"."dep" IS '结束时间';
COMMENT ON COLUMN "public"."tcode_group"."tdays" IS '是否跨日';
-- ----------------------------
-- Table structure for tcode_group_days
-- ----------------------------
DROP TABLE IF EXISTS "public"."tcode_group_days";
CREATE TABLE "public"."tcode_group_days" (
"tid" uuid NOT NULL,
"arr" time(6),
"dep" time(6),
"tdays" int4 DEFAULT 0
)
;
ALTER TABLE "public"."tcode_group_days" OWNER TO "postgres";
COMMENT ON COLUMN "public"."tcode_group_days"."tid" IS '租户ID';
COMMENT ON COLUMN "public"."tcode_group_days"."arr" IS '每日开始时间';
COMMENT ON COLUMN "public"."tcode_group_days"."dep" IS '每日结束时间';
COMMENT ON COLUMN "public"."tcode_group_days"."tdays" IS '是否跨日';
-- ----------------------------
-- Table structure for tcode_group_electric
-- ----------------------------
DROP TABLE IF EXISTS "public"."tcode_group_electric";
CREATE TABLE "public"."tcode_group_electric" (
"tid" uuid NOT NULL,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"arr" time(6),
"dep" time(6),
"tdays" int4
)
;
ALTER TABLE "public"."tcode_group_electric" OWNER TO "postgres";
COMMENT ON COLUMN "public"."tcode_group_electric"."tid" IS '租户ID';
COMMENT ON COLUMN "public"."tcode_group_electric"."code" IS '峰电peak,谷电valley';
COMMENT ON COLUMN "public"."tcode_group_electric"."arr" IS '开始时间';
COMMENT ON COLUMN "public"."tcode_group_electric"."dep" IS '结束时间';
COMMENT ON COLUMN "public"."tcode_group_electric"."tdays" IS '是否跨日,1为跨日';
-- ----------------------------
-- Table structure for tcode_model
-- ----------------------------
DROP TABLE IF EXISTS "public"."tcode_model";
CREATE TABLE "public"."tcode_model" (
"id" uuid NOT NULL,
"gid" uuid,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"name" varchar(255) COLLATE "pg_catalog"."default",
"created_user" uuid,
"updated_user" uuid,
"driver_version" varchar(255) COLLATE "pg_catalog"."default",
"tenant_id" uuid NOT NULL,
"updated_time" int8,
"created_time" int8
)
;
ALTER TABLE "public"."tcode_model" OWNER TO "postgres";
-- ----------------------------
-- Table structure for tcode_model_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."tcode_model_detail";
CREATE TABLE "public"."tcode_model_detail" (
"id" uuid NOT NULL,
"gid" uuid,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"base_id" uuid,
"unit_id" uuid,
"kup" varchar(255) COLLATE "pg_catalog"."default",
"kdwn" varchar(255) COLLATE "pg_catalog"."default",
"ksetup" varchar(255) COLLATE "pg_catalog"."default",
"sort" varchar(255) COLLATE "pg_catalog"."default" DEFAULT '1000'::character varying,
"halt" char(1) COLLATE "pg_catalog"."default" DEFAULT 'F'::bpchar,
"ex_s1" varchar(255) COLLATE "pg_catalog"."default",
"ex_s2" varchar(255) COLLATE "pg_catalog"."default",
"ex_s3" varchar(255) COLLATE "pg_catalog"."default",
"ex_s4" varchar(255) COLLATE "pg_catalog"."default",
"ex_s5" varchar(255) COLLATE "pg_catalog"."default",
"created_user" uuid,
"updated_user" uuid,
"standard" varchar(255) COLLATE "pg_catalog"."default",
"hour" bool,
"day" bool,
"change" bool,
"tenant_id" uuid NOT NULL,
"val" varchar(255) COLLATE "pg_catalog"."default",
"created_time" int8,
"updated_time" int8,
"kup_time" int8,
"ksetup_time" int8,
"kdwn_time" int8
)
;
ALTER TABLE "public"."tcode_model_detail" OWNER TO "postgres";
COMMENT ON COLUMN "public"."tcode_model_detail"."id" IS '属性ID';
COMMENT ON COLUMN "public"."tcode_model_detail"."gid" IS '网关ID';
COMMENT ON COLUMN "public"."tcode_model_detail"."code" IS '模型代码';
COMMENT ON COLUMN "public"."tcode_model_detail"."key" IS '属性key';
COMMENT ON COLUMN "public"."tcode_model_detail"."base_id" IS '分组ID(base)';
COMMENT ON COLUMN "public"."tcode_model_detail"."unit_id" IS '单位ID';
COMMENT ON COLUMN "public"."tcode_model_detail"."kup" IS '上限值';
COMMENT ON COLUMN "public"."tcode_model_detail"."kdwn" IS '下限值';
COMMENT ON COLUMN "public"."tcode_model_detail"."ksetup" IS '设定值';
COMMENT ON COLUMN "public"."tcode_model_detail"."sort" IS '排序';
COMMENT ON COLUMN "public"."tcode_model_detail"."halt" IS '是否停用';
COMMENT ON COLUMN "public"."tcode_model_detail"."ex_s1" IS '扩展字段1';
COMMENT ON COLUMN "public"."tcode_model_detail"."ex_s2" IS '扩展字段2';
COMMENT ON COLUMN "public"."tcode_model_detail"."ex_s3" IS '扩展字段3';
COMMENT ON COLUMN "public"."tcode_model_detail"."ex_s4" IS '扩展字段4';
COMMENT ON COLUMN "public"."tcode_model_detail"."ex_s5" IS '扩展字段5';
COMMENT ON COLUMN "public"."tcode_model_detail"."standard" IS '标准值';
COMMENT ON COLUMN "public"."tcode_model_detail"."hour" IS '每小时存储';
COMMENT ON COLUMN "public"."tcode_model_detail"."day" IS '每天存储';
COMMENT ON COLUMN "public"."tcode_model_detail"."change" IS '属性值变化存储';
COMMENT ON COLUMN "public"."tcode_model_detail"."val" IS '属性名';
COMMENT ON COLUMN "public"."tcode_model_detail"."kup_time" IS '上限值时间';
COMMENT ON COLUMN "public"."tcode_model_detail"."ksetup_time" IS '设定值更新时间';
COMMENT ON COLUMN "public"."tcode_model_detail"."kdwn_time" IS '下限值设定时间';
-- ----------------------------
-- Table structure for tcode_model_detail_ex
-- ----------------------------
DROP TABLE IF EXISTS "public"."tcode_model_detail_ex";
CREATE TABLE "public"."tcode_model_detail_ex" (
"tid" uuid NOT NULL,
"gid" uuid,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"grpcode" varchar(255) COLLATE "pg_catalog"."default",
"unit_id" varchar(255) COLLATE "pg_catalog"."default",
"kup" varchar(255) COLLATE "pg_catalog"."default",
"kup_time" timestamp(6),
"kdwn" varchar(255) COLLATE "pg_catalog"."default",
"kdwn_time" timestamp(6),
"ksetup" varchar(255) COLLATE "pg_catalog"."default",
"ksetup_time" timestamp(6),
"sort" varchar(255) COLLATE "pg_catalog"."default" DEFAULT '1000'::character varying,
"halt" char(1) COLLATE "pg_catalog"."default" DEFAULT 'F'::bpchar,
"ex_s1" varchar(255) COLLATE "pg_catalog"."default",
"ex_s2" varchar(255) COLLATE "pg_catalog"."default",
"ex_s3" varchar(255) COLLATE "pg_catalog"."default",
"ex_s4" varchar(255) COLLATE "pg_catalog"."default",
"ex_s5" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
"mtime" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
"name" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."tcode_model_detail_ex" OWNER TO "postgres";
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."tid" IS '租户ID';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."gid" IS '网关ID';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."code" IS '模型代码';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."key" IS '属性名称';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."grpcode" IS '分组ID';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."unit_id" IS '单位ID';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."kup" IS '上限值';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."kup_time" IS '上限值时间';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."kdwn" IS '下限值';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."kdwn_time" IS '下限值时间';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."ksetup" IS '设定值';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."ksetup_time" IS '设定值更新时间';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."sort" IS '排序';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."halt" IS '是否停用';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."ex_s1" IS '扩展字段1';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."ex_s2" IS '扩展字段2';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."ex_s3" IS '扩展字段3';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."ex_s4" IS '扩展字段4';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."ex_s5" IS '扩展字段5';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."ctime" IS '创建时间';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."mtime" IS '修改时间';
COMMENT ON COLUMN "public"."tcode_model_detail_ex"."name" IS '显示名称';
-- ----------------------------
-- Table structure for tcode_model_ex
-- ----------------------------
DROP TABLE IF EXISTS "public"."tcode_model_ex";
CREATE TABLE "public"."tcode_model_ex" (
"tid" uuid NOT NULL,
"gid" uuid,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"name" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
"mtime" timestamp(6) DEFAULT CURRENT_TIMESTAMP
)
;
ALTER TABLE "public"."tcode_model_ex" OWNER TO "postgres";
-- ----------------------------
-- Table structure for tcode_unit
-- ----------------------------
DROP TABLE IF EXISTS "public"."tcode_unit";
CREATE TABLE "public"."tcode_unit" (
"id" uuid NOT NULL,
"descript" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"created_user" uuid,
"updated_user" uuid,
"tenant_id" uuid NOT NULL,
"created_time" int8 DEFAULT 0,
"updated_time" int8 DEFAULT 0
)
;
ALTER TABLE "public"."tcode_unit" OWNER TO "postgres";
-- ----------------------------
-- Table structure for trep_day_sta_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."trep_day_sta_detail";
CREATE TABLE "public"."trep_day_sta_detail" (
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"bdate" date NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"val" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"cron" int8 DEFAULT 20,
"len" int8,
"time" int8,
"ctime" timestamp(6),
"mtime" timestamp(6),
"created_time" int8,
"updated_time" int8
)
;
ALTER TABLE "public"."trep_day_sta_detail" OWNER TO "postgres";
COMMENT ON COLUMN "public"."trep_day_sta_detail"."tid" IS '租户ID';
COMMENT ON COLUMN "public"."trep_day_sta_detail"."did" IS '设备ID';
COMMENT ON COLUMN "public"."trep_day_sta_detail"."bdate" IS '营业日期';
COMMENT ON COLUMN "public"."trep_day_sta_detail"."key" IS '属性名称';
COMMENT ON COLUMN "public"."trep_day_sta_detail"."val" IS '属性值';
COMMENT ON COLUMN "public"."trep_day_sta_detail"."cron" IS '更新频率';
COMMENT ON COLUMN "public"."trep_day_sta_detail"."len" IS '计数器';
COMMENT ON COLUMN "public"."trep_day_sta_detail"."time" IS '累计时间单位秒';
COMMENT ON COLUMN "public"."trep_day_sta_detail"."ctime" IS '创建时间';
COMMENT ON COLUMN "public"."trep_day_sta_detail"."mtime" IS '修改时间';
COMMENT ON COLUMN "public"."trep_day_sta_detail"."created_time" IS '创建时间long类型';
COMMENT ON COLUMN "public"."trep_day_sta_detail"."updated_time" IS '修改时间long类型';
-- ----------------------------
-- Table structure for trep_dkey_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."trep_dkey_detail";
CREATE TABLE "public"."trep_dkey_detail" (
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"bdate" date NOT NULL,
"val" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6),
"mtime" timestamp(6),
"val_arr" varchar(255) COLLATE "pg_catalog"."default",
"val_dep" varchar(255) COLLATE "pg_catalog"."default",
"peak" varchar(255) COLLATE "pg_catalog"."default",
"valley" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."trep_dkey_detail" OWNER TO "postgres";
COMMENT ON COLUMN "public"."trep_dkey_detail"."tid" IS '租户ID';
COMMENT ON COLUMN "public"."trep_dkey_detail"."did" IS '设备ID';
COMMENT ON COLUMN "public"."trep_dkey_detail"."key" IS '属性';
COMMENT ON COLUMN "public"."trep_dkey_detail"."bdate" IS '营业日期';
COMMENT ON COLUMN "public"."trep_dkey_detail"."val" IS '最新遥测值-废弃';
COMMENT ON COLUMN "public"."trep_dkey_detail"."ctime" IS '创建时间';
COMMENT ON COLUMN "public"."trep_dkey_detail"."mtime" IS '修改时间';
COMMENT ON COLUMN "public"."trep_dkey_detail"."val_arr" IS '遥测值开始';
COMMENT ON COLUMN "public"."trep_dkey_detail"."val_dep" IS '遥测值结束';
COMMENT ON COLUMN "public"."trep_dkey_detail"."peak" IS '峰电-电能属性有效';
COMMENT ON COLUMN "public"."trep_dkey_detail"."valley" IS '谷电-电能属性有效';
-- ----------------------------
-- Table structure for trep_group_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."trep_group_detail";
CREATE TABLE "public"."trep_group_detail" (
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"bdate" date NOT NULL,
"grpcode" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"val_arr" varchar(255) COLLATE "pg_catalog"."default",
"val_dep" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6) DEFAULT now(),
"mtime" timestamp(6) DEFAULT now()
)
;
ALTER TABLE "public"."trep_group_detail" OWNER TO "postgres";
COMMENT ON COLUMN "public"."trep_group_detail"."tid" IS '租户ID';
COMMENT ON COLUMN "public"."trep_group_detail"."did" IS '设备ID';
COMMENT ON COLUMN "public"."trep_group_detail"."key" IS '属性';
COMMENT ON COLUMN "public"."trep_group_detail"."bdate" IS '营业日期';
COMMENT ON COLUMN "public"."trep_group_detail"."grpcode" IS '班组code';
COMMENT ON COLUMN "public"."trep_group_detail"."val_arr" IS '遥测值开始';
COMMENT ON COLUMN "public"."trep_group_detail"."val_dep" IS '遥测值结束';
COMMENT ON COLUMN "public"."trep_group_detail"."ctime" IS '创建时间';
COMMENT ON COLUMN "public"."trep_group_detail"."mtime" IS '修改时间';
-- ----------------------------
-- Table structure for trep_group_sta_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."trep_group_sta_detail";
CREATE TABLE "public"."trep_group_sta_detail" (
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"bdate" date NOT NULL,
"grpcode" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"val" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"cron" int8 DEFAULT 20,
"len" int8 DEFAULT 1,
"time" int8 DEFAULT 20,
"ctime" timestamp(6),
"mtime" timestamp(6),
"created_time" int8,
"updated_time" int8
)
;
ALTER TABLE "public"."trep_group_sta_detail" OWNER TO "postgres";
COMMENT ON COLUMN "public"."trep_group_sta_detail"."tid" IS '租户ID';
COMMENT ON COLUMN "public"."trep_group_sta_detail"."did" IS '设备ID';
COMMENT ON COLUMN "public"."trep_group_sta_detail"."bdate" IS '营业日期';
COMMENT ON COLUMN "public"."trep_group_sta_detail"."grpcode" IS '班组代码';
COMMENT ON COLUMN "public"."trep_group_sta_detail"."key" IS '属性名称';
COMMENT ON COLUMN "public"."trep_group_sta_detail"."val" IS '属性值';
COMMENT ON COLUMN "public"."trep_group_sta_detail"."cron" IS '执行频率';
COMMENT ON COLUMN "public"."trep_group_sta_detail"."len" IS '计数器';
COMMENT ON COLUMN "public"."trep_group_sta_detail"."time" IS '累计时间单位秒';
COMMENT ON COLUMN "public"."trep_group_sta_detail"."ctime" IS '创建时间';
COMMENT ON COLUMN "public"."trep_group_sta_detail"."mtime" IS '修改时间';
COMMENT ON COLUMN "public"."trep_group_sta_detail"."created_time" IS '创建时间long类型';
COMMENT ON COLUMN "public"."trep_group_sta_detail"."updated_time" IS '修改时间long类型';
-- ----------------------------
-- Table structure for trep_hkey_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."trep_hkey_detail";
CREATE TABLE "public"."trep_hkey_detail" (
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"bdate" date NOT NULL,
"hours" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"val" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6),
"mtime" timestamp(6),
"val_arr" varchar(255) COLLATE "pg_catalog"."default",
"val_dep" varchar(255) COLLATE "pg_catalog"."default",
"peak" varchar(255) COLLATE "pg_catalog"."default",
"valley" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."trep_hkey_detail" OWNER TO "postgres";
COMMENT ON COLUMN "public"."trep_hkey_detail"."peak" IS '峰电';
COMMENT ON COLUMN "public"."trep_hkey_detail"."valley" IS '谷电';
-- ----------------------------
-- Table structure for trep_hours_sta_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."trep_hours_sta_detail";
CREATE TABLE "public"."trep_hours_sta_detail" (
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"bdate" date NOT NULL,
"hours" int4 NOT NULL,
"cron" int8 DEFAULT 20,
"len" int8 DEFAULT 1,
"ctime" timestamp(6),
"mtime" timestamp(6),
"val" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"time" int8,
"created_time" int8,
"updated_time" int8
)
;
ALTER TABLE "public"."trep_hours_sta_detail" OWNER TO "postgres";
COMMENT ON COLUMN "public"."trep_hours_sta_detail"."tid" IS '租户ID';
COMMENT ON COLUMN "public"."trep_hours_sta_detail"."did" IS '设备ID';
COMMENT ON COLUMN "public"."trep_hours_sta_detail"."key" IS '属性';
COMMENT ON COLUMN "public"."trep_hours_sta_detail"."bdate" IS '营业日期';
COMMENT ON COLUMN "public"."trep_hours_sta_detail"."hours" IS '小时';
COMMENT ON COLUMN "public"."trep_hours_sta_detail"."cron" IS '统计周期,耗时算法:20s执行周期cron*len为当前状态持续时长';
COMMENT ON COLUMN "public"."trep_hours_sta_detail"."len" IS '计数器默认1';
COMMENT ON COLUMN "public"."trep_hours_sta_detail"."ctime" IS '开始时间';
COMMENT ON COLUMN "public"."trep_hours_sta_detail"."mtime" IS '结束时间';
COMMENT ON COLUMN "public"."trep_hours_sta_detail"."val" IS '状态值';
COMMENT ON COLUMN "public"."trep_hours_sta_detail"."time" IS '时长s';
COMMENT ON COLUMN "public"."trep_hours_sta_detail"."created_time" IS '开始时间long类型';
COMMENT ON COLUMN "public"."trep_hours_sta_detail"."updated_time" IS '结束时间long类型';
-- ----------------------------
-- Table structure for trep_hsta_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."trep_hsta_detail";
CREATE TABLE "public"."trep_hsta_detail" (
"aid" int8,
"tid" uuid,
"did" uuid,
"key" varchar(255) COLLATE "pg_catalog"."default",
"val" varchar(255) COLLATE "pg_catalog"."default",
"arr" timestamp(6) DEFAULT now(),
"dep" timestamp(6) DEFAULT now()
)
;
ALTER TABLE "public"."trep_hsta_detail" OWNER TO "postgres";
COMMENT ON COLUMN "public"."trep_hsta_detail"."aid" IS '自增长id';
COMMENT ON COLUMN "public"."trep_hsta_detail"."tid" IS '租户id';
COMMENT ON COLUMN "public"."trep_hsta_detail"."did" IS '设备id';
COMMENT ON COLUMN "public"."trep_hsta_detail"."key" IS '属性';
COMMENT ON COLUMN "public"."trep_hsta_detail"."val" IS '属性值';
COMMENT ON COLUMN "public"."trep_hsta_detail"."arr" IS '开始时间';
COMMENT ON COLUMN "public"."trep_hsta_detail"."dep" IS '结束时间';
-- ----------------------------
-- Table structure for trep_sta_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."trep_sta_detail";
CREATE TABLE "public"."trep_sta_detail" (
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"val_arr" varchar(255) COLLATE "pg_catalog"."default",
"val_dep" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6) DEFAULT now(),
"mtime" timestamp(6) DEFAULT now()
)
;
ALTER TABLE "public"."trep_sta_detail" OWNER TO "postgres";
COMMENT ON COLUMN "public"."trep_sta_detail"."tid" IS '租户id';
COMMENT ON COLUMN "public"."trep_sta_detail"."did" IS '设备id';
COMMENT ON COLUMN "public"."trep_sta_detail"."key" IS '属性key';
COMMENT ON COLUMN "public"."trep_sta_detail"."val_arr" IS '首次统计属性值';
COMMENT ON COLUMN "public"."trep_sta_detail"."val_dep" IS '最后统计属性值';
COMMENT ON COLUMN "public"."trep_sta_detail"."ctime" IS '创建时间';
COMMENT ON COLUMN "public"."trep_sta_detail"."mtime" IS '修改时间';
-- ----------------------------
-- Indexes structure for table tcode_base
-- ----------------------------
CREATE UNIQUE INDEX "tcode_base_item_code_val_tenant_id_idx" ON "public"."tcode_base" USING btree (
"item" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"val" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST
);
-- ----------------------------
-- Primary Key structure for table tcode_base
-- ----------------------------
ALTER TABLE "public"."tcode_base" ADD CONSTRAINT "tcode_base_pkey" PRIMARY KEY ("id");
-- ----------------------------
-- Indexes structure for table tcode_device
-- ----------------------------
CREATE UNIQUE INDEX "tcode_device_index" ON "public"."tcode_device" USING btree (
"id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"did" "pg_catalog"."uuid_ops" ASC NULLS LAST
);
-- ----------------------------
-- Uniques structure for table tcode_device
-- ----------------------------
ALTER TABLE "public"."tcode_device" ADD CONSTRAINT "tcode_device_mcode_tenant_id_did_key" UNIQUE ("mcode", "tenant_id", "did");
-- ----------------------------
-- Primary Key structure for table tcode_device
-- ----------------------------
ALTER TABLE "public"."tcode_device" ADD CONSTRAINT "tcode_device_pkey" PRIMARY KEY ("id");
-- ----------------------------
-- Primary Key structure for table tcode_group
-- ----------------------------
ALTER TABLE "public"."tcode_group" ADD CONSTRAINT "tcode_group_pkey" PRIMARY KEY ("tid", "code");
-- ----------------------------
-- Primary Key structure for table tcode_group_days
-- ----------------------------
ALTER TABLE "public"."tcode_group_days" ADD CONSTRAINT "tcode_group_days_pkey" PRIMARY KEY ("tid");
-- ----------------------------
-- Primary Key structure for table tcode_group_electric
-- ----------------------------
ALTER TABLE "public"."tcode_group_electric" ADD CONSTRAINT "tcode_group_electric_pkey" PRIMARY KEY ("tid", "code");
-- ----------------------------
-- Indexes structure for table tcode_model
-- ----------------------------
CREATE UNIQUE INDEX "tcode_model_index" ON "public"."tcode_model" USING btree (
"id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
-- ----------------------------
-- Uniques structure for table tcode_model
-- ----------------------------
ALTER TABLE "public"."tcode_model" ADD CONSTRAINT "tcode_model_tenant_id_code_key" UNIQUE ("tenant_id", "code");
-- ----------------------------
-- Primary Key structure for table tcode_model
-- ----------------------------
ALTER TABLE "public"."tcode_model" ADD CONSTRAINT "tcode_model_pkey" PRIMARY KEY ("id");
-- ----------------------------
-- Uniques structure for table tcode_model_detail
-- ----------------------------
ALTER TABLE "public"."tcode_model_detail" ADD CONSTRAINT "tcode_model_detail_code_key_tenant_id_key" UNIQUE ("code", "key", "tenant_id");
-- ----------------------------
-- Primary Key structure for table tcode_model_detail
-- ----------------------------
ALTER TABLE "public"."tcode_model_detail" ADD CONSTRAINT "tcode_model_detail_pkey" PRIMARY KEY ("id");
-- ----------------------------
-- Indexes structure for table tcode_model_ex
-- ----------------------------
CREATE UNIQUE INDEX "tcode_model_ex_index" ON "public"."tcode_model_ex" USING btree (
"tid" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
-- ----------------------------
-- Indexes structure for table tcode_unit
-- ----------------------------
CREATE INDEX "tcode_unit_descript_tenant_id_idx" ON "public"."tcode_unit" USING btree (
"descript" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST
);
-- ----------------------------
-- Primary Key structure for table tcode_unit
-- ----------------------------
ALTER TABLE "public"."tcode_unit" ADD CONSTRAINT "tcode_unit_pkey" PRIMARY KEY ("id");
-- ----------------------------
-- Primary Key structure for table trep_day_sta_detail
-- ----------------------------
ALTER TABLE "public"."trep_day_sta_detail" ADD CONSTRAINT "trep_day_sta_detail_pkey" PRIMARY KEY ("tid", "did", "bdate", "key", "val");
-- ----------------------------
-- Indexes structure for table trep_dkey_detail
-- ----------------------------
CREATE UNIQUE INDEX "trep_dkey_detail_index" ON "public"."trep_dkey_detail" USING btree (
"tid" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"did" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"key" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"bdate" "pg_catalog"."date_ops" ASC NULLS LAST
);
-- ----------------------------
-- Primary Key structure for table trep_dkey_detail
-- ----------------------------
ALTER TABLE "public"."trep_dkey_detail" ADD CONSTRAINT "trep_dkey_detail_pkey" PRIMARY KEY ("tid", "did", "key", "bdate");
-- ----------------------------
-- Indexes structure for table trep_group_detail
-- ----------------------------
CREATE UNIQUE INDEX "trep_group_detail_index" ON "public"."trep_group_detail" USING btree (
"tid" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"did" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"key" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"bdate" "pg_catalog"."date_ops" ASC NULLS LAST,
"grpcode" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
-- ----------------------------
-- Primary Key structure for table trep_group_detail
-- ----------------------------
ALTER TABLE "public"."trep_group_detail" ADD CONSTRAINT "trep_group_detail_pkey" PRIMARY KEY ("tid", "did", "key", "bdate", "grpcode");
-- ----------------------------
-- Primary Key structure for table trep_group_sta_detail
-- ----------------------------
ALTER TABLE "public"."trep_group_sta_detail" ADD CONSTRAINT "trep_group_sta_detail_pkey" PRIMARY KEY ("tid", "did", "bdate", "grpcode", "key", "val");
-- ----------------------------
-- Indexes structure for table trep_hkey_detail
-- ----------------------------
CREATE UNIQUE INDEX "trep_hkey_detail_index1" ON "public"."trep_hkey_detail" USING btree (
"tid" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"did" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"key" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"bdate" "pg_catalog"."date_ops" ASC NULLS LAST,
"hours" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"val" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
-- ----------------------------
-- Primary Key structure for table trep_hkey_detail
-- ----------------------------
ALTER TABLE "public"."trep_hkey_detail" ADD CONSTRAINT "trep_hkey_detail_pkey" PRIMARY KEY ("tid", "did", "key", "bdate", "hours");
-- ----------------------------
-- Primary Key structure for table trep_hours_sta_detail
-- ----------------------------
ALTER TABLE "public"."trep_hours_sta_detail" ADD CONSTRAINT "trep_hours_sta_detail_pkey" PRIMARY KEY ("tid", "did", "key", "bdate", "hours", "val");
-- ----------------------------
-- Primary Key structure for table trep_hsta_detail
-- ----------------------------
ALTER TABLE "public"."trep_hsta_detail" ADD CONSTRAINT "trep_sta_hdetail_pkey" PRIMARY KEY ("aid");
-- ----------------------------
-- Indexes structure for table trep_sta_detail
-- ----------------------------
CREATE UNIQUE INDEX "trep_sta_detail_index1" ON "public"."trep_sta_detail" USING btree (
"tid" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"did" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"key" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
-- ----------------------------
-- Primary Key structure for table trep_sta_detail
-- ----------------------------
ALTER TABLE "public"."trep_sta_detail" ADD CONSTRAINT "trep_sta_detail_pkey" PRIMARY KEY ("tid", "did", "key");
CREATE SEQUENCE trep_sta_hdetail_aid_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
alter table trep_hsta_detail alter column aid set default nextval('trep_sta_hdetail_aid_seq');
\ No newline at end of file
...@@ -23,5 +23,3 @@ services: ...@@ -23,5 +23,3 @@ services:
volumes: volumes:
cassandra-volume: cassandra-volume:
external: true
name: ${CASSANDRA_DATA_VOLUME}
...@@ -25,8 +25,10 @@ services: ...@@ -25,8 +25,10 @@ services:
environment: environment:
POSTGRES_DB: hsiotdb POSTGRES_DB: hsiotdb
POSTGRES_PASSWORD: huansi.net@v3 POSTGRES_PASSWORD: huansi.net@v3
command: -c config_file=/etc/postgresql/postgresql.conf
volumes: volumes:
- ./tb-node/postgres:/var/lib/postgresql/data - ./tb-node/postgres:/var/lib/postgresql/data
- ./db/postgresql.conf:/etc/postgresql/postgresql.conf
cassandra: cassandra:
restart: always restart: always
image: "cassandra:4.0.4" image: "cassandra:4.0.4"
......
...@@ -23,5 +23,3 @@ services: ...@@ -23,5 +23,3 @@ services:
volumes: volumes:
postgres-db-volume: postgres-db-volume:
external: true
name: ${POSTGRES_DATA_VOLUME}
...@@ -25,8 +25,10 @@ services: ...@@ -25,8 +25,10 @@ services:
environment: environment:
POSTGRES_DB: hsiotdb POSTGRES_DB: hsiotdb
POSTGRES_PASSWORD: huansi.net@v3 POSTGRES_PASSWORD: huansi.net@v3
command: -c config_file=/etc/postgresql/postgresql.conf
volumes: volumes:
- ./tb-node/postgres:/var/lib/postgresql/data - ./tb-node/postgres:/var/lib/postgresql/data
- ./db/postgresql.conf:/etc/postgresql/postgresql.conf
tb-core1: tb-core1:
env_file: env_file:
- tb-node.postgres.env - tb-node.postgres.env
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment