/*
 Navicat Premium Data Transfer

 Source Server         : 192.168.188.185
 Source Server Type    : PostgreSQL
 Source Server Version : 150006 (150006)
 Source Host           : 192.168.188.185:5432
 Source Catalog        : thing_v3
 Source Schema         : public

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

 Date: 05/08/2024 16:57:47
*/


-- ----------------------------
-- Table structure for alarm_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."alarm_config";
CREATE TABLE "public"."alarm_config" (
  "id" int8 NOT NULL,
  "thing_id" int8,
  "thing_code" varchar(255) COLLATE "pg_catalog"."default",
  "attr_id" int8,
  "attr_code" varchar(255) COLLATE "pg_catalog"."default",
  "alarm_rule" varchar(255) COLLATE "pg_catalog"."default",
  "alarm_val" varchar(255) COLLATE "pg_catalog"."default",
  "fine_rule" varchar(255) COLLATE "pg_catalog"."default",
  "fine_val" varchar(255) COLLATE "pg_catalog"."default",
  "type" varchar(255) COLLATE "pg_catalog"."default",
  "begin_time" varchar(255) COLLATE "pg_catalog"."default",
  "end_time" varchar(255) COLLATE "pg_catalog"."default",
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "sort" int8
)
;
COMMENT ON COLUMN "public"."alarm_config"."id" IS 'id';
COMMENT ON COLUMN "public"."alarm_config"."thing_id" IS '物实体id';
COMMENT ON COLUMN "public"."alarm_config"."thing_code" IS '物编码';
COMMENT ON COLUMN "public"."alarm_config"."attr_id" IS '属性id';
COMMENT ON COLUMN "public"."alarm_config"."attr_code" IS '属性编码';
COMMENT ON COLUMN "public"."alarm_config"."alarm_rule" IS '告警条件 > < >= <= =';
COMMENT ON COLUMN "public"."alarm_config"."alarm_val" IS '告警值';
COMMENT ON COLUMN "public"."alarm_config"."fine_rule" IS '优值条件 > < >= <= =';
COMMENT ON COLUMN "public"."alarm_config"."fine_val" IS '优值值';
COMMENT ON COLUMN "public"."alarm_config"."type" IS '类型 1峰平谷尖   2夜间用能';
COMMENT ON COLUMN "public"."alarm_config"."begin_time" IS '开始时间';
COMMENT ON COLUMN "public"."alarm_config"."end_time" IS '结束时间';
COMMENT ON COLUMN "public"."alarm_config"."remark" IS '备注';
COMMENT ON COLUMN "public"."alarm_config"."creator" IS '创建者';
COMMENT ON COLUMN "public"."alarm_config"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."alarm_config"."updater" IS '更新者';
COMMENT ON COLUMN "public"."alarm_config"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."alarm_config"."sort" IS '1峰段用量2尖段用量3谷段用量4.平段用量';
COMMENT ON TABLE "public"."alarm_config" IS '尖峰谷平，夜间用能告警配置表';

-- ----------------------------
-- Table structure for alarm_dict
-- ----------------------------
DROP TABLE IF EXISTS "public"."alarm_dict";
CREATE TABLE "public"."alarm_dict" (
  "id" int8 NOT NULL,
  "pid" int8,
  "dict_type" varchar(100) COLLATE "pg_catalog"."default",
  "dict_name" varchar(255) COLLATE "pg_catalog"."default",
  "dict_value" varchar(255) COLLATE "pg_catalog"."default",
  "sort" int4,
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."alarm_dict"."id" IS 'id';
COMMENT ON COLUMN "public"."alarm_dict"."pid" IS '父级字典id';
COMMENT ON COLUMN "public"."alarm_dict"."dict_type" IS '字典类型';
COMMENT ON COLUMN "public"."alarm_dict"."dict_name" IS '字典名称';
COMMENT ON COLUMN "public"."alarm_dict"."dict_value" IS '字典值';
COMMENT ON COLUMN "public"."alarm_dict"."sort" IS '排序';
COMMENT ON COLUMN "public"."alarm_dict"."remark" IS '备注';
COMMENT ON COLUMN "public"."alarm_dict"."creator" IS '创建者';
COMMENT ON COLUMN "public"."alarm_dict"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."alarm_dict"."updater" IS '更新者';
COMMENT ON COLUMN "public"."alarm_dict"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."alarm_dict" IS '告警字典管理';

-- ----------------------------
-- Table structure for alarm_dispose_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."alarm_dispose_log";
CREATE TABLE "public"."alarm_dispose_log" (
  "id" int8 NOT NULL,
  "alarm_log_id" int8,
  "describe" varchar COLLATE "pg_catalog"."default",
  "status" varchar(5) COLLATE "pg_catalog"."default",
  "images" varchar COLLATE "pg_catalog"."default",
  "dispose_result" varchar(255) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."alarm_dispose_log"."alarm_log_id" IS '告警记录';
COMMENT ON COLUMN "public"."alarm_dispose_log"."describe" IS '问题描述';
COMMENT ON COLUMN "public"."alarm_dispose_log"."status" IS '处理状态';
COMMENT ON COLUMN "public"."alarm_dispose_log"."images" IS '图片列表';
COMMENT ON COLUMN "public"."alarm_dispose_log"."dispose_result" IS '处理结果';
COMMENT ON TABLE "public"."alarm_dispose_log" IS '告警处理日志';

-- ----------------------------
-- Table structure for alarm_rule
-- ----------------------------
DROP TABLE IF EXISTS "public"."alarm_rule";
CREATE TABLE "public"."alarm_rule" (
  "id" int8 NOT NULL,
  "name" varchar(500) COLLATE "pg_catalog"."default",
  "type" varchar(5) COLLATE "pg_catalog"."default",
  "level" varchar(5) COLLATE "pg_catalog"."default",
  "enable" bool DEFAULT true,
  "condition" varchar(1000) COLLATE "pg_catalog"."default",
  "content" varchar(500) COLLATE "pg_catalog"."default",
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "trigger_type" varchar(5) COLLATE "pg_catalog"."default",
  "element_info" varchar COLLATE "pg_catalog"."default",
  "repeat" bool,
  "condition_name" varchar COLLATE "pg_catalog"."default",
  "status" varchar(5) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."alarm_rule"."name" IS '告警名称';
COMMENT ON COLUMN "public"."alarm_rule"."type" IS '告警类型';
COMMENT ON COLUMN "public"."alarm_rule"."level" IS '严重程度';
COMMENT ON COLUMN "public"."alarm_rule"."enable" IS '是否可用';
COMMENT ON COLUMN "public"."alarm_rule"."condition" IS '触发规则';
COMMENT ON COLUMN "public"."alarm_rule"."content" IS '告警内容';
COMMENT ON COLUMN "public"."alarm_rule"."remark" IS '备注';
COMMENT ON COLUMN "public"."alarm_rule"."trigger_type" IS '触发类型(job: 0、socket: 1)';
COMMENT ON COLUMN "public"."alarm_rule"."element_info" IS '最新值';
COMMENT ON COLUMN "public"."alarm_rule"."repeat" IS '重复告警';
COMMENT ON COLUMN "public"."alarm_rule"."condition_name" IS '规则中文';
COMMENT ON COLUMN "public"."alarm_rule"."status" IS '处理状态(0:待处理,1:处理中,2:已处理)';
COMMENT ON COLUMN "public"."alarm_rule"."tenant_code" IS '所属租户';
COMMENT ON COLUMN "public"."alarm_rule"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."alarm_rule"."dept_id" IS '部门id';
COMMENT ON TABLE "public"."alarm_rule" IS '告警规则';

-- ----------------------------
-- Table structure for alarm_rule_action
-- ----------------------------
DROP TABLE IF EXISTS "public"."alarm_rule_action";
CREATE TABLE "public"."alarm_rule_action" (
  "id" int8 NOT NULL,
  "rule_id" int8,
  "action_type" varchar(5) COLLATE "pg_catalog"."default",
  "action_id" int8,
  "action_configure" varchar COLLATE "pg_catalog"."default",
  "setting_id" int8,
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."alarm_rule_action"."id" IS '主键';
COMMENT ON COLUMN "public"."alarm_rule_action"."rule_id" IS '规则主键';
COMMENT ON COLUMN "public"."alarm_rule_action"."action_type" IS '动作类型(消息、控制...)';
COMMENT ON COLUMN "public"."alarm_rule_action"."action_id" IS '动作主键(消息设置主键...)';
COMMENT ON COLUMN "public"."alarm_rule_action"."action_configure" IS '动作额外配置';
COMMENT ON COLUMN "public"."alarm_rule_action"."setting_id" IS '推送设置id';
COMMENT ON COLUMN "public"."alarm_rule_action"."tenant_code" IS '所属租户';
COMMENT ON COLUMN "public"."alarm_rule_action"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."alarm_rule_action"."dept_id" IS '部门id';
COMMENT ON TABLE "public"."alarm_rule_action" IS '告警动作';

-- ----------------------------
-- Table structure for alarm_rule_entity
-- ----------------------------
DROP TABLE IF EXISTS "public"."alarm_rule_entity";
CREATE TABLE "public"."alarm_rule_entity" (
  "id" int8 NOT NULL,
  "rule_id" int8 NOT NULL,
  "thing_id" int8 NOT NULL,
  "thing_code" varchar(100) COLLATE "pg_catalog"."default",
  "entity_id" varchar(40) COLLATE "pg_catalog"."default",
  "thing_attr" varchar(20) COLLATE "pg_catalog"."default",
  "label" varchar(50) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."alarm_rule_entity"."id" IS '主键';
COMMENT ON COLUMN "public"."alarm_rule_entity"."rule_id" IS '规则主键';
COMMENT ON COLUMN "public"."alarm_rule_entity"."thing_id" IS '物实体主键';
COMMENT ON COLUMN "public"."alarm_rule_entity"."thing_code" IS '物编码';
COMMENT ON COLUMN "public"."alarm_rule_entity"."entity_id" IS '设备ID';
COMMENT ON COLUMN "public"."alarm_rule_entity"."thing_attr" IS '物属性';
COMMENT ON COLUMN "public"."alarm_rule_entity"."label" IS 'AA/AB/AC';
COMMENT ON COLUMN "public"."alarm_rule_entity"."creator" IS '创建者';
COMMENT ON COLUMN "public"."alarm_rule_entity"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."alarm_rule_entity"."updater" IS '更新者';
COMMENT ON COLUMN "public"."alarm_rule_entity"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."alarm_rule_entity" IS '告警设备';

-- ----------------------------
-- Table structure for alarm_rule_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."alarm_rule_log";
CREATE TABLE "public"."alarm_rule_log" (
  "id" int8 NOT NULL,
  "rule_id" int8,
  "action_id" int8,
  "content" varchar COLLATE "pg_catalog"."default",
  "status" varchar(5) COLLATE "pg_catalog"."default",
  "alarm_time" timestamp(6),
  "dispose_time" timestamp(6),
  "creator" int8,
  "dispose_user_id" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "alarm_type" varchar(255) COLLATE "pg_catalog"."default",
  "alarm_thing_code" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."alarm_rule_log"."rule_id" IS '告警规则主键/发电告警规则主键';
COMMENT ON COLUMN "public"."alarm_rule_log"."action_id" IS '动作id';
COMMENT ON COLUMN "public"."alarm_rule_log"."content" IS '告警内容+告警规则';
COMMENT ON COLUMN "public"."alarm_rule_log"."status" IS '处理状态';
COMMENT ON COLUMN "public"."alarm_rule_log"."alarm_time" IS '告警时间';
COMMENT ON COLUMN "public"."alarm_rule_log"."dispose_time" IS '处理时间';
COMMENT ON COLUMN "public"."alarm_rule_log"."dispose_user_id" IS '处理人';
COMMENT ON COLUMN "public"."alarm_rule_log"."alarm_type" IS '告警类型 1通用告警，2发电告警';
COMMENT ON COLUMN "public"."alarm_rule_log"."alarm_thing_code" IS '告警物编码，发电告警校验回显用';
COMMENT ON TABLE "public"."alarm_rule_log" IS '告警日志';

-- ----------------------------
-- Table structure for alarm_rule_setting
-- ----------------------------
DROP TABLE IF EXISTS "public"."alarm_rule_setting";
CREATE TABLE "public"."alarm_rule_setting" (
  "id" int8 NOT NULL,
  "setting_type" varchar(255) COLLATE "pg_catalog"."default",
  "setting_ids" varchar COLLATE "pg_catalog"."default",
  "action_type" varchar(255) COLLATE "pg_catalog"."default",
  "action_id" int8,
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."alarm_rule_setting"."id" IS '主键';
COMMENT ON COLUMN "public"."alarm_rule_setting"."setting_type" IS '告警选择类型';
COMMENT ON COLUMN "public"."alarm_rule_setting"."setting_ids" IS '告警id集合';
COMMENT ON COLUMN "public"."alarm_rule_setting"."action_type" IS '动作类型(消息、控制...)';
COMMENT ON COLUMN "public"."alarm_rule_setting"."action_id" IS '动作主键(消息设置主键...)';
COMMENT ON COLUMN "public"."alarm_rule_setting"."tenant_code" IS '所属租户';
COMMENT ON COLUMN "public"."alarm_rule_setting"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."alarm_rule_setting"."dept_id" IS '部门id';
COMMENT ON TABLE "public"."alarm_rule_setting" IS '告警规则设置';

-- ----------------------------
-- Table structure for calc_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."calc_log";
CREATE TABLE "public"."calc_log" (
  "id" int8 NOT NULL,
  "calc_target_config_id" int8 NOT NULL,
  "formula" varchar(255) COLLATE "pg_catalog"."default",
  "source_info" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "status" int4 NOT NULL,
  "time" int8,
  "result" varchar(255) COLLATE "pg_catalog"."default",
  "duration" int8,
  "error_info" text COLLATE "pg_catalog"."default",
  "calc_count" int4 DEFAULT 0,
  "tenant_code" int8 NOT NULL,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."calc_log"."id" IS '主键';
COMMENT ON COLUMN "public"."calc_log"."calc_target_config_id" IS '计算目标物配置表id';
COMMENT ON COLUMN "public"."calc_log"."formula" IS '计算公式';
COMMENT ON COLUMN "public"."calc_log"."source_info" IS '计算源信息，json格式';
COMMENT ON COLUMN "public"."calc_log"."status" IS '计算状态：1-已计算、2-未计算、3-计算异常、4-不匹配';
COMMENT ON COLUMN "public"."calc_log"."time" IS '数据时间';
COMMENT ON COLUMN "public"."calc_log"."result" IS '计算结果，只有已计算的记录才有值';
COMMENT ON COLUMN "public"."calc_log"."duration" IS '计算耗时,单位ms';
COMMENT ON COLUMN "public"."calc_log"."error_info" IS '错误信息';
COMMENT ON COLUMN "public"."calc_log"."calc_count" IS '计算次数';
COMMENT ON COLUMN "public"."calc_log"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."calc_log"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."calc_log"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."calc_log"."creator" IS '创建人';
COMMENT ON COLUMN "public"."calc_log"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."calc_log"."updater" IS '更新人';
COMMENT ON COLUMN "public"."calc_log"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."calc_log" IS '物计算日志表';

-- ----------------------------
-- Table structure for calc_source_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."calc_source_config";
CREATE TABLE "public"."calc_source_config" (
  "id" int8 NOT NULL,
  "calc_target_config_id" int8 NOT NULL,
  "source_thing_name" varchar(100) COLLATE "pg_catalog"."default",
  "source_thing_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "source_attr_name" varchar(100) COLLATE "pg_catalog"."default",
  "source_attr_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "source_attr_alias" varchar(10) COLLATE "pg_catalog"."default",
  "tenant_code" int8 NOT NULL,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."calc_source_config"."id" IS '主键';
COMMENT ON COLUMN "public"."calc_source_config"."calc_target_config_id" IS '计算目标物配置表id';
COMMENT ON COLUMN "public"."calc_source_config"."source_thing_name" IS '源物名称';
COMMENT ON COLUMN "public"."calc_source_config"."source_thing_code" IS '源物编码';
COMMENT ON COLUMN "public"."calc_source_config"."source_attr_name" IS '源属性名称';
COMMENT ON COLUMN "public"."calc_source_config"."source_attr_code" IS '源属性编码';
COMMENT ON COLUMN "public"."calc_source_config"."source_attr_alias" IS '源属性在计算公式中的别名';
COMMENT ON COLUMN "public"."calc_source_config"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."calc_source_config"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."calc_source_config"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."calc_source_config"."creator" IS '创建人';
COMMENT ON COLUMN "public"."calc_source_config"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."calc_source_config"."updater" IS '更新人';
COMMENT ON COLUMN "public"."calc_source_config"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."calc_source_config" IS '物计算（目标物）配置表';

-- ----------------------------
-- Table structure for calc_target_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."calc_target_config";
CREATE TABLE "public"."calc_target_config" (
  "id" int8 NOT NULL,
  "config_type" int4 NOT NULL,
  "target_thing_name" varchar(100) COLLATE "pg_catalog"."default",
  "target_thing_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "target_attr_name" varchar(100) COLLATE "pg_catalog"."default",
  "target_attr_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "formula" varchar(255) COLLATE "pg_catalog"."default",
  "formula_description" varchar(255) COLLATE "pg_catalog"."default",
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "enable" bool,
  "tenant_code" int8 NOT NULL,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."calc_target_config"."id" IS '主键';
COMMENT ON COLUMN "public"."calc_target_config"."config_type" IS '配置类型：数据映射、聚合映射、指标计算、高级计算';
COMMENT ON COLUMN "public"."calc_target_config"."target_thing_name" IS '目标物名称';
COMMENT ON COLUMN "public"."calc_target_config"."target_thing_code" IS '目标物编码';
COMMENT ON COLUMN "public"."calc_target_config"."target_attr_name" IS '目标属性名称';
COMMENT ON COLUMN "public"."calc_target_config"."target_attr_code" IS '目标属性编码';
COMMENT ON COLUMN "public"."calc_target_config"."formula" IS '计算公式';
COMMENT ON COLUMN "public"."calc_target_config"."formula_description" IS '计算公式中文描述';
COMMENT ON COLUMN "public"."calc_target_config"."remark" IS '备注';
COMMENT ON COLUMN "public"."calc_target_config"."enable" IS '是否启用计算';
COMMENT ON COLUMN "public"."calc_target_config"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."calc_target_config"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."calc_target_config"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."calc_target_config"."creator" IS '创建人';
COMMENT ON COLUMN "public"."calc_target_config"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."calc_target_config"."updater" IS '更新人';
COMMENT ON COLUMN "public"."calc_target_config"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."calc_target_config" IS '物计算（目标物）配置表';

-- ----------------------------
-- Table structure for carbon_energy_dict_relation
-- ----------------------------
DROP TABLE IF EXISTS "public"."carbon_energy_dict_relation";
CREATE TABLE "public"."carbon_energy_dict_relation" (
  "id" int8 NOT NULL,
  "energy_variety_id" int8 NOT NULL,
  "attr_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "attr_name" varchar(255) COLLATE "pg_catalog"."default",
  "attr_type" varchar(10) COLLATE "pg_catalog"."default",
  "group_id" int8,
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "group_name" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."carbon_energy_dict_relation"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."carbon_energy_dict_relation"."energy_variety_id" IS '能源品种id';
COMMENT ON COLUMN "public"."carbon_energy_dict_relation"."attr_code" IS '属性code';
COMMENT ON COLUMN "public"."carbon_energy_dict_relation"."attr_name" IS '属性名称';
COMMENT ON COLUMN "public"."carbon_energy_dict_relation"."attr_type" IS '属性类型';
COMMENT ON COLUMN "public"."carbon_energy_dict_relation"."group_id" IS '属性组id';
COMMENT ON COLUMN "public"."carbon_energy_dict_relation"."tenant_code" IS '所属企业/租户code';
COMMENT ON COLUMN "public"."carbon_energy_dict_relation"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."carbon_energy_dict_relation"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."carbon_energy_dict_relation"."creator" IS '创建者id';
COMMENT ON COLUMN "public"."carbon_energy_dict_relation"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."carbon_energy_dict_relation"."updater" IS '更新者id';
COMMENT ON COLUMN "public"."carbon_energy_dict_relation"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."carbon_energy_dict_relation"."group_name" IS '组名称';
COMMENT ON TABLE "public"."carbon_energy_dict_relation" IS '能源属性关系';

-- ----------------------------
-- Table structure for carbon_energy_price
-- ----------------------------
DROP TABLE IF EXISTS "public"."carbon_energy_price";
CREATE TABLE "public"."carbon_energy_price" (
  "id" int8 NOT NULL,
  "attr_code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "attr_name" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "energy_variety_id" int8,
  "tag" varchar(128) COLLATE "pg_catalog"."default",
  "price" numeric(10,2),
  "serial_number" int4,
  "begin_time" date,
  "end_time" date,
  "unit" varchar(255) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."carbon_energy_price"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."carbon_energy_price"."attr_code" IS '属性code';
COMMENT ON COLUMN "public"."carbon_energy_price"."attr_name" IS '属性名称';
COMMENT ON COLUMN "public"."carbon_energy_price"."energy_variety_id" IS '能源品种id';
COMMENT ON COLUMN "public"."carbon_energy_price"."tag" IS '能源标签';
COMMENT ON COLUMN "public"."carbon_energy_price"."price" IS '能源价格（元）';
COMMENT ON COLUMN "public"."carbon_energy_price"."serial_number" IS '序号';
COMMENT ON COLUMN "public"."carbon_energy_price"."begin_time" IS '适用时间范围起始日期';
COMMENT ON COLUMN "public"."carbon_energy_price"."end_time" IS '适用时间范围截止日期';
COMMENT ON COLUMN "public"."carbon_energy_price"."unit" IS '计量单位';
COMMENT ON COLUMN "public"."carbon_energy_price"."tenant_code" IS '所属企业/租户code';
COMMENT ON COLUMN "public"."carbon_energy_price"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."carbon_energy_price"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."carbon_energy_price"."creator" IS '创建者id';
COMMENT ON COLUMN "public"."carbon_energy_price"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."carbon_energy_price"."updater" IS '更新者id';
COMMENT ON COLUMN "public"."carbon_energy_price"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."carbon_energy_price" IS '能源价格';

-- ----------------------------
-- Table structure for carbon_peak_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."carbon_peak_config";
CREATE TABLE "public"."carbon_peak_config" (
  "id" int8 NOT NULL,
  "year" varchar(255) COLLATE "pg_catalog"."default",
  "months" varchar(255) COLLATE "pg_catalog"."default",
  "start_time" int8,
  "end_time" int8,
  "base_attr_code" varchar(255) COLLATE "pg_catalog"."default",
  "build_attr_code" varchar(255) COLLATE "pg_catalog"."default",
  "remarks" varchar(2550) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "start_time_f" varchar(64) COLLATE "pg_catalog"."default",
  "end_time_f" varchar(64) COLLATE "pg_catalog"."default",
  "ev_id" int8
)
;
COMMENT ON COLUMN "public"."carbon_peak_config"."id" IS 'id';
COMMENT ON COLUMN "public"."carbon_peak_config"."year" IS '年份（单选）';
COMMENT ON COLUMN "public"."carbon_peak_config"."months" IS '月份（可多选）';
COMMENT ON COLUMN "public"."carbon_peak_config"."start_time" IS '开始时间（0点至输入时间分钟值）例如01:00 = 60';
COMMENT ON COLUMN "public"."carbon_peak_config"."end_time" IS '结束时间（0点至输入时间分钟值）例如02:00 = 120';
COMMENT ON COLUMN "public"."carbon_peak_config"."base_attr_code" IS '关联物属性编码';
COMMENT ON COLUMN "public"."carbon_peak_config"."build_attr_code" IS '映射物属性编码';
COMMENT ON COLUMN "public"."carbon_peak_config"."remarks" IS '备注';
COMMENT ON COLUMN "public"."carbon_peak_config"."tenant_code" IS '所属企业/租户code';
COMMENT ON COLUMN "public"."carbon_peak_config"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."carbon_peak_config"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."carbon_peak_config"."creator" IS '创建者id';
COMMENT ON COLUMN "public"."carbon_peak_config"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."carbon_peak_config"."updater" IS '更新者id';
COMMENT ON COLUMN "public"."carbon_peak_config"."update_date" IS '
更新时间';
COMMENT ON COLUMN "public"."carbon_peak_config"."start_time_f" IS '开始时间（0点至输入时间分钟值）例如01:00 ';
COMMENT ON COLUMN "public"."carbon_peak_config"."end_time_f" IS '结束时间（0点至输入时间分钟值）例如02:00 ';
COMMENT ON COLUMN "public"."carbon_peak_config"."ev_id" IS '能源品种id';
COMMENT ON TABLE "public"."carbon_peak_config" IS '尖峰谷平设置';

-- ----------------------------
-- Table structure for carbon_pub_certificate
-- ----------------------------
DROP TABLE IF EXISTS "public"."carbon_pub_certificate";
CREATE TABLE "public"."carbon_pub_certificate" (
  "id" int8 NOT NULL,
  "product_id" int8,
  "product_name" varchar(500) COLLATE "pg_catalog"."default",
  "boundary_start" int8,
  "boundary_end" int8,
  "certification_org" varchar(255) COLLATE "pg_catalog"."default",
  "verification_std" varchar(255) COLLATE "pg_catalog"."default",
  "carbon_val" numeric(15,5),
  "stage_percent_json" varchar(255) COLLATE "pg_catalog"."default",
  "certificate_url" varchar(600) COLLATE "pg_catalog"."default",
  "certificate_start" int8,
  "certificate_end" int8,
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."carbon_pub_certificate"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."product_id" IS '产品id';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."product_name" IS '产品名称';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."boundary_start" IS '数据时间边界开始';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."boundary_end" IS '数据时间边界截止';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."certification_org" IS '认证机构';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."verification_std" IS '核查标准';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."carbon_val" IS '产品碳足迹值，单位kce';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."stage_percent_json" IS '生命周期各阶段占比json';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."certificate_url" IS '证书url';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."certificate_start" IS '发证日期';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."certificate_end" IS '证书到期时间';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."creator" IS '创建人';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."updater" IS '更新人';
COMMENT ON COLUMN "public"."carbon_pub_certificate"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."carbon_pub_certificate" IS '碳足迹证书';

-- ----------------------------
-- Table structure for carbon_pub_eng_eff
-- ----------------------------
DROP TABLE IF EXISTS "public"."carbon_pub_eng_eff";
CREATE TABLE "public"."carbon_pub_eng_eff" (
  "id" int8 NOT NULL,
  "product_type" varchar(255) COLLATE "pg_catalog"."default",
  "product_name" varchar(255) COLLATE "pg_catalog"."default",
  "eff_kpi" varchar(255) COLLATE "pg_catalog"."default",
  "unit" varchar(20) COLLATE "pg_catalog"."default",
  "top_category" varchar(255) COLLATE "pg_catalog"."default",
  "sub_category" varchar(255) COLLATE "pg_catalog"."default",
  "category_info" varchar(255) COLLATE "pg_catalog"."default",
  "adv_level" varchar(255) COLLATE "pg_catalog"."default",
  "eng_saving_level" varchar(255) COLLATE "pg_catalog"."default",
  "admission_level" varchar(255) COLLATE "pg_catalog"."default",
  "reference_std" varchar(255) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "device_url" varchar(500) COLLATE "pg_catalog"."default",
  "remark" varchar(2550) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."product_type" IS '产品类别';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."product_name" IS '产品类别';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."eff_kpi" IS '能效指标';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."unit" IS '单位';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."top_category" IS '一级分类';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."sub_category" IS '二级分类';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."category_info" IS '分类详情';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."adv_level" IS '先进水平';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."eng_saving_level" IS '节能水平';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."admission_level" IS '准入水平';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."reference_std" IS '参考标准';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."creator" IS '创建人';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."updater" IS '更新人';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."device_url" IS '设备图片url';
COMMENT ON COLUMN "public"."carbon_pub_eng_eff"."remark" IS '设备备注';
COMMENT ON TABLE "public"."carbon_pub_eng_eff" IS '设备能效标准';

-- ----------------------------
-- Table structure for carbon_pub_material_factor
-- ----------------------------
DROP TABLE IF EXISTS "public"."carbon_pub_material_factor";
CREATE TABLE "public"."carbon_pub_material_factor" (
  "id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "geo_short" varchar(100) COLLATE "pg_catalog"."default",
  "geo_full" varchar(100) COLLATE "pg_catalog"."default",
  "geo_full_cn" varchar(200) COLLATE "pg_catalog"."default",
  "product_name" varchar(255) COLLATE "pg_catalog"."default",
  "product_name_cn" varchar(255) COLLATE "pg_catalog"."default",
  "product_unit" varchar(50) COLLATE "pg_catalog"."default",
  "factor" numeric,
  "ref_count" int4 DEFAULT 1,
  "source_name" varchar(255) COLLATE "pg_catalog"."default",
  "hot_score" int4 DEFAULT 0,
  "start_year" varchar(10) COLLATE "pg_catalog"."default",
  "end_year" varchar(10) COLLATE "pg_catalog"."default",
  "industry" varchar(255) COLLATE "pg_catalog"."default",
  "industry_cn" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."carbon_pub_material_factor"."geo_short" IS '地理位置简称';
COMMENT ON COLUMN "public"."carbon_pub_material_factor"."geo_full" IS '地理位置全称';
COMMENT ON COLUMN "public"."carbon_pub_material_factor"."geo_full_cn" IS '地理位置全程（中文）';
COMMENT ON COLUMN "public"."carbon_pub_material_factor"."product_name" IS '产品名称';
COMMENT ON COLUMN "public"."carbon_pub_material_factor"."product_name_cn" IS '产品名称中文';
COMMENT ON COLUMN "public"."carbon_pub_material_factor"."product_unit" IS '产品单位';
COMMENT ON COLUMN "public"."carbon_pub_material_factor"."factor" IS '碳排因子';
COMMENT ON COLUMN "public"."carbon_pub_material_factor"."ref_count" IS '参考单元';
COMMENT ON COLUMN "public"."carbon_pub_material_factor"."source_name" IS '碳排因子库名称';
COMMENT ON COLUMN "public"."carbon_pub_material_factor"."hot_score" IS '因子热度：单独查询次数';
COMMENT ON COLUMN "public"."carbon_pub_material_factor"."start_year" IS '开始年份';
COMMENT ON COLUMN "public"."carbon_pub_material_factor"."end_year" IS '截止年份';
COMMENT ON COLUMN "public"."carbon_pub_material_factor"."industry" IS '行业';
COMMENT ON COLUMN "public"."carbon_pub_material_factor"."industry_cn" IS '行业（中文）';
COMMENT ON TABLE "public"."carbon_pub_material_factor" IS '原材料碳排因子库';

-- ----------------------------
-- Table structure for carbon_pub_material_factor_use
-- ----------------------------
DROP TABLE IF EXISTS "public"."carbon_pub_material_factor_use";
CREATE TABLE "public"."carbon_pub_material_factor_use" (
  "id" int8 NOT NULL,
  "material_factor_id" varchar(100) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "use_time" int8
)
;
COMMENT ON COLUMN "public"."carbon_pub_material_factor_use"."material_factor_id" IS '碳排因子库主键';
COMMENT ON COLUMN "public"."carbon_pub_material_factor_use"."tenant_code" IS '使用该因子的企业租户编码';
COMMENT ON COLUMN "public"."carbon_pub_material_factor_use"."use_time" IS '碳排因子下载时间';
COMMENT ON TABLE "public"."carbon_pub_material_factor_use" IS '原材料碳排因子库使用记录';

-- ----------------------------
-- Table structure for carbon_pub_points_logs
-- ----------------------------
DROP TABLE IF EXISTS "public"."carbon_pub_points_logs";
CREATE TABLE "public"."carbon_pub_points_logs" (
  "id" int8 NOT NULL,
  "type" varchar(255) COLLATE "pg_catalog"."default",
  "points" int8,
  "tenant_code" int8,
  "create_time" int8
)
;
COMMENT ON COLUMN "public"."carbon_pub_points_logs"."id" IS '主键id';
COMMENT ON COLUMN "public"."carbon_pub_points_logs"."type" IS '类型，中文描述';
COMMENT ON COLUMN "public"."carbon_pub_points_logs"."points" IS '增减积分值';
COMMENT ON COLUMN "public"."carbon_pub_points_logs"."tenant_code" IS '供应商编码';
COMMENT ON COLUMN "public"."carbon_pub_points_logs"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."carbon_pub_points_logs" IS '积分增减记录';

-- ----------------------------
-- Table structure for carbon_pub_points_rule
-- ----------------------------
DROP TABLE IF EXISTS "public"."carbon_pub_points_rule";
CREATE TABLE "public"."carbon_pub_points_rule" (
  "id" int8 NOT NULL,
  "model_shared_points" int4,
  "model_click_points" int4,
  "result_shared_points" int4,
  "process_shared_points" int4,
  "footprint_certify_points" int4,
  "factor_use_points" int4 DEFAULT 1
)
;
COMMENT ON COLUMN "public"."carbon_pub_points_rule"."model_shared_points" IS '模型共享积分';
COMMENT ON COLUMN "public"."carbon_pub_points_rule"."model_click_points" IS '模型点击积分';
COMMENT ON COLUMN "public"."carbon_pub_points_rule"."result_shared_points" IS '结果数据共享积分';
COMMENT ON COLUMN "public"."carbon_pub_points_rule"."process_shared_points" IS '过程数据共享积分';
COMMENT ON COLUMN "public"."carbon_pub_points_rule"."footprint_certify_points" IS '碳足迹认证积分';
COMMENT ON COLUMN "public"."carbon_pub_points_rule"."factor_use_points" IS '碳排因子首次使用消耗积分';
COMMENT ON TABLE "public"."carbon_pub_points_rule" IS '碳足迹积分规则';

-- ----------------------------
-- Table structure for carbon_pub_production_model
-- ----------------------------
DROP TABLE IF EXISTS "public"."carbon_pub_production_model";
CREATE TABLE "public"."carbon_pub_production_model" (
  "id" int8 NOT NULL,
  "product_id" int8,
  "product_code" varchar(255) COLLATE "pg_catalog"."default",
  "product_name" varchar(500) COLLATE "pg_catalog"."default",
  "product_model" varchar(255) COLLATE "pg_catalog"."default",
  "url" varchar(500) COLLATE "pg_catalog"."default",
  "function_unit" varchar(50) COLLATE "pg_catalog"."default",
  "product_json" text COLLATE "pg_catalog"."default",
  "material_json" text COLLATE "pg_catalog"."default",
  "process_json" text COLLATE "pg_catalog"."default",
  "steps_url" varchar(500) COLLATE "pg_catalog"."default",
  "steps_json" text COLLATE "pg_catalog"."default",
  "industry_type" varchar(64) COLLATE "pg_catalog"."default",
  "industry_category" varchar(64) COLLATE "pg_catalog"."default",
  "product_type" varchar(64) COLLATE "pg_catalog"."default",
  "download_count" int4 DEFAULT 0,
  "show_in_community" int4 DEFAULT 0,
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."carbon_pub_production_model"."product_id" IS '产品id';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."product_code" IS '产品编码';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."product_name" IS '产品名称';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."product_model" IS '产品模型';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."url" IS '产品图片';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."function_unit" IS '功能单位';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."product_json" IS '产品基本信息json';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."material_json" IS '原料信息json';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."process_json" IS '产品工艺工序json';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."steps_url" IS '工序预览图';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."steps_json" IS '工序拖拉拽json';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."industry_type" IS '行业一级分类，企业详情的industry_type';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."industry_category" IS '行业二级分类，企业详情的industry_category';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."product_type" IS '产品类型';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."download_count" IS '下载次数';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."show_in_community" IS '社区中是否展示：0-不展示， 1-展示';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."creator" IS '创建人';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."updater" IS '更新人';
COMMENT ON COLUMN "public"."carbon_pub_production_model"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."carbon_pub_production_model" IS '产品工艺模型';

-- ----------------------------
-- Table structure for carbon_pub_production_report
-- ----------------------------
DROP TABLE IF EXISTS "public"."carbon_pub_production_report";
CREATE TABLE "public"."carbon_pub_production_report" (
  "id" int8 NOT NULL,
  "product_id" int8,
  "config_id" int8,
  "boundary" varchar(4) COLLATE "pg_catalog"."default",
  "boundary_type" int4,
  "boundary_start" date,
  "boundary_end" date,
  "valid_end_time" int8,
  "total_carbon" numeric(15,5),
  "stage_percent_json" varchar(255) COLLATE "pg_catalog"."default",
  "company_name" varchar(255) COLLATE "pg_catalog"."default",
  "report_code" varchar(100) COLLATE "pg_catalog"."default",
  "source_type" varchar(100) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."carbon_pub_production_report"."product_id" IS '产品id';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."config_id" IS '碳足报告配置id';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."boundary" IS '系统边界类型：1-摇篮到大门，2-摇篮到坟墓';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."boundary_type" IS '数据边界类型：1-自然月；2-自然年；3-自定义';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."boundary_start" IS '数据边界开始时间';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."boundary_end" IS '数据边界结束时间';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."valid_end_time" IS '报告有效期';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."total_carbon" IS '碳足迹值';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."stage_percent_json" IS '各阶段碳足迹占比';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."company_name" IS '企业名称';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."report_code" IS '报告编号';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."source_type" IS '报告来源类型：填报、实采、证书上传';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."creator" IS '创建人';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."updater" IS '更新人';
COMMENT ON COLUMN "public"."carbon_pub_production_report"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."carbon_pub_production_report" IS '产品碳足迹报告';

-- ----------------------------
-- Table structure for carbon_pub_production_report_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."carbon_pub_production_report_config";
CREATE TABLE "public"."carbon_pub_production_report_config" (
  "id" int8 NOT NULL,
  "tenant_code" int8,
  "product_id" int8,
  "boundary_type" int4,
  "boundary_start" int8,
  "boundary_end" int8,
  "show_result" int4
)
;
COMMENT ON COLUMN "public"."carbon_pub_production_report_config"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."carbon_pub_production_report_config"."tenant_code" IS '企业租户编码';
COMMENT ON COLUMN "public"."carbon_pub_production_report_config"."product_id" IS '产品id';
COMMENT ON COLUMN "public"."carbon_pub_production_report_config"."boundary_type" IS '数据边界类型：1-自然月；2-自然年；3-自定义';
COMMENT ON COLUMN "public"."carbon_pub_production_report_config"."boundary_start" IS '数据边界开始时间：只有自定义边界才有值';
COMMENT ON COLUMN "public"."carbon_pub_production_report_config"."boundary_end" IS '数据边界结束时间：只有自定义边界才有值';
COMMENT ON COLUMN "public"."carbon_pub_production_report_config"."show_result" IS '是否展示结果';
COMMENT ON TABLE "public"."carbon_pub_production_report_config" IS '碳足迹报告配置';

-- ----------------------------
-- Table structure for carbon_pub_production_result
-- ----------------------------
DROP TABLE IF EXISTS "public"."carbon_pub_production_result";
CREATE TABLE "public"."carbon_pub_production_result" (
  "id" int8 NOT NULL,
  "product_id" int8,
  "product_name" varchar(255) COLLATE "pg_catalog"."default",
  "product_code" varchar(255) COLLATE "pg_catalog"."default",
  "product_model" varchar(255) COLLATE "pg_catalog"."default",
  "product_weight" numeric(16,4),
  "function_unit" varchar(255) COLLATE "pg_catalog"."default",
  "weight_unit" varchar(255) COLLATE "pg_catalog"."default",
  "pr_code" varchar(255) COLLATE "pg_catalog"."default",
  "pr_dur" int4,
  "num" int8,
  "final_num" int8,
  "ev_id" int8,
  "ev_name" varchar(128) COLLATE "pg_catalog"."default",
  "usage" numeric(16,4),
  "usage_avg" numeric(16,4),
  "carbon" numeric(16,4),
  "carbon_avg" numeric(16,4),
  "tce" numeric(16,4),
  "carbon_type" varchar(255) COLLATE "pg_catalog"."default",
  "result_type" varchar(4) COLLATE "pg_catalog"."default",
  "boundary" varchar(4) COLLATE "pg_catalog"."default",
  "start_time" date,
  "finish_time" date,
  "json" text COLLATE "pg_catalog"."default",
  "ori_id" int8,
  "group_id" int8,
  "fq_usage" numeric(255,0),
  "fq_carbon" numeric(255,0),
  "fq_usage_avg" numeric(255,0),
  "fq_carbon_avg" numeric(255,0),
  "fq_ev_id" int8,
  "fq_ev_name" varchar(255) COLLATE "pg_catalog"."default",
  "life" int4,
  "source_type" varchar(4) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."carbon_pub_production_result"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."product_id" IS '产品id';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."product_name" IS '产品名称';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."product_code" IS '产品编码（料号）';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."product_model" IS '产品型号';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."product_weight" IS '产品重量';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."function_unit" IS '功能单位计量单位';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."weight_unit" IS '产品重量计量单位';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."pr_code" IS '生产记录编码';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."pr_dur" IS '生产时长，小时数';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."num" IS '生产数量';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."final_num" IS '产成品数量';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."ev_id" IS '能源品种id';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."ev_name" IS '能源品种名称';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."usage" IS '总用量';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."usage_avg" IS '平均用量/ 原材料的时候，这里存平均运输碳排值';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."carbon" IS '总碳排';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."carbon_avg" IS '平均碳排/ 原材料的时候，这里存平均物料碳排';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."tce" IS '总能耗';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."carbon_type" IS ' 1 原料碳排,原料运输碳排2 生产3 公摊/间接4 产品运输5 产品使用6 产品废弃,产品废弃运输';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."result_type" IS '同步类型： 1-结果数据 2-过程数据';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."boundary" IS '系统边界： 1-摇篮到大门， 2-摇篮到坟墓';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."start_time" IS '完工时间';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."finish_time" IS '完工时间';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."json" IS '详情json，一个类型，一个能源，形成一个详情json';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."ori_id" IS '源数据id';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."group_id" IS '提交数据组id，产品运输，id相同的时候，说明是一批产品，分段运输';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."fq_usage" IS '废弃运输里程';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."fq_carbon" IS '废弃运输碳排';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."fq_usage_avg" IS '废弃运输里程平均=废弃运输里程，方便处理，冗余字段';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."fq_carbon_avg" IS '单件废弃运输碳排';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."fq_ev_id" IS '废弃运输类型id';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."fq_ev_name" IS '废弃运输类型';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."life" IS '产品使用，使用年限';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."source_type" IS '数据源类型：1-实采， 2-填报';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."creator" IS '创建人';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."updater" IS '更新人';
COMMENT ON COLUMN "public"."carbon_pub_production_result"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."carbon_pub_production_result" IS '生产记录核算结果';

-- ----------------------------
-- Table structure for carbon_pub_supplier
-- ----------------------------
DROP TABLE IF EXISTS "public"."carbon_pub_supplier";
CREATE TABLE "public"."carbon_pub_supplier" (
  "id" int8 NOT NULL,
  "name" varchar(200) COLLATE "pg_catalog"."default",
  "code" int8,
  "access_token" varchar(200) COLLATE "pg_catalog"."default",
  "region_id" int8,
  "product_type" varchar(1000) COLLATE "pg_catalog"."default",
  "points" int4
)
;
COMMENT ON COLUMN "public"."carbon_pub_supplier"."name" IS '供应商名称';
COMMENT ON COLUMN "public"."carbon_pub_supplier"."code" IS '供应商编码（tenant_code）';
COMMENT ON COLUMN "public"."carbon_pub_supplier"."access_token" IS '供应商令牌';
COMMENT ON COLUMN "public"."carbon_pub_supplier"."region_id" IS '地区id（sys_region表id）';
COMMENT ON COLUMN "public"."carbon_pub_supplier"."product_type" IS '产品分类，按逗号分隔';
COMMENT ON COLUMN "public"."carbon_pub_supplier"."points" IS '剩余积分';
COMMENT ON TABLE "public"."carbon_pub_supplier" IS '产品碳足迹供应商';

-- ----------------------------
-- Table structure for carbon_ts_kv
-- ----------------------------
DROP TABLE IF EXISTS "public"."carbon_ts_kv";
CREATE TABLE "public"."carbon_ts_kv" (
  "thing_id" int8 NOT NULL,
  "thing_code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "attr_key" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "ts" int8 NOT NULL,
  "val" varchar COLLATE "pg_catalog"."default",
  "day_time" date,
  "create_time" int8,
  "update_time" int8,
  "attribute_type" varchar(10) COLLATE "pg_catalog"."default" NOT NULL
)
;
COMMENT ON COLUMN "public"."carbon_ts_kv"."thing_id" IS '企业设备id';
COMMENT ON COLUMN "public"."carbon_ts_kv"."thing_code" IS '设备编码';
COMMENT ON COLUMN "public"."carbon_ts_kv"."attr_key" IS '属性编码';
COMMENT ON COLUMN "public"."carbon_ts_kv"."ts" IS '时间戳';
COMMENT ON COLUMN "public"."carbon_ts_kv"."val" IS '遥测值';
COMMENT ON COLUMN "public"."carbon_ts_kv"."day_time" IS '时间';
COMMENT ON COLUMN "public"."carbon_ts_kv"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."carbon_ts_kv"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."carbon_ts_kv"."attribute_type" IS '属性类型：dd, mm, yy';
COMMENT ON TABLE "public"."carbon_ts_kv" IS '企业遥测数据缓存';

-- ----------------------------
-- Table structure for eq_attacment
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_attacment";
CREATE TABLE "public"."eq_attacment" (
  "id" int8 NOT NULL,
  "thing_id" int8,
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6),
  "url" varchar(255) COLLATE "pg_catalog"."default",
  "type" varchar(16) COLLATE "pg_catalog"."default",
  "modular_type" varchar(16) COLLATE "pg_catalog"."default",
  "name" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."eq_attacment"."thing_id" IS '设备id/维修id/保养id...各种外键id';
COMMENT ON COLUMN "public"."eq_attacment"."creator" IS '创建者';
COMMENT ON COLUMN "public"."eq_attacment"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_attacment"."updater" IS '更新者';
COMMENT ON COLUMN "public"."eq_attacment"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_attacment"."url" IS '图片或文件url';
COMMENT ON COLUMN "public"."eq_attacment"."type" IS '0图片，1附件';
COMMENT ON COLUMN "public"."eq_attacment"."modular_type" IS '模块：0设备管理 1能源管理';
COMMENT ON COLUMN "public"."eq_attacment"."name" IS '名称';
COMMENT ON TABLE "public"."eq_attacment" IS '附件表';

-- ----------------------------
-- Table structure for eq_bx
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_bx";
CREATE TABLE "public"."eq_bx" (
  "id" int8 NOT NULL,
  "fault_type" varchar(16) COLLATE "pg_catalog"."default",
  "wx_team" varchar(255) COLLATE "pg_catalog"."default",
  "urgent_level" varchar(16) COLLATE "pg_catalog"."default",
  "shutdown" varchar(16) COLLATE "pg_catalog"."default" DEFAULT 0,
  "dept_id" int8,
  "tenant_code" int8,
  "creator" int8,
  "create_date" timestamp(0),
  "updater" int8,
  "update_date" timestamp(0),
  "fault_desc" varchar(512) COLLATE "pg_catalog"."default",
  "eq_id" int8 NOT NULL,
  "happen_date" timestamp(0),
  "bx_user" varchar(255) COLLATE "pg_catalog"."default",
  "bx_user_mobile" varchar(255) COLLATE "pg_catalog"."default",
  "fault_level" varchar(16) COLLATE "pg_catalog"."default",
  "reviewer" int8,
  "wx_status" varchar(16) COLLATE "pg_catalog"."default",
  "bx_no" varchar(64) COLLATE "pg_catalog"."default",
  "wx_user_id" varchar(255) COLLATE "pg_catalog"."default",
  "wx_level" varchar(255) COLLATE "pg_catalog"."default",
  "fault_reason" varchar(255) COLLATE "pg_catalog"."default",
  "repair_status" varchar(16) COLLATE "pg_catalog"."default",
  "repair_time" date,
  "in_wx" varchar(5) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."eq_bx"."id" IS 'id';
COMMENT ON COLUMN "public"."eq_bx"."fault_type" IS '故障类型';
COMMENT ON COLUMN "public"."eq_bx"."wx_team" IS '维修班组';
COMMENT ON COLUMN "public"."eq_bx"."urgent_level" IS '紧急程度';
COMMENT ON COLUMN "public"."eq_bx"."shutdown" IS '是否停机；0不停机 1停机，默认0';
COMMENT ON COLUMN "public"."eq_bx"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."eq_bx"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."eq_bx"."creator" IS '创建人';
COMMENT ON COLUMN "public"."eq_bx"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_bx"."updater" IS '更新人';
COMMENT ON COLUMN "public"."eq_bx"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_bx"."fault_desc" IS '故障描述';
COMMENT ON COLUMN "public"."eq_bx"."eq_id" IS '设备id';
COMMENT ON COLUMN "public"."eq_bx"."happen_date" IS '发生时间';
COMMENT ON COLUMN "public"."eq_bx"."bx_user" IS '报修人';
COMMENT ON COLUMN "public"."eq_bx"."bx_user_mobile" IS '报修人手机号';
COMMENT ON COLUMN "public"."eq_bx"."fault_level" IS '故障等级';
COMMENT ON COLUMN "public"."eq_bx"."reviewer" IS '审核人';
COMMENT ON COLUMN "public"."eq_bx"."wx_status" IS '维修状态（0:未处理，1：处理中，2：完成）';
COMMENT ON COLUMN "public"."eq_bx"."bx_no" IS '报修单号';
COMMENT ON COLUMN "public"."eq_bx"."wx_user_id" IS '维修组的成员';
COMMENT ON COLUMN "public"."eq_bx"."wx_level" IS '维修级别';
COMMENT ON COLUMN "public"."eq_bx"."fault_reason" IS '故障原因';
COMMENT ON COLUMN "public"."eq_bx"."repair_status" IS '报修状态（ACTIVE:已激活，INACTIVE：未激活）';
COMMENT ON COLUMN "public"."eq_bx"."repair_time" IS '报修受理时间';
COMMENT ON COLUMN "public"."eq_bx"."in_wx" IS '是否进入报修';
COMMENT ON TABLE "public"."eq_bx" IS '设备报修';

-- ----------------------------
-- Table structure for eq_by
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_by";
CREATE TABLE "public"."eq_by" (
  "id" int8 NOT NULL,
  "by_team" varchar(255) COLLATE "pg_catalog"."default",
  "by_level" varchar(16) COLLATE "pg_catalog"."default",
  "shutdown" varchar(16) COLLATE "pg_catalog"."default" DEFAULT 0,
  "creator" int8,
  "create_date" timestamp(0),
  "updater" int8,
  "update_date" timestamp(0),
  "work_desc" varchar(512) COLLATE "pg_catalog"."default",
  "eq_by_plan_id" int8 NOT NULL,
  "by_status" varchar(16) COLLATE "pg_catalog"."default",
  "by_no" varchar(64) COLLATE "pg_catalog"."default",
  "shutdown_time" varchar(64) COLLATE "pg_catalog"."default",
  "by_start_time" timestamp(6),
  "by_end_time" timestamp(6),
  "by_fee" varchar(255) COLLATE "pg_catalog"."default",
  "by_user" varchar(255) COLLATE "pg_catalog"."default",
  "by_time" varchar(255) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8
)
;
COMMENT ON COLUMN "public"."eq_by"."id" IS 'id';
COMMENT ON COLUMN "public"."eq_by"."by_team" IS '保养班组';
COMMENT ON COLUMN "public"."eq_by"."by_level" IS '保养级别';
COMMENT ON COLUMN "public"."eq_by"."shutdown" IS '是否停机；0不停机 1停机，默认0';
COMMENT ON COLUMN "public"."eq_by"."creator" IS '创建人';
COMMENT ON COLUMN "public"."eq_by"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_by"."updater" IS '更新人';
COMMENT ON COLUMN "public"."eq_by"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_by"."work_desc" IS '工作描述';
COMMENT ON COLUMN "public"."eq_by"."eq_by_plan_id" IS '设备保养计划id';
COMMENT ON COLUMN "public"."eq_by"."by_status" IS '保养状态';
COMMENT ON COLUMN "public"."eq_by"."by_no" IS '保养单号';
COMMENT ON COLUMN "public"."eq_by"."shutdown_time" IS '停机时长（单位分钟）';
COMMENT ON COLUMN "public"."eq_by"."by_start_time" IS '保养开始时间';
COMMENT ON COLUMN "public"."eq_by"."by_end_time" IS '保养结束时间';
COMMENT ON COLUMN "public"."eq_by"."by_fee" IS '保养费用';
COMMENT ON COLUMN "public"."eq_by"."by_user" IS '保养人员';
COMMENT ON COLUMN "public"."eq_by"."by_time" IS '保养时长';
COMMENT ON COLUMN "public"."eq_by"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."eq_by"."tenant_code" IS '租户编码';
COMMENT ON TABLE "public"."eq_by" IS '设备保养';

-- ----------------------------
-- Table structure for eq_by_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_by_detail";
CREATE TABLE "public"."eq_by_detail" (
  "id" int8 NOT NULL,
  "by_id" int8,
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "description" varchar(255) COLLATE "pg_catalog"."default",
  "bw_no" varchar(16) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6),
  "by_yesno" varchar(16) COLLATE "pg_catalog"."default",
  "by_template_id" int8,
  "by_template_detail_id" int8
)
;
COMMENT ON COLUMN "public"."eq_by_detail"."by_id" IS '保养id';
COMMENT ON COLUMN "public"."eq_by_detail"."name" IS '部位名称';
COMMENT ON COLUMN "public"."eq_by_detail"."description" IS '描述';
COMMENT ON COLUMN "public"."eq_by_detail"."bw_no" IS '编号';
COMMENT ON COLUMN "public"."eq_by_detail"."creator" IS '创建者';
COMMENT ON COLUMN "public"."eq_by_detail"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_by_detail"."updater" IS '更新者';
COMMENT ON COLUMN "public"."eq_by_detail"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_by_detail"."by_yesno" IS '是否保养，0未保养，1保养，默认1';
COMMENT ON COLUMN "public"."eq_by_detail"."by_template_id" IS '保养模板id';
COMMENT ON COLUMN "public"."eq_by_detail"."by_template_detail_id" IS '保养部位id';
COMMENT ON TABLE "public"."eq_by_detail" IS '保养明细';

-- ----------------------------
-- Table structure for eq_by_plan
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_by_plan";
CREATE TABLE "public"."eq_by_plan" (
  "id" int8 NOT NULL,
  "by_team" varchar(255) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" timestamp(0),
  "updater" int8,
  "update_date" timestamp(0),
  "by_status" varchar(16) COLLATE "pg_catalog"."default",
  "by_no" varchar(64) COLLATE "pg_catalog"."default",
  "by_plan_time" timestamp(6),
  "by_level" varchar(16) COLLATE "pg_catalog"."default",
  "by_user" varchar(255) COLLATE "pg_catalog"."default",
  "by_desc" varchar(255) COLLATE "pg_catalog"."default",
  "things_id" int8,
  "by_template_id" varchar(2000) COLLATE "pg_catalog"."default",
  "remind_time" varchar(64) COLLATE "pg_catalog"."default",
  "plan_status" varchar(16) COLLATE "pg_catalog"."default",
  "loop_type" varchar(16) COLLATE "pg_catalog"."default",
  "loop_cycle" varchar(16) COLLATE "pg_catalog"."default",
  "plan_end_time" timestamp(0),
  "cycle_unit" varchar(20) COLLATE "pg_catalog"."default",
  "remind_time_unit" varchar(20) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8,
  "is_remind" varchar(16) COLLATE "pg_catalog"."default",
  "group_id" int8
)
;
COMMENT ON COLUMN "public"."eq_by_plan"."id" IS 'id';
COMMENT ON COLUMN "public"."eq_by_plan"."by_team" IS '保养班组';
COMMENT ON COLUMN "public"."eq_by_plan"."creator" IS '创建人';
COMMENT ON COLUMN "public"."eq_by_plan"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_by_plan"."updater" IS '更新人';
COMMENT ON COLUMN "public"."eq_by_plan"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_by_plan"."by_status" IS '保养状态';
COMMENT ON COLUMN "public"."eq_by_plan"."by_no" IS '保养单号';
COMMENT ON COLUMN "public"."eq_by_plan"."by_plan_time" IS '保养计划时间';
COMMENT ON COLUMN "public"."eq_by_plan"."by_level" IS '保养级别';
COMMENT ON COLUMN "public"."eq_by_plan"."by_user" IS '保养人员';
COMMENT ON COLUMN "public"."eq_by_plan"."by_desc" IS '保养描述';
COMMENT ON COLUMN "public"."eq_by_plan"."things_id" IS '设备id';
COMMENT ON COLUMN "public"."eq_by_plan"."by_template_id" IS '保养模板id（多个，隔开）';
COMMENT ON COLUMN "public"."eq_by_plan"."remind_time" IS '提醒时间（提前多少天提醒）';
COMMENT ON COLUMN "public"."eq_by_plan"."plan_status" IS '计划状态，是否停用0启用，1停用';
COMMENT ON COLUMN "public"."eq_by_plan"."loop_type" IS '循环类型，0单次 1多次';
COMMENT ON COLUMN "public"."eq_by_plan"."loop_cycle" IS '循环周期（天）';
COMMENT ON COLUMN "public"."eq_by_plan"."plan_end_time" IS '保养计划截止时间';
COMMENT ON COLUMN "public"."eq_by_plan"."cycle_unit" IS '循环周期单位 hour/day';
COMMENT ON COLUMN "public"."eq_by_plan"."remind_time_unit" IS '提醒时间单位 hour/day';
COMMENT ON COLUMN "public"."eq_by_plan"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."eq_by_plan"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."eq_by_plan"."is_remind" IS '是否到期提醒过 0未提醒 1提醒';
COMMENT ON COLUMN "public"."eq_by_plan"."group_id" IS '用户组id';
COMMENT ON TABLE "public"."eq_by_plan" IS '设备保养计划';

-- ----------------------------
-- Table structure for eq_by_plan_part
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_by_plan_part";
CREATE TABLE "public"."eq_by_plan_part" (
  "id" int8 NOT NULL,
  "use_count" varchar(16) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" timestamp(0),
  "updater" int8,
  "update_date" timestamp(0),
  "eq_by_plan_id" int8,
  "eq_part_id" int8
)
;
COMMENT ON COLUMN "public"."eq_by_plan_part"."id" IS 'id';
COMMENT ON COLUMN "public"."eq_by_plan_part"."use_count" IS '更换数量';
COMMENT ON COLUMN "public"."eq_by_plan_part"."creator" IS '创建人';
COMMENT ON COLUMN "public"."eq_by_plan_part"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_by_plan_part"."updater" IS '更新人';
COMMENT ON COLUMN "public"."eq_by_plan_part"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_by_plan_part"."eq_by_plan_id" IS '设备保养计划id';
COMMENT ON COLUMN "public"."eq_by_plan_part"."eq_part_id" IS '设备部件id';
COMMENT ON TABLE "public"."eq_by_plan_part" IS '保养计划部件更换';

-- ----------------------------
-- Table structure for eq_by_template
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_by_template";
CREATE TABLE "public"."eq_by_template" (
  "id" int8 NOT NULL,
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "by_tool" varchar(255) COLLATE "pg_catalog"."default",
  "by_purpose" varchar(16) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6),
  "description" varchar(2000) COLLATE "pg_catalog"."default",
  "device_type_id" int8,
  "dept_id" int8,
  "tenant_code" int8
)
;
COMMENT ON COLUMN "public"."eq_by_template"."name" IS '保养模板';
COMMENT ON COLUMN "public"."eq_by_template"."by_tool" IS '保养工具';
COMMENT ON COLUMN "public"."eq_by_template"."by_purpose" IS '保养目的';
COMMENT ON COLUMN "public"."eq_by_template"."creator" IS '创建者';
COMMENT ON COLUMN "public"."eq_by_template"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_by_template"."updater" IS '更新者';
COMMENT ON COLUMN "public"."eq_by_template"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_by_template"."description" IS '描述';
COMMENT ON COLUMN "public"."eq_by_template"."device_type_id" IS '设备类型id';
COMMENT ON COLUMN "public"."eq_by_template"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."eq_by_template"."tenant_code" IS '租户编码';
COMMENT ON TABLE "public"."eq_by_template" IS '保养模板';

-- ----------------------------
-- Table structure for eq_by_template_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_by_template_detail";
CREATE TABLE "public"."eq_by_template_detail" (
  "id" int8 NOT NULL,
  "by_template_id" int8,
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "description" varchar(255) COLLATE "pg_catalog"."default",
  "bw_no" varchar(16) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6)
)
;
COMMENT ON COLUMN "public"."eq_by_template_detail"."by_template_id" IS '保养模板id';
COMMENT ON COLUMN "public"."eq_by_template_detail"."name" IS '部位名称';
COMMENT ON COLUMN "public"."eq_by_template_detail"."description" IS '描述';
COMMENT ON COLUMN "public"."eq_by_template_detail"."bw_no" IS '编号';
COMMENT ON COLUMN "public"."eq_by_template_detail"."creator" IS '创建者';
COMMENT ON COLUMN "public"."eq_by_template_detail"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_by_template_detail"."updater" IS '更新者';
COMMENT ON COLUMN "public"."eq_by_template_detail"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."eq_by_template_detail" IS '保养模板明细';

-- ----------------------------
-- Table structure for eq_check_result
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_check_result";
CREATE TABLE "public"."eq_check_result" (
  "id" int8 NOT NULL,
  "check_record_id" int8,
  "type" varchar(5) COLLATE "pg_catalog"."default",
  "check_result" text COLLATE "pg_catalog"."default",
  "thing_id" int8,
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6),
  "check_start" timestamp(6),
  "check_end" timestamp(6),
  "check_status" varchar(5) COLLATE "pg_catalog"."default" DEFAULT 0,
  "check_plan_id" int8
)
;
COMMENT ON COLUMN "public"."eq_check_result"."check_record_id" IS '巡检记录id';
COMMENT ON COLUMN "public"."eq_check_result"."type" IS '1:巡检记录';
COMMENT ON COLUMN "public"."eq_check_result"."check_result" IS '检查结果';
COMMENT ON COLUMN "public"."eq_check_result"."thing_id" IS '设备物id';
COMMENT ON COLUMN "public"."eq_check_result"."creator" IS '创建者';
COMMENT ON COLUMN "public"."eq_check_result"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_check_result"."updater" IS '更新者';
COMMENT ON COLUMN "public"."eq_check_result"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_check_result"."check_start" IS '巡检开始时间';
COMMENT ON COLUMN "public"."eq_check_result"."check_end" IS '巡检结束时间';
COMMENT ON COLUMN "public"."eq_check_result"."check_status" IS '巡检状态 0:未检（一项都没检查判定为未检） 1:已检 2:异常(设备检查项存在未检的或存在异常的判定为异常)';
COMMENT ON COLUMN "public"."eq_check_result"."check_plan_id" IS '巡检计划id';

-- ----------------------------
-- Table structure for eq_check_setting
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_check_setting";
CREATE TABLE "public"."eq_check_setting" (
  "id" int8 NOT NULL,
  "thing_id" int8,
  "standard_id" int8,
  "user_id" int8,
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6),
  "type" varchar(16) COLLATE "pg_catalog"."default",
  "patrolcheck_plan_id" int8
)
;
COMMENT ON COLUMN "public"."eq_check_setting"."id" IS 'id';
COMMENT ON COLUMN "public"."eq_check_setting"."thing_id" IS '设备id';
COMMENT ON COLUMN "public"."eq_check_setting"."standard_id" IS '标准id';
COMMENT ON COLUMN "public"."eq_check_setting"."user_id" IS '操作人id(弃用)';
COMMENT ON COLUMN "public"."eq_check_setting"."creator" IS '创建者';
COMMENT ON COLUMN "public"."eq_check_setting"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_check_setting"."updater" IS '更新者';
COMMENT ON COLUMN "public"."eq_check_setting"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_check_setting"."type" IS '类型0点检 1巡检';
COMMENT ON COLUMN "public"."eq_check_setting"."patrolcheck_plan_id" IS '巡检计划id';
COMMENT ON TABLE "public"."eq_check_setting" IS '设备检查设置';

-- ----------------------------
-- Table structure for eq_check_standard
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_check_standard";
CREATE TABLE "public"."eq_check_standard" (
  "id" int8 NOT NULL,
  "group_id" int8,
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "check_tool" varchar(255) COLLATE "pg_catalog"."default",
  "check_purpose" varchar(255) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6),
  "tip" varchar(2000) COLLATE "pg_catalog"."default",
  "device_type_id" int8,
  "dept_id" int8,
  "tenant_code" int8
)
;
COMMENT ON COLUMN "public"."eq_check_standard"."group_id" IS '设备分类id';
COMMENT ON COLUMN "public"."eq_check_standard"."name" IS '标准名称';
COMMENT ON COLUMN "public"."eq_check_standard"."check_tool" IS '检查工具';
COMMENT ON COLUMN "public"."eq_check_standard"."check_purpose" IS '检查目的';
COMMENT ON COLUMN "public"."eq_check_standard"."creator" IS '创建者';
COMMENT ON COLUMN "public"."eq_check_standard"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_check_standard"."updater" IS '更新者';
COMMENT ON COLUMN "public"."eq_check_standard"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_check_standard"."tip" IS '备注';
COMMENT ON COLUMN "public"."eq_check_standard"."device_type_id" IS '设备类型id';
COMMENT ON COLUMN "public"."eq_check_standard"."tenant_code" IS '租户code';
COMMENT ON TABLE "public"."eq_check_standard" IS '检查标准';

-- ----------------------------
-- Table structure for eq_check_standard_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_check_standard_detail";
CREATE TABLE "public"."eq_check_standard_detail" (
  "id" int8 NOT NULL,
  "standard_id" int8,
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "reference_value" varchar(255) COLLATE "pg_catalog"."default",
  "upper_limit" varchar(16) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6),
  "lower_limit" varchar(16) COLLATE "pg_catalog"."default",
  "type" varchar(5) COLLATE "pg_catalog"."default",
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "data_gather" varchar(10) COLLATE "pg_catalog"."default",
  "dict_code" varchar(64) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."eq_check_standard_detail"."standard_id" IS '检查标准id';
COMMENT ON COLUMN "public"."eq_check_standard_detail"."name" IS '检查名称';
COMMENT ON COLUMN "public"."eq_check_standard_detail"."reference_value" IS '参考值';
COMMENT ON COLUMN "public"."eq_check_standard_detail"."upper_limit" IS '上限';
COMMENT ON COLUMN "public"."eq_check_standard_detail"."creator" IS '创建者';
COMMENT ON COLUMN "public"."eq_check_standard_detail"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_check_standard_detail"."updater" IS '更新者';
COMMENT ON COLUMN "public"."eq_check_standard_detail"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_check_standard_detail"."lower_limit" IS '下限';
COMMENT ON COLUMN "public"."eq_check_standard_detail"."type" IS '判定类型 0:上下限值判定  1:布尔类型判定 2:采集结果判定';
COMMENT ON COLUMN "public"."eq_check_standard_detail"."remark" IS '备注';
COMMENT ON COLUMN "public"."eq_check_standard_detail"."data_gather" IS '是否采集';
COMMENT ON COLUMN "public"."eq_check_standard_detail"."dict_code" IS '属性编码，多个时逗号隔开';
COMMENT ON TABLE "public"."eq_check_standard_detail" IS '检查标准明细';

-- ----------------------------
-- Table structure for eq_file_delete
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_file_delete";
CREATE TABLE "public"."eq_file_delete" (
  "id" int8 NOT NULL,
  "url" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."eq_file_delete"."id" IS 'oss表id';
COMMENT ON COLUMN "public"."eq_file_delete"."url" IS '文件路径';

-- ----------------------------
-- Table structure for eq_file_manage
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_file_manage";
CREATE TABLE "public"."eq_file_manage" (
  "id" int8 NOT NULL,
  "file_name" varchar(255) COLLATE "pg_catalog"."default",
  "file_type" varchar(5) COLLATE "pg_catalog"."default",
  "file_suffix" varchar(255) COLLATE "pg_catalog"."default",
  "file_path" varchar(255) COLLATE "pg_catalog"."default",
  "parent_id" int8,
  "creator" int8,
  "create_date" timestamp(0),
  "updater" int8,
  "update_date" timestamp(0),
  "file_size" numeric(20,2),
  "file_store_path" varchar(255) COLLATE "pg_catalog"."default",
  "file_id_path" varchar(255) COLLATE "pg_catalog"."default",
  "file_desc" varchar(255) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8
)
;
COMMENT ON COLUMN "public"."eq_file_manage"."file_name" IS '文件名';
COMMENT ON COLUMN "public"."eq_file_manage"."file_type" IS '文件类型 0:目录 1:文件';
COMMENT ON COLUMN "public"."eq_file_manage"."file_suffix" IS '文件后缀 文件类型是1的时候才有值';
COMMENT ON COLUMN "public"."eq_file_manage"."file_path" IS '文件路径';
COMMENT ON COLUMN "public"."eq_file_manage"."parent_id" IS '文件父id';
COMMENT ON COLUMN "public"."eq_file_manage"."creator" IS '创建人';
COMMENT ON COLUMN "public"."eq_file_manage"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_file_manage"."updater" IS '更新人';
COMMENT ON COLUMN "public"."eq_file_manage"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_file_manage"."file_size" IS '文件大小';
COMMENT ON COLUMN "public"."eq_file_manage"."file_store_path" IS '文件实际存储路径';
COMMENT ON COLUMN "public"."eq_file_manage"."file_id_path" IS '文件父级id集合';
COMMENT ON COLUMN "public"."eq_file_manage"."file_desc" IS '文件描述';
COMMENT ON COLUMN "public"."eq_file_manage"."tenant_code" IS '租户code';

-- ----------------------------
-- Table structure for eq_part_record
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_part_record";
CREATE TABLE "public"."eq_part_record" (
  "id" int8 NOT NULL,
  "use_count" varchar(16) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" timestamp(0),
  "updater" int8,
  "update_date" timestamp(0),
  "eq_operate_id" int8,
  "eq_part_id" int8,
  "type" varchar(16) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8
)
;
COMMENT ON COLUMN "public"."eq_part_record"."id" IS 'id';
COMMENT ON COLUMN "public"."eq_part_record"."use_count" IS '更换数量';
COMMENT ON COLUMN "public"."eq_part_record"."creator" IS '创建人';
COMMENT ON COLUMN "public"."eq_part_record"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_part_record"."updater" IS '更新人';
COMMENT ON COLUMN "public"."eq_part_record"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_part_record"."eq_operate_id" IS '设备操作id（例如设备保养，设备维修等）';
COMMENT ON COLUMN "public"."eq_part_record"."eq_part_id" IS '设备部件id';
COMMENT ON COLUMN "public"."eq_part_record"."type" IS '操作类型0设备维修 1设备保养';
COMMENT ON COLUMN "public"."eq_part_record"."dept_id" IS '企业id';
COMMENT ON COLUMN "public"."eq_part_record"."tenant_code" IS '租户code';
COMMENT ON TABLE "public"."eq_part_record" IS '部件使用记录';

-- ----------------------------
-- Table structure for eq_patrol_check_plan
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_patrol_check_plan";
CREATE TABLE "public"."eq_patrol_check_plan" (
  "id" int8 NOT NULL,
  "creator" int8,
  "create_date" timestamp(0),
  "updater" int8,
  "update_date" timestamp(0),
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "check_cycle" int4,
  "plan_start_time" timestamp(0),
  "plan_end_time" timestamp(0),
  "plan_status" varchar(16) COLLATE "pg_catalog"."default",
  "user_id" varchar(255) COLLATE "pg_catalog"."default",
  "remind_time" varchar(16) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8,
  "plan_no" varchar(16) COLLATE "pg_catalog"."default",
  "plan_range_param" int8,
  "check_cycle_unit" varchar(20) COLLATE "pg_catalog"."default",
  "check_end_time" timestamp(6),
  "type" varchar(5) COLLATE "pg_catalog"."default",
  "next_batch_time" timestamp(6),
  "act_user_id" int8,
  "act_check_time" timestamp(6),
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "patrol_check_plan_no" varchar(20) COLLATE "pg_catalog"."default",
  "execute_plan_status" varchar(5) COLLATE "pg_catalog"."default",
  "remind_time_unit" varchar(20) COLLATE "pg_catalog"."default",
  "is_remind" varchar(16) COLLATE "pg_catalog"."default",
  "group_id" int8
)
;
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."id" IS 'id';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."creator" IS '创建人';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."updater" IS '更新人';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."name" IS '巡检计划名称';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."check_cycle" IS '检查周期';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."plan_start_time" IS '计划开始时间';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."plan_end_time" IS '计划结束时间';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."plan_status" IS '计划状态';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."user_id" IS '计划执行人';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."remind_time" IS '提醒时间（计划开始时间前多少天提醒）';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."dept_id" IS '企业id';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."tenant_code" IS '租户code';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."plan_no" IS '巡检计划编号';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."plan_range_param" IS '执行范围设置';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."check_cycle_unit" IS '检查周期单位 hour/day';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."check_end_time" IS '截止时间';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."type" IS '0:单次 1:多次';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."next_batch_time" IS '下次记录批次时间';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."act_user_id" IS '实际巡检人';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."act_check_time" IS '实际巡检时间';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."remark" IS '备注';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."patrol_check_plan_no" IS '巡检计划单号';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."execute_plan_status" IS '执行状态 0：待执行 1：执行中 2：已完成';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."remind_time_unit" IS '提醒时间单位 hour/day';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."is_remind" IS '是否到期提醒过 0未提醒 1提醒';
COMMENT ON COLUMN "public"."eq_patrol_check_plan"."group_id" IS '用户组id';
COMMENT ON TABLE "public"."eq_patrol_check_plan" IS '设备巡检计划';

-- ----------------------------
-- Table structure for eq_patrol_check_record
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_patrol_check_record";
CREATE TABLE "public"."eq_patrol_check_record" (
  "id" int8 NOT NULL,
  "patrol_check_plan_id" int8,
  "user_id" int8,
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6),
  "no_check_device_count" int4,
  "abnormal_device_count" int4,
  "check_start_time" timestamp(6),
  "check_end_time" timestamp(6),
  "tip" varchar(255) COLLATE "pg_catalog"."default",
  "check_time" timestamp(6),
  "check_plan_time" varchar(50) COLLATE "pg_catalog"."default",
  "patrol_check_record_no" varchar(20) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8
)
;
COMMENT ON COLUMN "public"."eq_patrol_check_record"."patrol_check_plan_id" IS '巡检计划id';
COMMENT ON COLUMN "public"."eq_patrol_check_record"."user_id" IS '操作人id';
COMMENT ON COLUMN "public"."eq_patrol_check_record"."creator" IS '创建者';
COMMENT ON COLUMN "public"."eq_patrol_check_record"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_patrol_check_record"."updater" IS '更新者';
COMMENT ON COLUMN "public"."eq_patrol_check_record"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_patrol_check_record"."no_check_device_count" IS '未检设备数';
COMMENT ON COLUMN "public"."eq_patrol_check_record"."abnormal_device_count" IS '异常设备数';
COMMENT ON COLUMN "public"."eq_patrol_check_record"."check_start_time" IS '检查开始时间';
COMMENT ON COLUMN "public"."eq_patrol_check_record"."check_end_time" IS '检查结束时间';
COMMENT ON COLUMN "public"."eq_patrol_check_record"."tip" IS '备注';
COMMENT ON COLUMN "public"."eq_patrol_check_record"."check_time" IS '巡检时间';
COMMENT ON COLUMN "public"."eq_patrol_check_record"."check_plan_time" IS '计划巡检时间';
COMMENT ON COLUMN "public"."eq_patrol_check_record"."patrol_check_record_no" IS '巡检记录单号';
COMMENT ON COLUMN "public"."eq_patrol_check_record"."tenant_code" IS '租户code';
COMMENT ON TABLE "public"."eq_patrol_check_record" IS '设备巡检记录';

-- ----------------------------
-- Table structure for eq_plan_record
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_plan_record";
CREATE TABLE "public"."eq_plan_record" (
  "id" int8 NOT NULL,
  "creator" int8,
  "create_date" timestamp(0),
  "updater" int8,
  "update_date" timestamp(0),
  "plan_start_time" timestamp(0),
  "plan_end_time" timestamp(0),
  "user_id" varchar(255) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8,
  "plan_name" varchar(255) COLLATE "pg_catalog"."default",
  "plan_id" int8,
  "thing_id" int8,
  "handle" varchar(16) COLLATE "pg_catalog"."default",
  "type" varchar(16) COLLATE "pg_catalog"."default",
  "reason" varchar(255) COLLATE "pg_catalog"."default",
  "plan_no" varchar(16) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."eq_plan_record"."id" IS 'id';
COMMENT ON COLUMN "public"."eq_plan_record"."creator" IS '创建人';
COMMENT ON COLUMN "public"."eq_plan_record"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_plan_record"."updater" IS '更新人';
COMMENT ON COLUMN "public"."eq_plan_record"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_plan_record"."plan_start_time" IS '计划开始时间';
COMMENT ON COLUMN "public"."eq_plan_record"."plan_end_time" IS '计划结束时间';
COMMENT ON COLUMN "public"."eq_plan_record"."user_id" IS '计划执行人';
COMMENT ON COLUMN "public"."eq_plan_record"."dept_id" IS '企业id';
COMMENT ON COLUMN "public"."eq_plan_record"."tenant_code" IS '租户code';
COMMENT ON COLUMN "public"."eq_plan_record"."plan_name" IS '计划名称';
COMMENT ON COLUMN "public"."eq_plan_record"."plan_id" IS '计划id';
COMMENT ON COLUMN "public"."eq_plan_record"."thing_id" IS '设备id';
COMMENT ON COLUMN "public"."eq_plan_record"."handle" IS '是否处理 0未处理 1已处理';
COMMENT ON COLUMN "public"."eq_plan_record"."type" IS '计划类型 0保养 1巡检';
COMMENT ON COLUMN "public"."eq_plan_record"."reason" IS '未执行原因';
COMMENT ON COLUMN "public"."eq_plan_record"."plan_no" IS '计划编号';
COMMENT ON TABLE "public"."eq_plan_record" IS '计划未执行记录';

-- ----------------------------
-- Table structure for eq_plan_remind_record
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_plan_remind_record";
CREATE TABLE "public"."eq_plan_remind_record" (
  "id" int8 NOT NULL,
  "creator" int8,
  "create_date" timestamp(0),
  "updater" int8,
  "update_date" timestamp(0),
  "type" varchar(16) COLLATE "pg_catalog"."default",
  "no" varchar(64) COLLATE "pg_catalog"."default",
  "start_time" timestamp(6),
  "end_time" timestamp(6),
  "user_id" varchar(255) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8
)
;
COMMENT ON COLUMN "public"."eq_plan_remind_record"."id" IS 'id';
COMMENT ON COLUMN "public"."eq_plan_remind_record"."creator" IS '创建人';
COMMENT ON COLUMN "public"."eq_plan_remind_record"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_plan_remind_record"."updater" IS '更新人';
COMMENT ON COLUMN "public"."eq_plan_remind_record"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_plan_remind_record"."type" IS '类型0保养计划 1巡检计划';
COMMENT ON COLUMN "public"."eq_plan_remind_record"."no" IS '单号';
COMMENT ON COLUMN "public"."eq_plan_remind_record"."start_time" IS '保养计划时间';
COMMENT ON COLUMN "public"."eq_plan_remind_record"."end_time" IS '计划截止时间';
COMMENT ON COLUMN "public"."eq_plan_remind_record"."user_id" IS '人员id，多个，隔开';
COMMENT ON COLUMN "public"."eq_plan_remind_record"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."eq_plan_remind_record"."tenant_code" IS '租户编码';
COMMENT ON TABLE "public"."eq_plan_remind_record" IS '计划到期提醒记录';

-- ----------------------------
-- Table structure for eq_scrap
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_scrap";
CREATE TABLE "public"."eq_scrap" (
  "id" int8 NOT NULL,
  "creator" int8,
  "create_date" timestamp(0),
  "updater" int8,
  "update_date" timestamp(0),
  "eq_id" int8 NOT NULL,
  "scrap_user_id" int8,
  "examine_user_id" int8,
  "scrap_disposal" varchar(16) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8
)
;
COMMENT ON COLUMN "public"."eq_scrap"."id" IS 'id';
COMMENT ON COLUMN "public"."eq_scrap"."creator" IS '创建人';
COMMENT ON COLUMN "public"."eq_scrap"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_scrap"."updater" IS '更新人';
COMMENT ON COLUMN "public"."eq_scrap"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_scrap"."eq_id" IS '设备id';
COMMENT ON COLUMN "public"."eq_scrap"."scrap_user_id" IS '报废人id';
COMMENT ON COLUMN "public"."eq_scrap"."examine_user_id" IS '审核人id';
COMMENT ON COLUMN "public"."eq_scrap"."scrap_disposal" IS '报废是否处理 0未处理 1已处理';
COMMENT ON COLUMN "public"."eq_scrap"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."eq_scrap"."tenant_code" IS '租户编码';
COMMENT ON TABLE "public"."eq_scrap" IS '设备报废';

-- ----------------------------
-- Table structure for eq_spot_check_plan
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_spot_check_plan";
CREATE TABLE "public"."eq_spot_check_plan" (
  "id" int8 NOT NULL,
  "thing_id" int8,
  "last_check_time" timestamp(6),
  "use_id" varchar(255) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" timestamp(0),
  "updater" int8,
  "update_date" timestamp(0),
  "spot_check_no" varchar(20) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8
)
;
COMMENT ON COLUMN "public"."eq_spot_check_plan"."thing_id" IS '设备thingid';
COMMENT ON COLUMN "public"."eq_spot_check_plan"."last_check_time" IS '上次点检时间';
COMMENT ON COLUMN "public"."eq_spot_check_plan"."use_id" IS '操作人';
COMMENT ON COLUMN "public"."eq_spot_check_plan"."creator" IS '创建人';
COMMENT ON COLUMN "public"."eq_spot_check_plan"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_spot_check_plan"."updater" IS '更新人';
COMMENT ON COLUMN "public"."eq_spot_check_plan"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_spot_check_plan"."spot_check_no" IS '点检计划单号';
COMMENT ON COLUMN "public"."eq_spot_check_plan"."tenant_code" IS '租户code';

-- ----------------------------
-- Table structure for eq_spot_check_record
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_spot_check_record";
CREATE TABLE "public"."eq_spot_check_record" (
  "id" int8 NOT NULL,
  "thing_id" int8,
  "standard_id" int8,
  "user_id" int8,
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6),
  "check_time" timestamp(6),
  "use_time" varchar(16) COLLATE "pg_catalog"."default",
  "check_result" text COLLATE "pg_catalog"."default",
  "tip" varchar(255) COLLATE "pg_catalog"."default",
  "spot_check_id" int8,
  "spot_check_record_no" varchar(20) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8
)
;
COMMENT ON COLUMN "public"."eq_spot_check_record"."thing_id" IS '设备id';
COMMENT ON COLUMN "public"."eq_spot_check_record"."standard_id" IS '标准id（弃用）';
COMMENT ON COLUMN "public"."eq_spot_check_record"."user_id" IS '操作人id';
COMMENT ON COLUMN "public"."eq_spot_check_record"."creator" IS '创建者';
COMMENT ON COLUMN "public"."eq_spot_check_record"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_spot_check_record"."updater" IS '更新者';
COMMENT ON COLUMN "public"."eq_spot_check_record"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_spot_check_record"."check_time" IS '点检时间';
COMMENT ON COLUMN "public"."eq_spot_check_record"."use_time" IS '用时（小时）';
COMMENT ON COLUMN "public"."eq_spot_check_record"."check_result" IS '检查结果';
COMMENT ON COLUMN "public"."eq_spot_check_record"."tip" IS '备注';
COMMENT ON COLUMN "public"."eq_spot_check_record"."spot_check_id" IS '点检计划id';
COMMENT ON COLUMN "public"."eq_spot_check_record"."spot_check_record_no" IS '点检记录单号';
COMMENT ON COLUMN "public"."eq_spot_check_record"."tenant_code" IS '租户code';
COMMENT ON TABLE "public"."eq_spot_check_record" IS '设备点检记录';

-- ----------------------------
-- Table structure for eq_user_group
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_user_group";
CREATE TABLE "public"."eq_user_group" (
  "id" int8 NOT NULL,
  "user_id" varchar(255) COLLATE "pg_catalog"."default",
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" timestamp(0),
  "updater" int8,
  "update_date" timestamp(0),
  "dept_id" int8,
  "tenant_code" int8
)
;
COMMENT ON COLUMN "public"."eq_user_group"."id" IS 'id';
COMMENT ON COLUMN "public"."eq_user_group"."user_id" IS 'usrid,多个，隔开';
COMMENT ON COLUMN "public"."eq_user_group"."name" IS '用户组名';
COMMENT ON COLUMN "public"."eq_user_group"."creator" IS '创建人';
COMMENT ON COLUMN "public"."eq_user_group"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_user_group"."updater" IS '更新人';
COMMENT ON COLUMN "public"."eq_user_group"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_user_group"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."eq_user_group"."tenant_code" IS '租户code';

-- ----------------------------
-- Table structure for eq_wx
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_wx";
CREATE TABLE "public"."eq_wx" (
  "id" int8 NOT NULL,
  "fault_reason" varchar(255) COLLATE "pg_catalog"."default",
  "wx_team" varchar(255) COLLATE "pg_catalog"."default",
  "urgent_level" varchar(16) COLLATE "pg_catalog"."default",
  "shutdown" varchar(16) COLLATE "pg_catalog"."default" DEFAULT 0,
  "creator" int8,
  "create_date" timestamp(0),
  "updater" int8,
  "update_date" timestamp(0),
  "work_desc" varchar(512) COLLATE "pg_catalog"."default",
  "eq_bx_id" int8 NOT NULL,
  "wx_level" varchar(16) COLLATE "pg_catalog"."default",
  "wx_status" varchar(16) COLLATE "pg_catalog"."default",
  "wx_no" varchar(64) COLLATE "pg_catalog"."default",
  "shutdown_time" varchar(64) COLLATE "pg_catalog"."default",
  "wx_start_time" timestamp(6),
  "wx_end_time" timestamp(6),
  "wx_fee" varchar(255) COLLATE "pg_catalog"."default",
  "wx_type" varchar(16) COLLATE "pg_catalog"."default",
  "tenant_code" int8
)
;
COMMENT ON COLUMN "public"."eq_wx"."id" IS 'id';
COMMENT ON COLUMN "public"."eq_wx"."fault_reason" IS '故障原因';
COMMENT ON COLUMN "public"."eq_wx"."wx_team" IS '维修班组';
COMMENT ON COLUMN "public"."eq_wx"."urgent_level" IS '紧急程度';
COMMENT ON COLUMN "public"."eq_wx"."shutdown" IS '是否停机；0不停机 1停机，默认0';
COMMENT ON COLUMN "public"."eq_wx"."creator" IS '创建人';
COMMENT ON COLUMN "public"."eq_wx"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_wx"."updater" IS '更新人';
COMMENT ON COLUMN "public"."eq_wx"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_wx"."work_desc" IS '工作描述';
COMMENT ON COLUMN "public"."eq_wx"."eq_bx_id" IS '设备报修id';
COMMENT ON COLUMN "public"."eq_wx"."wx_level" IS '维修级别';
COMMENT ON COLUMN "public"."eq_wx"."wx_status" IS '维修状态';
COMMENT ON COLUMN "public"."eq_wx"."wx_no" IS '维修单号';
COMMENT ON COLUMN "public"."eq_wx"."shutdown_time" IS '停机时长（单位分钟）';
COMMENT ON COLUMN "public"."eq_wx"."wx_start_time" IS '维修开始时间';
COMMENT ON COLUMN "public"."eq_wx"."wx_end_time" IS '维修结束时间';
COMMENT ON COLUMN "public"."eq_wx"."wx_fee" IS '维修费用';
COMMENT ON COLUMN "public"."eq_wx"."wx_type" IS '维修类别';
COMMENT ON COLUMN "public"."eq_wx"."tenant_code" IS '租户编码';
COMMENT ON TABLE "public"."eq_wx" IS '设备维修';

-- ----------------------------
-- Table structure for eq_wx_plan
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_wx_plan";
CREATE TABLE "public"."eq_wx_plan" (
  "id" int8 NOT NULL,
  "wx_team" varchar(255) COLLATE "pg_catalog"."default",
  "urgent_level" varchar(5) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" timestamp(0),
  "updater" int8,
  "update_date" timestamp(0),
  "work_desc" varchar(512) COLLATE "pg_catalog"."default",
  "eq_bx_id" int8,
  "wx_status" varchar(5) COLLATE "pg_catalog"."default",
  "wx_no" varchar(64) COLLATE "pg_catalog"."default",
  "wx_type" varchar(5) COLLATE "pg_catalog"."default",
  "wx_user" varchar(255) COLLATE "pg_catalog"."default",
  "work_time" varchar(5) COLLATE "pg_catalog"."default",
  "thing_id" int8,
  "fault_cause" varchar(5) COLLATE "pg_catalog"."default",
  "wx_level" varchar(5) COLLATE "pg_catalog"."default",
  "stop_status" varchar(5) COLLATE "pg_catalog"."default",
  "stop_time" varchar(20) COLLATE "pg_catalog"."default",
  "start_time" timestamp(6),
  "end_time" timestamp(6),
  "dept_id" int8,
  "tenant_code" int8
)
;
COMMENT ON COLUMN "public"."eq_wx_plan"."id" IS 'id';
COMMENT ON COLUMN "public"."eq_wx_plan"."wx_team" IS '维修班组';
COMMENT ON COLUMN "public"."eq_wx_plan"."urgent_level" IS '紧急程度';
COMMENT ON COLUMN "public"."eq_wx_plan"."creator" IS '创建人';
COMMENT ON COLUMN "public"."eq_wx_plan"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."eq_wx_plan"."updater" IS '更新人';
COMMENT ON COLUMN "public"."eq_wx_plan"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."eq_wx_plan"."work_desc" IS '描述';
COMMENT ON COLUMN "public"."eq_wx_plan"."eq_bx_id" IS '设备报修id';
COMMENT ON COLUMN "public"."eq_wx_plan"."wx_status" IS '维修状态';
COMMENT ON COLUMN "public"."eq_wx_plan"."wx_no" IS '维修单号';
COMMENT ON COLUMN "public"."eq_wx_plan"."wx_type" IS '维修类别';
COMMENT ON COLUMN "public"."eq_wx_plan"."wx_user" IS '维修人员';
COMMENT ON COLUMN "public"."eq_wx_plan"."work_time" IS '工作天数';
COMMENT ON COLUMN "public"."eq_wx_plan"."thing_id" IS '设备物id';
COMMENT ON COLUMN "public"."eq_wx_plan"."fault_cause" IS '故障原因';
COMMENT ON COLUMN "public"."eq_wx_plan"."wx_level" IS '维修级别';
COMMENT ON COLUMN "public"."eq_wx_plan"."stop_status" IS '是否停机 0:不停机 1:停机';
COMMENT ON COLUMN "public"."eq_wx_plan"."stop_time" IS '停机时长';
COMMENT ON COLUMN "public"."eq_wx_plan"."start_time" IS '开始时间';
COMMENT ON COLUMN "public"."eq_wx_plan"."end_time" IS '结束时间';
COMMENT ON COLUMN "public"."eq_wx_plan"."tenant_code" IS '租户code';
COMMENT ON TABLE "public"."eq_wx_plan" IS '设备维修计划';

-- ----------------------------
-- Table structure for eq_wx_replacement
-- ----------------------------
DROP TABLE IF EXISTS "public"."eq_wx_replacement";
CREATE TABLE "public"."eq_wx_replacement" (
  "id" int8 NOT NULL,
  "wx_plan_id" int8,
  "thing_id" int8,
  "use_count" int4
)
;
COMMENT ON COLUMN "public"."eq_wx_replacement"."wx_plan_id" IS '维修记录（计划）id';
COMMENT ON COLUMN "public"."eq_wx_replacement"."thing_id" IS '备件物id';
COMMENT ON COLUMN "public"."eq_wx_replacement"."use_count" IS '使用数量';

-- ----------------------------
-- Table structure for filter_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."filter_log";
CREATE TABLE "public"."filter_log" (
  "id" int8 NOT NULL,
  "filter_rule_id" int8 NOT NULL,
  "formula" varchar(255) COLLATE "pg_catalog"."default",
  "source_info" text COLLATE "pg_catalog"."default" NOT NULL,
  "status" int4 NOT NULL,
  "time" int8,
  "result" bool,
  "error_info" text COLLATE "pg_catalog"."default",
  "calc_count" int4 DEFAULT 0,
  "tenant_code" int8 NOT NULL,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."filter_log"."id" IS '主键';
COMMENT ON COLUMN "public"."filter_log"."filter_rule_id" IS '过滤规则配置表id';
COMMENT ON COLUMN "public"."filter_log"."formula" IS '过滤条件';
COMMENT ON COLUMN "public"."filter_log"."source_info" IS '数据信息，json格式';
COMMENT ON COLUMN "public"."filter_log"."status" IS '计算状态：1-不匹配、2-已匹配、3-计算成功、4-计算异常、5-已通知';
COMMENT ON COLUMN "public"."filter_log"."time" IS '数据时间';
COMMENT ON COLUMN "public"."filter_log"."result" IS '计算结果，只有已计算的记录才有值';
COMMENT ON COLUMN "public"."filter_log"."error_info" IS '错误信息';
COMMENT ON COLUMN "public"."filter_log"."calc_count" IS '计算次数';
COMMENT ON COLUMN "public"."filter_log"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."filter_log"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."filter_log"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."filter_log"."creator" IS '创建人';
COMMENT ON COLUMN "public"."filter_log"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."filter_log"."updater" IS '更新人';
COMMENT ON COLUMN "public"."filter_log"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."filter_log" IS '过滤日志表';

-- ----------------------------
-- Table structure for filter_rule
-- ----------------------------
DROP TABLE IF EXISTS "public"."filter_rule";
CREATE TABLE "public"."filter_rule" (
  "id" int8 NOT NULL,
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "formula" varchar(255) COLLATE "pg_catalog"."default",
  "formula_description" varchar(255) COLLATE "pg_catalog"."default",
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "enable" bool,
  "tenant_code" int8 NOT NULL,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."filter_rule"."id" IS '主键';
COMMENT ON COLUMN "public"."filter_rule"."name" IS '过滤规则名称';
COMMENT ON COLUMN "public"."filter_rule"."formula" IS '计算公式';
COMMENT ON COLUMN "public"."filter_rule"."formula_description" IS '计算公式中文描述';
COMMENT ON COLUMN "public"."filter_rule"."remark" IS '备注';
COMMENT ON COLUMN "public"."filter_rule"."enable" IS '是否启用';
COMMENT ON COLUMN "public"."filter_rule"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."filter_rule"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."filter_rule"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."filter_rule"."creator" IS '创建人';
COMMENT ON COLUMN "public"."filter_rule"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."filter_rule"."updater" IS '更新人';
COMMENT ON COLUMN "public"."filter_rule"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."filter_rule" IS '过滤规则表';

-- ----------------------------
-- Table structure for filter_rule_detail
-- ----------------------------
create table if not exists public.filter_rule_detail
(
    id             bigint primary key,
    filter_rule_id bigint       not null,
    thing_name     varchar(100),
    thing_code     varchar(100) not null,
    attr_name      varchar(100),
    attr_code      varchar(100) not null,
    attr_alias     varchar(10),
    data_type      integer,
    agg_type       varchar(10),
    agg_interval   integer,
    timeunit       varchar(20),
    tenant_code    bigint       not null,
    company_id     bigint,
    dept_id        bigint,
    creator        bigint,
    create_date    bigint,
    updater        bigint,
    update_date    bigint
    );

comment on table public.filter_rule_detail is '过滤规则详情表';
comment on column public.filter_rule_detail.id is '主键';
comment on column public.filter_rule_detail.filter_rule_id is '过滤规则id';
comment on column public.filter_rule_detail.thing_name is '物名称';
comment on column public.filter_rule_detail.thing_code is '物编码';
comment on column public.filter_rule_detail.attr_name is '属性名称';
comment on column public.filter_rule_detail.attr_code is '属性编码';
comment on column public.filter_rule_detail.attr_alias is '属性在计算公式中的别名';
comment on column public.filter_rule_detail.data_type is '数据类型：1-最新，2-最近, 3-区间';
comment on column public.filter_rule_detail.agg_type is '聚合类型：SUM|AVG|MAX|MIN|COUNT';
comment on column public.filter_rule_detail.agg_interval is '聚合时间间隔';
comment on column public.filter_rule_detail.timeunit is '聚合时间单位：MINUTE|HOUR|DAY|MONTH';
comment on column public.filter_rule_detail.tenant_code is '租户编码';
comment on column public.filter_rule_detail.company_id is '企业id';
comment on column public.filter_rule_detail.dept_id is '部门id';
comment on column public.filter_rule_detail.creator is '创建人';
comment on column public.filter_rule_detail.create_date is '创建时间';
comment on column public.filter_rule_detail.updater is '更新人';
comment on column public.filter_rule_detail.update_date is '更新时间';



-- ----------------------------
-- Table structure for gateway_component
-- ----------------------------
DROP TABLE IF EXISTS "public"."gateway_component";
CREATE TABLE "public"."gateway_component" (
  "id" int8 NOT NULL,
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "type" varchar(255) COLLATE "pg_catalog"."default",
  "description" varchar(500) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."gateway_component"."id" IS '主键';
COMMENT ON COLUMN "public"."gateway_component"."name" IS '组件名称';
COMMENT ON COLUMN "public"."gateway_component"."type" IS '组件类型';
COMMENT ON COLUMN "public"."gateway_component"."description" IS '组件描述';
COMMENT ON TABLE "public"."gateway_component" IS '网关组件';

-- ----------------------------
-- Table structure for gateway_component_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."gateway_component_config";
CREATE TABLE "public"."gateway_component_config" (
  "id" int8 NOT NULL,
  "cmpt_id" int8,
  "cmpt_cfg_name" varchar(255) COLLATE "pg_catalog"."default",
  "cmpt_cfg_context" text COLLATE "pg_catalog"."default",
  "max_instance_num" int4,
  "active" int4
)
;
COMMENT ON COLUMN "public"."gateway_component_config"."id" IS '主键';
COMMENT ON COLUMN "public"."gateway_component_config"."cmpt_id" IS '组件id';
COMMENT ON COLUMN "public"."gateway_component_config"."cmpt_cfg_name" IS '组件配置名称';
COMMENT ON COLUMN "public"."gateway_component_config"."cmpt_cfg_context" IS '组件配置内容';
COMMENT ON COLUMN "public"."gateway_component_config"."max_instance_num" IS '最大实例运行数';
COMMENT ON COLUMN "public"."gateway_component_config"."active" IS '是否启用';
COMMENT ON TABLE "public"."gateway_component_config" IS '网关组件配置';

-- ----------------------------
-- Table structure for gateway_component_instance
-- ----------------------------
DROP TABLE IF EXISTS "public"."gateway_component_instance";
CREATE TABLE "public"."gateway_component_instance" (
  "id" int8 NOT NULL,
  "cmpt_id" int8,
  "cmpt_type" varchar(255) COLLATE "pg_catalog"."default",
  "cmpt_cfg_id" int8,
  "instance_ip" varchar(50) COLLATE "pg_catalog"."default",
  "instance_name" varchar(100) COLLATE "pg_catalog"."default",
  "instance_status" varchar(100) COLLATE "pg_catalog"."default",
  "start_time" int8,
  "dead_dur" int8
)
;
COMMENT ON COLUMN "public"."gateway_component_instance"."id" IS '主键';
COMMENT ON COLUMN "public"."gateway_component_instance"."cmpt_id" IS '组件id';
COMMENT ON COLUMN "public"."gateway_component_instance"."cmpt_type" IS '组件类型';
COMMENT ON COLUMN "public"."gateway_component_instance"."cmpt_cfg_id" IS '组件配置id';
COMMENT ON COLUMN "public"."gateway_component_instance"."instance_ip" IS '实例ip';
COMMENT ON COLUMN "public"."gateway_component_instance"."instance_name" IS '实例名称';
COMMENT ON COLUMN "public"."gateway_component_instance"."instance_status" IS '实例状态：STARTING, WAITING, RUNNING, RESTARTING, STOP';
COMMENT ON COLUMN "public"."gateway_component_instance"."start_time" IS '实例启动时间';
COMMENT ON COLUMN "public"."gateway_component_instance"."dead_dur" IS '实例宕机时长';
COMMENT ON TABLE "public"."gateway_component_instance" IS '网关组件实例';

-- ----------------------------
-- Table structure for gen_base_class
-- ----------------------------
DROP TABLE IF EXISTS "public"."gen_base_class";
CREATE TABLE "public"."gen_base_class" (
  "id" int8 NOT NULL,
  "package_name" varchar(200) COLLATE "pg_catalog"."default",
  "code" varchar(200) COLLATE "pg_catalog"."default",
  "fields" varchar(200) COLLATE "pg_catalog"."default",
  "remark" varchar(200) COLLATE "pg_catalog"."default",
  "create_date" int8
)
;
COMMENT ON COLUMN "public"."gen_base_class"."id" IS 'id';
COMMENT ON COLUMN "public"."gen_base_class"."package_name" IS '基类包名';
COMMENT ON COLUMN "public"."gen_base_class"."code" IS '基类编码';
COMMENT ON COLUMN "public"."gen_base_class"."fields" IS '基类字段，多个用英文逗号分隔';
COMMENT ON COLUMN "public"."gen_base_class"."remark" IS '备注';
COMMENT ON COLUMN "public"."gen_base_class"."create_date" IS '创建时间';
COMMENT ON TABLE "public"."gen_base_class" IS '基类管理';

-- ----------------------------
-- Table structure for gen_datasource
-- ----------------------------
DROP TABLE IF EXISTS "public"."gen_datasource";
CREATE TABLE "public"."gen_datasource" (
  "id" int8 NOT NULL,
  "db_type" varchar(200) COLLATE "pg_catalog"."default",
  "conn_name" varchar(200) COLLATE "pg_catalog"."default",
  "conn_url" varchar(500) COLLATE "pg_catalog"."default",
  "username" varchar(200) COLLATE "pg_catalog"."default",
  "password" varchar(200) COLLATE "pg_catalog"."default",
  "status" int4,
  "create_date" int8
)
;
COMMENT ON COLUMN "public"."gen_datasource"."id" IS 'id';
COMMENT ON COLUMN "public"."gen_datasource"."db_type" IS '数据库类型 MySQL、Oracle、SQLServer、PostgreSQL';
COMMENT ON COLUMN "public"."gen_datasource"."conn_name" IS '连接名';
COMMENT ON COLUMN "public"."gen_datasource"."conn_url" IS 'URL';
COMMENT ON COLUMN "public"."gen_datasource"."username" IS '用户名';
COMMENT ON COLUMN "public"."gen_datasource"."password" IS '密码';
COMMENT ON COLUMN "public"."gen_datasource"."status" IS '状态  0：启用   1：禁用';
COMMENT ON COLUMN "public"."gen_datasource"."create_date" IS '创建时间';
COMMENT ON TABLE "public"."gen_datasource" IS '数据源管理';

-- ----------------------------
-- Table structure for gen_field_type
-- ----------------------------
DROP TABLE IF EXISTS "public"."gen_field_type";
CREATE TABLE "public"."gen_field_type" (
  "id" int8 NOT NULL,
  "column_type" varchar(200) COLLATE "pg_catalog"."default",
  "attr_type" varchar(200) COLLATE "pg_catalog"."default",
  "package_name" varchar(200) COLLATE "pg_catalog"."default",
  "create_date" int8
)
;
COMMENT ON COLUMN "public"."gen_field_type"."id" IS 'id';
COMMENT ON COLUMN "public"."gen_field_type"."column_type" IS '字段类型';
COMMENT ON COLUMN "public"."gen_field_type"."attr_type" IS '属性类型';
COMMENT ON COLUMN "public"."gen_field_type"."package_name" IS '属性包名';
COMMENT ON COLUMN "public"."gen_field_type"."create_date" IS '创建时间';
COMMENT ON TABLE "public"."gen_field_type" IS '字段类型管理';

-- ----------------------------
-- Table structure for gen_table_field
-- ----------------------------
DROP TABLE IF EXISTS "public"."gen_table_field";
CREATE TABLE "public"."gen_table_field" (
  "id" int8 NOT NULL,
  "table_id" int8,
  "table_name" varchar(200) COLLATE "pg_catalog"."default",
  "column_name" varchar(200) COLLATE "pg_catalog"."default",
  "column_type" varchar(200) COLLATE "pg_catalog"."default",
  "column_comment" varchar(200) COLLATE "pg_catalog"."default",
  "attr_name" varchar(200) COLLATE "pg_catalog"."default",
  "attr_type" varchar(200) COLLATE "pg_catalog"."default",
  "package_name" varchar(200) COLLATE "pg_catalog"."default",
  "is_pk" bool,
  "is_required" bool,
  "is_form" bool,
  "is_list" bool,
  "is_query" bool,
  "query_type" varchar(200) COLLATE "pg_catalog"."default",
  "form_type" varchar(200) COLLATE "pg_catalog"."default",
  "dict_name" varchar(200) COLLATE "pg_catalog"."default",
  "validator_type" varchar(200) COLLATE "pg_catalog"."default",
  "sort" int4
)
;
COMMENT ON COLUMN "public"."gen_table_field"."id" IS 'id';
COMMENT ON COLUMN "public"."gen_table_field"."table_id" IS '表ID';
COMMENT ON COLUMN "public"."gen_table_field"."table_name" IS '表名';
COMMENT ON COLUMN "public"."gen_table_field"."column_name" IS '列名';
COMMENT ON COLUMN "public"."gen_table_field"."column_type" IS '类型';
COMMENT ON COLUMN "public"."gen_table_field"."column_comment" IS '列说明';
COMMENT ON COLUMN "public"."gen_table_field"."attr_name" IS '属性名';
COMMENT ON COLUMN "public"."gen_table_field"."attr_type" IS '属性类型';
COMMENT ON COLUMN "public"."gen_table_field"."package_name" IS '属性包名';
COMMENT ON COLUMN "public"."gen_table_field"."is_pk" IS '是否主键 0：否  1：是';
COMMENT ON COLUMN "public"."gen_table_field"."is_required" IS '是否必填 0：否  1：是';
COMMENT ON COLUMN "public"."gen_table_field"."is_form" IS '是否表单字段 0：否  1：是';
COMMENT ON COLUMN "public"."gen_table_field"."is_list" IS '是否列表字段 0：否  1：是';
COMMENT ON COLUMN "public"."gen_table_field"."is_query" IS '是否查询字段 0：否  1：是';
COMMENT ON COLUMN "public"."gen_table_field"."query_type" IS '查询方式';
COMMENT ON COLUMN "public"."gen_table_field"."form_type" IS '表单类型';
COMMENT ON COLUMN "public"."gen_table_field"."dict_name" IS '字典名称';
COMMENT ON COLUMN "public"."gen_table_field"."validator_type" IS '效验方式';
COMMENT ON COLUMN "public"."gen_table_field"."sort" IS '排序';
COMMENT ON TABLE "public"."gen_table_field" IS '代码生成表列';

-- ----------------------------
-- Table structure for gen_table_info
-- ----------------------------
DROP TABLE IF EXISTS "public"."gen_table_info";
CREATE TABLE "public"."gen_table_info" (
  "id" int8 NOT NULL,
  "table_name" varchar(200) COLLATE "pg_catalog"."default",
  "class_name" varchar(200) COLLATE "pg_catalog"."default",
  "table_comment" varchar(200) COLLATE "pg_catalog"."default",
  "author" varchar(200) COLLATE "pg_catalog"."default",
  "email" varchar(200) COLLATE "pg_catalog"."default",
  "package_name" varchar(200) COLLATE "pg_catalog"."default",
  "version" varchar(200) COLLATE "pg_catalog"."default",
  "backend_path" varchar(500) COLLATE "pg_catalog"."default",
  "frontend_path" varchar(500) COLLATE "pg_catalog"."default",
  "module_name" varchar(200) COLLATE "pg_catalog"."default",
  "sub_module_name" varchar(200) COLLATE "pg_catalog"."default",
  "datasource_id" int8,
  "baseclass_id" int8,
  "create_date" int8
)
;
COMMENT ON COLUMN "public"."gen_table_info"."id" IS 'id';
COMMENT ON COLUMN "public"."gen_table_info"."table_name" IS '表名';
COMMENT ON COLUMN "public"."gen_table_info"."class_name" IS '类名';
COMMENT ON COLUMN "public"."gen_table_info"."table_comment" IS '功能名';
COMMENT ON COLUMN "public"."gen_table_info"."author" IS '作者';
COMMENT ON COLUMN "public"."gen_table_info"."email" IS '邮箱';
COMMENT ON COLUMN "public"."gen_table_info"."package_name" IS '项目包名';
COMMENT ON COLUMN "public"."gen_table_info"."version" IS '项目版本号';
COMMENT ON COLUMN "public"."gen_table_info"."backend_path" IS '后端生成路径';
COMMENT ON COLUMN "public"."gen_table_info"."frontend_path" IS '前端生成路径';
COMMENT ON COLUMN "public"."gen_table_info"."module_name" IS '模块名';
COMMENT ON COLUMN "public"."gen_table_info"."sub_module_name" IS '子模块名';
COMMENT ON COLUMN "public"."gen_table_info"."datasource_id" IS '数据源ID';
COMMENT ON COLUMN "public"."gen_table_info"."baseclass_id" IS '基类ID';
COMMENT ON COLUMN "public"."gen_table_info"."create_date" IS '创建时间';
COMMENT ON TABLE "public"."gen_table_info" IS '代码生成表';

-- ----------------------------
-- Table structure for gen_template
-- ----------------------------
DROP TABLE IF EXISTS "public"."gen_template";
CREATE TABLE "public"."gen_template" (
  "id" int8 NOT NULL,
  "name" varchar(200) COLLATE "pg_catalog"."default",
  "file_name" varchar(200) COLLATE "pg_catalog"."default",
  "content" text COLLATE "pg_catalog"."default",
  "path" varchar(500) COLLATE "pg_catalog"."default",
  "status" int4,
  "create_date" int8
)
;
COMMENT ON COLUMN "public"."gen_template"."id" IS 'id';
COMMENT ON COLUMN "public"."gen_template"."name" IS '名称';
COMMENT ON COLUMN "public"."gen_template"."file_name" IS '文件名';
COMMENT ON COLUMN "public"."gen_template"."content" IS '内容';
COMMENT ON COLUMN "public"."gen_template"."path" IS '生成路径';
COMMENT ON COLUMN "public"."gen_template"."status" IS '状态  0：启用   1：禁用';
COMMENT ON COLUMN "public"."gen_template"."create_date" IS '创建时间';
COMMENT ON TABLE "public"."gen_template" IS '模板管理';

-- ----------------------------
-- Table structure for iot_board_manage
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_board_manage";
CREATE TABLE "public"."iot_board_manage" (
  "id" int8 NOT NULL,
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "type" varchar(255) COLLATE "pg_catalog"."default",
  "thumbnail_url" text COLLATE "pg_catalog"."default",
  "is_template" bool,
  "remarks" varchar(10240) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "background_image" text COLLATE "pg_catalog"."default",
  "preview_url" varchar(2550) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_board_manage"."id" IS '看板id主键';
COMMENT ON COLUMN "public"."iot_board_manage"."name" IS '看板名称';
COMMENT ON COLUMN "public"."iot_board_manage"."type" IS '看板类型';
COMMENT ON COLUMN "public"."iot_board_manage"."thumbnail_url" IS '缩略图url';
COMMENT ON COLUMN "public"."iot_board_manage"."is_template" IS '是否为模板';
COMMENT ON COLUMN "public"."iot_board_manage"."remarks" IS '备注';
COMMENT ON COLUMN "public"."iot_board_manage"."tenant_code" IS '所属企业(租户code)';
COMMENT ON COLUMN "public"."iot_board_manage"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_board_manage"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_board_manage"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_board_manage"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_board_manage"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_board_manage"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_board_manage"."background_image" IS '看板详情的背景图片';
COMMENT ON COLUMN "public"."iot_board_manage"."preview_url" IS '预览url';
COMMENT ON TABLE "public"."iot_board_manage" IS '组态看板管理';

-- ----------------------------
-- Table structure for iot_carbon_bom
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_bom";
CREATE TABLE "public"."iot_carbon_bom" (
  "id" int8,
  "product_id" int8,
  "pid" int8,
  "mcode" varchar(255) COLLATE "pg_catalog"."default",
  "mname" varchar(500) COLLATE "pg_catalog"."default",
  "unit" varchar(50) COLLATE "pg_catalog"."default",
  "weight" numeric(16,4),
  "w_unit" varchar(50) COLLATE "pg_catalog"."default",
  "dosage" numeric(16,4),
  "supplier_code" varchar(255) COLLATE "pg_catalog"."default",
  "supplier_name" varchar(500) COLLATE "pg_catalog"."default",
  "supplier_address" varchar(1024) COLLATE "pg_catalog"."default",
  "cr_id" int8,
  "transport_km" numeric(16,4),
  "mu_use" numeric(16,4),
  "m_type" varchar(255) COLLATE "pg_catalog"."default",
  "reference" varchar(255) COLLATE "pg_catalog"."default",
  "remake" varchar(255) COLLATE "pg_catalog"."default",
  "transport_use" numeric(16,4),
  "mu_final_use" numeric(16,4)
)
;
COMMENT ON COLUMN "public"."iot_carbon_bom"."id" IS '原料id';
COMMENT ON COLUMN "public"."iot_carbon_bom"."product_id" IS '最终产品id';
COMMENT ON COLUMN "public"."iot_carbon_bom"."pid" IS '父物料id';
COMMENT ON COLUMN "public"."iot_carbon_bom"."mcode" IS '原料编码';
COMMENT ON COLUMN "public"."iot_carbon_bom"."mname" IS '原料名称';
COMMENT ON COLUMN "public"."iot_carbon_bom"."unit" IS '原料单位';
COMMENT ON COLUMN "public"."iot_carbon_bom"."weight" IS '原料单件重量';
COMMENT ON COLUMN "public"."iot_carbon_bom"."w_unit" IS '重量重量计量单位';
COMMENT ON COLUMN "public"."iot_carbon_bom"."dosage" IS '原料用量';
COMMENT ON COLUMN "public"."iot_carbon_bom"."supplier_code" IS '供应商编码';
COMMENT ON COLUMN "public"."iot_carbon_bom"."supplier_name" IS '供应商名称';
COMMENT ON COLUMN "public"."iot_carbon_bom"."supplier_address" IS '供应商地址';
COMMENT ON COLUMN "public"."iot_carbon_bom"."cr_id" IS '排放因子库id';
COMMENT ON COLUMN "public"."iot_carbon_bom"."transport_km" IS '运输距离';
COMMENT ON COLUMN "public"."iot_carbon_bom"."mu_use" IS '物料碳排因子';
COMMENT ON COLUMN "public"."iot_carbon_bom"."m_type" IS '原材料类别';
COMMENT ON COLUMN "public"."iot_carbon_bom"."reference" IS '排放因子参考标准';
COMMENT ON COLUMN "public"."iot_carbon_bom"."remake" IS '补充说明';
COMMENT ON COLUMN "public"."iot_carbon_bom"."transport_use" IS '物料运输碳排
原料获取碳排(kg)=物料重量*物料用量*物料排放因子';
COMMENT ON COLUMN "public"."iot_carbon_bom"."mu_final_use" IS '物料使用碳排
原料运输碳排(kg)=物料重量*物料用量*运输距离*运输k排放因子';
COMMENT ON TABLE "public"."iot_carbon_bom" IS '产品bom信息';

-- ----------------------------
-- Table structure for iot_carbon_certificate
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_certificate";
CREATE TABLE "public"."iot_carbon_certificate" (
  "id" int8 NOT NULL,
  "product_id" int8,
  "product_name" varchar(500) COLLATE "pg_catalog"."default",
  "boundary_start" int8,
  "boundary_end" int8,
  "certification_org" varchar(255) COLLATE "pg_catalog"."default",
  "verification_std" varchar(255) COLLATE "pg_catalog"."default",
  "carbon_val" numeric(15,5),
  "stage_percent_json" varchar(255) COLLATE "pg_catalog"."default",
  "certificate_url" varchar(600) COLLATE "pg_catalog"."default",
  "certificate_start" int8,
  "certificate_end" int8,
  "shared" int4,
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."iot_carbon_certificate"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."product_id" IS '产品id';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."product_name" IS '产品名称';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."boundary_start" IS '数据时间边界开始';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."boundary_end" IS '数据时间边界截止';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."certification_org" IS '认证机构';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."verification_std" IS '核查标准';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."carbon_val" IS '产品碳足迹值，单位kce';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."stage_percent_json" IS '生命周期各阶段占比json';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."certificate_url" IS '证书url';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."certificate_start" IS '发证日期';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."certificate_end" IS '证书到期时间';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."shared" IS '是否已共享：0-否，1-是';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."creator" IS '创建人';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."updater" IS '更新人';
COMMENT ON COLUMN "public"."iot_carbon_certificate"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."iot_carbon_certificate" IS '碳足迹证书';

-- ----------------------------
-- Table structure for iot_carbon_energy_variety
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_energy_variety";
CREATE TABLE "public"."iot_carbon_energy_variety" (
  "id" int8 NOT NULL,
  "name" varchar(128) COLLATE "pg_catalog"."default",
  "code" varchar(128) COLLATE "pg_catalog"."default",
  "type" varchar(24) COLLATE "pg_catalog"."default",
  "is_default" varchar(2) COLLATE "pg_catalog"."default",
  "remarks" varchar(2028) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."iot_carbon_energy_variety"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."iot_carbon_energy_variety"."name" IS '能源品种名称
电，水，天然气，蒸汽...';
COMMENT ON COLUMN "public"."iot_carbon_energy_variety"."code" IS '能源品种类型
依靠当前系统定义，如电-A29...';
COMMENT ON COLUMN "public"."iot_carbon_energy_variety"."type" IS '能源排放类别，基础能源  运输能源';
COMMENT ON COLUMN "public"."iot_carbon_energy_variety"."is_default" IS '是否默认，0默认，1自定义，默认数据只有管理员可以操作';
COMMENT ON COLUMN "public"."iot_carbon_energy_variety"."remarks" IS '备注';
COMMENT ON COLUMN "public"."iot_carbon_energy_variety"."tenant_code" IS '企业编码';
COMMENT ON COLUMN "public"."iot_carbon_energy_variety"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_carbon_energy_variety"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_carbon_energy_variety"."creator" IS '创建者id';
COMMENT ON COLUMN "public"."iot_carbon_energy_variety"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_carbon_energy_variety"."updater" IS '更新者id';
COMMENT ON COLUMN "public"."iot_carbon_energy_variety"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."iot_carbon_energy_variety" IS '能源品种基本信息';

-- ----------------------------
-- Table structure for iot_carbon_enterprise_auth
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_enterprise_auth";
CREATE TABLE "public"."iot_carbon_enterprise_auth" (
  "id" int8,
  "username" varchar(50) COLLATE "pg_catalog"."default",
  "password" varchar(50) COLLATE "pg_catalog"."default",
  "tenant_name" varchar(255) COLLATE "pg_catalog"."default",
  "industry_category" varchar(50) COLLATE "pg_catalog"."default",
  "industry_type" varchar(50) COLLATE "pg_catalog"."default",
  "region_code" varchar(32) COLLATE "pg_catalog"."default",
  "address" varchar(1024) COLLATE "pg_catalog"."default",
  "lng_lat" varchar(255) COLLATE "pg_catalog"."default",
  "corporation_code" varchar(32) COLLATE "pg_catalog"."default",
  "business_license" varchar(150) COLLATE "pg_catalog"."default",
  "contact" varchar(20) COLLATE "pg_catalog"."default",
  "contact_number" varchar(20) COLLATE "pg_catalog"."default",
  "email" varchar(320) COLLATE "pg_catalog"."default",
  "status" varchar(4) COLLATE "pg_catalog"."default",
  "opinion" varchar(2048) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."id" IS 'id';
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."username" IS '用户账号';
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."password" IS '用户密码';
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."tenant_name" IS '企业名称';
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."industry_category" IS '行业门类';
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."industry_type" IS '行业大类';
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."region_code" IS '区域编码';
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."address" IS '详细地址';
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."lng_lat" IS '经纬度';
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."corporation_code" IS '统一社会信用编码';
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."business_license" IS '营业执照扫描件';
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."contact" IS '联系人';
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."contact_number" IS '联系电话';
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."email" IS '企业邮箱';
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."status" IS '审核状态';
COMMENT ON COLUMN "public"."iot_carbon_enterprise_auth"."opinion" IS '审核意见';

-- ----------------------------
-- Table structure for iot_carbon_indirect_energy
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_indirect_energy";
CREATE TABLE "public"."iot_carbon_indirect_energy" (
  "id" int8 NOT NULL,
  "ie_code" varchar(255) COLLATE "pg_catalog"."default",
  "ie_name" varchar(500) COLLATE "pg_catalog"."default",
  "ev_id" int8,
  "thing_code" varchar(255) COLLATE "pg_catalog"."default",
  "ratio" numeric(8,4),
  "steps_num" int4,
  "group_id" int8,
  "pr_code" varchar(255) COLLATE "pg_catalog"."default",
  "dosage" numeric(16,6),
  "pr_status" int8,
  "m_id" int8,
  "pr_type" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_carbon_indirect_energy"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."iot_carbon_indirect_energy"."ie_code" IS '间接用能过程编号';
COMMENT ON COLUMN "public"."iot_carbon_indirect_energy"."ie_name" IS '间接用能过程名称';
COMMENT ON COLUMN "public"."iot_carbon_indirect_energy"."ev_id" IS '间接用能能源类型id';
COMMENT ON COLUMN "public"."iot_carbon_indirect_energy"."thing_code" IS '间接用能设备编码/物实体编码';
COMMENT ON COLUMN "public"."iot_carbon_indirect_energy"."ratio" IS '使用比率';
COMMENT ON COLUMN "public"."iot_carbon_indirect_energy"."steps_num" IS '工序数量';
COMMENT ON COLUMN "public"."iot_carbon_indirect_energy"."group_id" IS '提交数据组id';
COMMENT ON COLUMN "public"."iot_carbon_indirect_energy"."pr_code" IS '生产工单编码';
COMMENT ON COLUMN "public"."iot_carbon_indirect_energy"."dosage" IS '用量';
COMMENT ON COLUMN "public"."iot_carbon_indirect_energy"."pr_status" IS '计算状态 1 待计算 2已计算';
COMMENT ON COLUMN "public"."iot_carbon_indirect_energy"."m_id" IS '产品id';
COMMENT ON COLUMN "public"."iot_carbon_indirect_energy"."pr_type" IS '工单类型，1设备/2区间';
COMMENT ON TABLE "public"."iot_carbon_indirect_energy" IS '间接用能配置记录';

-- ----------------------------
-- Table structure for iot_carbon_outbound_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_outbound_config";
CREATE TABLE "public"."iot_carbon_outbound_config" (
  "id" int8 NOT NULL,
  "m_id" int8,
  "m_code" varchar(255) COLLATE "pg_catalog"."default",
  "m_name" varchar(255) COLLATE "pg_catalog"."default",
  "customer_name" varchar(255) COLLATE "pg_catalog"."default",
  "customer_address" varchar(255) COLLATE "pg_catalog"."default",
  "pr_code" varchar(255) COLLATE "pg_catalog"."default",
  "num" int8,
  "outbound_time" date
)
;
COMMENT ON COLUMN "public"."iot_carbon_outbound_config"."id" IS 'id';
COMMENT ON COLUMN "public"."iot_carbon_outbound_config"."m_id" IS '产品id';
COMMENT ON COLUMN "public"."iot_carbon_outbound_config"."m_code" IS '产品编码';
COMMENT ON COLUMN "public"."iot_carbon_outbound_config"."m_name" IS '产品名称';
COMMENT ON COLUMN "public"."iot_carbon_outbound_config"."customer_name" IS '客户名称';
COMMENT ON COLUMN "public"."iot_carbon_outbound_config"."customer_address" IS '客户编码';
COMMENT ON COLUMN "public"."iot_carbon_outbound_config"."pr_code" IS '工单编码';
COMMENT ON COLUMN "public"."iot_carbon_outbound_config"."num" IS '出库数量';
COMMENT ON COLUMN "public"."iot_carbon_outbound_config"."outbound_time" IS '出库时间';

-- ----------------------------
-- Table structure for iot_carbon_process_steps
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_process_steps";
CREATE TABLE "public"."iot_carbon_process_steps" (
  "id" int8 NOT NULL,
  "mid" int8,
  "order_num" int8,
  "process_code" varchar(255) COLLATE "pg_catalog"."default",
  "process_name" varchar(500) COLLATE "pg_catalog"."default",
  "ev_ids" varchar(500) COLLATE "pg_catalog"."default",
  "create_time" int8,
  "node_id" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_carbon_process_steps"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."iot_carbon_process_steps"."mid" IS '物料id';
COMMENT ON COLUMN "public"."iot_carbon_process_steps"."order_num" IS '序号';
COMMENT ON COLUMN "public"."iot_carbon_process_steps"."process_code" IS '工艺工序编码';
COMMENT ON COLUMN "public"."iot_carbon_process_steps"."process_name" IS '工艺工序名称';
COMMENT ON COLUMN "public"."iot_carbon_process_steps"."ev_ids" IS '能源介质id，依赖于能源品种基本信息，多个编码以英文逗号分割';
COMMENT ON COLUMN "public"."iot_carbon_process_steps"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."iot_carbon_process_steps"."node_id" IS '节点id/前端渲染坐标使用';
COMMENT ON TABLE "public"."iot_carbon_process_steps" IS '产品工艺工序配置';

-- ----------------------------
-- Table structure for iot_carbon_production_custom
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_production_custom";
CREATE TABLE "public"."iot_carbon_production_custom" (
  "id" int8 NOT NULL,
  "production_id" int8,
  "title" varchar(2550) COLLATE "pg_catalog"."default",
  "info" varchar(2550) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_carbon_production_custom"."id" IS 'id';
COMMENT ON COLUMN "public"."iot_carbon_production_custom"."production_id" IS '产品id';
COMMENT ON COLUMN "public"."iot_carbon_production_custom"."title" IS '字段名称描述';
COMMENT ON COLUMN "public"."iot_carbon_production_custom"."info" IS '字段信息详情';
COMMENT ON TABLE "public"."iot_carbon_production_custom" IS '产品自定义信息';

-- ----------------------------
-- Table structure for iot_carbon_production_process_variety
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_production_process_variety";
CREATE TABLE "public"."iot_carbon_production_process_variety" (
  "id" int8 NOT NULL,
  "pr_id" int8,
  "pr_code" varchar(500) COLLATE "pg_catalog"."default",
  "m_id" int8,
  "ps_id" int8,
  "ev_id" int8,
  "usage" numeric(16,8),
  "carbon" numeric(16,8),
  "tce" numeric(16,8),
  "type" varchar(4) COLLATE "pg_catalog"."default",
  "final_num" int8
)
;
COMMENT ON COLUMN "public"."iot_carbon_production_process_variety"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."iot_carbon_production_process_variety"."pr_id" IS '生产记录id//间接用能配置id';
COMMENT ON COLUMN "public"."iot_carbon_production_process_variety"."pr_code" IS '生产记录编码';
COMMENT ON COLUMN "public"."iot_carbon_production_process_variety"."m_id" IS '产品id';
COMMENT ON COLUMN "public"."iot_carbon_production_process_variety"."ps_id" IS '工序id';
COMMENT ON COLUMN "public"."iot_carbon_production_process_variety"."ev_id" IS '能源介质id';
COMMENT ON COLUMN "public"."iot_carbon_production_process_variety"."usage" IS '总用量';
COMMENT ON COLUMN "public"."iot_carbon_production_process_variety"."carbon" IS '总碳排';
COMMENT ON COLUMN "public"."iot_carbon_production_process_variety"."tce" IS '总能耗';
COMMENT ON COLUMN "public"."iot_carbon_production_process_variety"."type" IS '类型2 生产 3公摊/间接';
COMMENT ON COLUMN "public"."iot_carbon_production_process_variety"."final_num" IS '最终产成品数量';
COMMENT ON TABLE "public"."iot_carbon_production_process_variety" IS '工单工序用能结果';

-- ----------------------------
-- Table structure for iot_carbon_production_record
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_production_record";
CREATE TABLE "public"."iot_carbon_production_record" (
  "id" int8 NOT NULL,
  "pr_code" varchar(255) COLLATE "pg_catalog"."default",
  "m_id" int8,
  "work_name" varchar(500) COLLATE "pg_catalog"."default",
  "start_time" date,
  "end_time" date,
  "p_num" int8,
  "final_num" int8,
  "ps_id" int8,
  "thing_code" varchar(255) COLLATE "pg_catalog"."default",
  "ev_id" int8,
  "dosage" numeric(16,6),
  "ratio" numeric(5,2),
  "pr_type" varchar(255) COLLATE "pg_catalog"."default",
  "pr_status" int8,
  "remarks" varchar(2028) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "group_id" int8,
  "pr_dur" numeric(8,2)
)
;
COMMENT ON COLUMN "public"."iot_carbon_production_record"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."pr_code" IS '生产记录编码';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."m_id" IS '产品id';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."work_name" IS '生产车间';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."start_time" IS '生产开始时间';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."end_time" IS '生产结束时间';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."p_num" IS '生产数量';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."final_num" IS '成品数量';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."ps_id" IS '工艺工序id';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."thing_code" IS '生产对象/物实体编码';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."ev_id" IS '能源品种id';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."dosage" IS '用量';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."ratio" IS '使用比率';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."pr_type" IS '工单类型1批次接入，2时段录入';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."pr_status" IS '生产记录状态1待计算，2已经计算，3计算异常，4全量计算完毕,5汇总完毕，6汇总异常';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."remarks" IS '备注';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."tenant_code" IS '企业编码';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."creator" IS '创建者id';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."updater" IS '更新者id';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."group_id" IS '提交数据组id';
COMMENT ON COLUMN "public"."iot_carbon_production_record"."pr_dur" IS '生产工时';
COMMENT ON TABLE "public"."iot_carbon_production_record" IS '生产记录';

-- ----------------------------
-- Table structure for iot_carbon_production_report
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_production_report";
CREATE TABLE "public"."iot_carbon_production_report" (
  "id" int8 NOT NULL,
  "product_id" int8,
  "config_id" int8,
  "boundary" varchar(4) COLLATE "pg_catalog"."default",
  "boundary_type" int4,
  "boundary_start" date,
  "boundary_end" date,
  "valid_end_time" int8,
  "total_carbon" numeric(15,5),
  "stage_percent_json" varchar(255) COLLATE "pg_catalog"."default",
  "company_name" varchar(255) COLLATE "pg_catalog"."default",
  "report_code" varchar(100) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."iot_carbon_production_report"."product_id" IS '产品id';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."config_id" IS '碳足报告配置id';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."boundary" IS '系统边界类型：1-摇篮到大门，2-摇篮到坟墓';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."boundary_type" IS '数据边界类型：1-自然月；2-自然年；3-自定义';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."boundary_start" IS '数据边界开始时间';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."boundary_end" IS '数据边界结束时间';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."valid_end_time" IS '报告有效期';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."total_carbon" IS '碳足迹值';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."stage_percent_json" IS '各阶段碳足迹占比';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."company_name" IS '企业名称';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."report_code" IS '报告编号';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."creator" IS '创建人';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."updater" IS '更新人';
COMMENT ON COLUMN "public"."iot_carbon_production_report"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."iot_carbon_production_report" IS '产品碳足迹报告';

-- ----------------------------
-- Table structure for iot_carbon_production_report_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_production_report_config";
CREATE TABLE "public"."iot_carbon_production_report_config" (
  "id" int8 NOT NULL,
  "tenant_code" int8,
  "product_id" int8,
  "boundary_type" int4,
  "boundary_start" int8,
  "boundary_end" int8
)
;
COMMENT ON COLUMN "public"."iot_carbon_production_report_config"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."iot_carbon_production_report_config"."tenant_code" IS '企业租户编码';
COMMENT ON COLUMN "public"."iot_carbon_production_report_config"."product_id" IS '产品id';
COMMENT ON COLUMN "public"."iot_carbon_production_report_config"."boundary_type" IS '数据边界类型：1-自然月；2-自然年；3-自定义';
COMMENT ON COLUMN "public"."iot_carbon_production_report_config"."boundary_start" IS '数据边界开始时间：只有自定义边界才有值';
COMMENT ON COLUMN "public"."iot_carbon_production_report_config"."boundary_end" IS '数据边界结束时间：只有自定义边界才有值';
COMMENT ON TABLE "public"."iot_carbon_production_report_config" IS '碳足迹报告配置';

-- ----------------------------
-- Table structure for iot_carbon_production_result
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_production_result";
CREATE TABLE "public"."iot_carbon_production_result" (
  "id" int8 NOT NULL,
  "m_id" int8,
  "pr_code" varchar(255) COLLATE "pg_catalog"."default",
  "num" int8,
  "ev_id" int8,
  "ev_name" varchar(128) COLLATE "pg_catalog"."default",
  "usage" numeric(16,4),
  "carbon" numeric(16,4),
  "tce" numeric(16,4),
  "carbon_type" varchar(255) COLLATE "pg_catalog"."default",
  "result_type" varchar(4) COLLATE "pg_catalog"."default",
  "boundary" varchar(4) COLLATE "pg_catalog"."default",
  "start_time" date,
  "finish_time" date,
  "json" text COLLATE "pg_catalog"."default",
  "f_unit" varchar(255) COLLATE "pg_catalog"."default",
  "usage_avg" numeric(16,4),
  "carbon_avg" numeric(16,4),
  "p_weight" numeric(16,4),
  "w_unit" varchar(255) COLLATE "pg_catalog"."default",
  "final_num" int8,
  "pr_dur" int4,
  "sync_status" varchar(4) COLLATE "pg_catalog"."default",
  "m_name" varchar(255) COLLATE "pg_catalog"."default",
  "m_code" varchar(255) COLLATE "pg_catalog"."default",
  "m_model" varchar(255) COLLATE "pg_catalog"."default",
  "group_id" int8,
  "f_usage" numeric(16,4),
  "f_carbon" numeric(16,4),
  "f_usage_avg" numeric(16,4),
  "f_carbon_avg" numeric(16,4),
  "f_ev_id" int8,
  "f_ev_name" varchar(255) COLLATE "pg_catalog"."default",
  "life" int4
)
;
COMMENT ON COLUMN "public"."iot_carbon_production_result"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."m_id" IS '产品id';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."pr_code" IS '生产记录编码';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."num" IS '生产数量';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."ev_id" IS '能源品种id';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."ev_name" IS '能源品种名称/运输类型名称/废弃能源品种名称';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."usage" IS '总用量/原材料的时候，这里存运输总碳排/废弃的时候，存废弃能源消耗总量';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."carbon" IS '总碳排/废弃的时候，存废弃能源碳排总量';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."tce" IS '总能耗';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."carbon_type" IS '1 原料碳排,原料运输碳排
2 生产
3 公摊/间接
4 产品运输
5 产品使用
6 产品废弃,产品废弃运输
碳足报告上传得时候，其他类型，直接中文名称录入';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."result_type" IS '同步类型： 1-结果数据 2-过程数据';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."boundary" IS '系统边界： 1-摇篮到大门， 2-摇篮到坟墓';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."start_time" IS '工单开工时间';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."finish_time" IS '完工时间';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."json" IS '详情json，一个类型，一个能源，形成一个详情json';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."f_unit" IS '功能单位计量单位';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."usage_avg" IS '平均用量/原材料的时候，这里存平均运输碳排值/废弃的时候，存废弃能耗平均值';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."carbon_avg" IS '平均碳排/原材料的时候，这里存平均物料碳排/废弃的时候，存废弃碳排平均值';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."p_weight" IS '产品重量';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."w_unit" IS '产品重量计量单位';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."final_num" IS '产成品数量';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."pr_dur" IS '生产时长，小时数';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."sync_status" IS '同步状态，1待同步，2已同步';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."m_name" IS '产品名称';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."m_code" IS '产品编码';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."m_model" IS '产品型号';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."group_id" IS '提交数据组id，产品运输，id相同的时候，说明是一批产品，分段运输';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."f_usage" IS '废弃运输里程';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."f_carbon" IS '废弃运输碳排';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."f_usage_avg" IS '废弃运输里程平均=废弃运输里程，方便处理，冗余字段';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."f_carbon_avg" IS '单件废弃运输碳排';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."f_ev_id" IS '废弃运输类型id';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."f_ev_name" IS '废弃运输类型';
COMMENT ON COLUMN "public"."iot_carbon_production_result"."life" IS '产品使用，使用年限';

-- ----------------------------
-- Table structure for iot_carbon_production_sync
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_production_sync";
CREATE TABLE "public"."iot_carbon_production_sync" (
  "id" int8 NOT NULL,
  "m_id" int8,
  "type" varchar(4) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."iot_carbon_production_sync"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."iot_carbon_production_sync"."m_id" IS '物料id';
COMMENT ON COLUMN "public"."iot_carbon_production_sync"."type" IS '同步类型 1结果数据 2过程数据';
COMMENT ON COLUMN "public"."iot_carbon_production_sync"."tenant_code" IS '所属企业/租户code';
COMMENT ON COLUMN "public"."iot_carbon_production_sync"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_carbon_production_sync"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_carbon_production_sync"."creator" IS '创建者id';
COMMENT ON COLUMN "public"."iot_carbon_production_sync"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_carbon_production_sync"."updater" IS '更新者id';
COMMENT ON COLUMN "public"."iot_carbon_production_sync"."update_date" IS '更新时间';

-- ----------------------------
-- Table structure for iot_carbon_production_variety
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_production_variety";
CREATE TABLE "public"."iot_carbon_production_variety" (
  "id" int8 NOT NULL,
  "code" varchar(2550) COLLATE "pg_catalog"."default",
  "name" varchar(500) COLLATE "pg_catalog"."default",
  "model" varchar(2550) COLLATE "pg_catalog"."default",
  "url" varchar(500) COLLATE "pg_catalog"."default",
  "type" varchar(4) COLLATE "pg_catalog"."default",
  "final_type" varchar(4) COLLATE "pg_catalog"."default",
  "industry" varchar(500) COLLATE "pg_catalog"."default",
  "industry_sub" varchar(500) COLLATE "pg_catalog"."default",
  "fsu" varchar(50) COLLATE "pg_catalog"."default",
  "f_unit" varchar(50) COLLATE "pg_catalog"."default",
  "unit_price" numeric(10,6),
  "p_size" varchar(50) COLLATE "pg_catalog"."default",
  "p_weight" numeric(10,6),
  "w_unit" varchar(50) COLLATE "pg_catalog"."default",
  "boundary" varchar(4) COLLATE "pg_catalog"."default",
  "remarks" varchar(1024) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "source" varchar(2550) COLLATE "pg_catalog"."default",
  "p_size_unit" varchar(53) COLLATE "pg_catalog"."default",
  "steps_url" varchar(2550) COLLATE "pg_catalog"."default",
  "steps_json" varchar(12550) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."code" IS '产品编码';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."name" IS '产品名称';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."model" IS '产品规格型号';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."url" IS '产品图片url';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."type" IS '种类 1成品 2半成品 ';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."final_type" IS '最终成品类型';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."industry" IS '所属行业/产品所属行业';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."industry_sub" IS '产品分类/产品所属行业子类型';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."fsu" IS '功能单位计量标准数';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."f_unit" IS '功能单位计量单位';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."unit_price" IS '单价，产品单价';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."p_size" IS '产品尺寸';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."p_weight" IS '产品重量';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."w_unit" IS '重量计量单位';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."boundary" IS '系统边界，产品碳足迹生命周期边界1.摇篮到大门，2摇篮到坟墓';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."remarks" IS '备注';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."tenant_code" IS '所属企业/租户code';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."creator" IS '创建者id';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."updater" IS '更新者id';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."source" IS '来源';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."p_size_unit" IS '产品尺寸单位';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."steps_url" IS '工序预览图url';
COMMENT ON COLUMN "public"."iot_carbon_production_variety"."steps_json" IS '工序拖拉拽json';
COMMENT ON TABLE "public"."iot_carbon_production_variety" IS '产品基本信息表';

-- ----------------------------
-- Table structure for iot_carbon_ratio
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_ratio";
CREATE TABLE "public"."iot_carbon_ratio" (
  "id" int8,
  "ev_id" int8,
  "unit" varchar(128) COLLATE "pg_catalog"."default",
  "ratio" numeric(24,8),
  "source" varchar(1024) COLLATE "pg_catalog"."default",
  "remarks" varchar(1024) COLLATE "pg_catalog"."default",
  "type" varchar(1024) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "begin_time" date,
  "end_time" date,
  "district" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_carbon_ratio"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."ev_id" IS '能源品种id';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."unit" IS '计量单位';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."ratio" IS '折标媒/碳排系数';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."source" IS '来源';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."remarks" IS '备注';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."type" IS '类型，1碳排，2折标媒';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."tenant_code" IS '所属企业/租户code';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."creator" IS '创建者id';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."updater" IS '更新者id';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."begin_time" IS '适用日期范围开始时间';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."end_time" IS '适用日期范围结束时间';
COMMENT ON COLUMN "public"."iot_carbon_ratio"."district" IS '适用区域';
COMMENT ON TABLE "public"."iot_carbon_ratio" IS '折标煤碳排因子基本信息';

-- ----------------------------
-- Table structure for iot_carbon_share
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_share";
CREATE TABLE "public"."iot_carbon_share" (
  "id" int8 NOT NULL,
  "name" varchar(2550) COLLATE "pg_catalog"."default",
  "url" varchar(2550) COLLATE "pg_catalog"."default",
  "token" varchar(2550) COLLATE "pg_catalog"."default",
  "tenant_code" int8 NOT NULL,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."iot_carbon_share"."id" IS 'id';
COMMENT ON COLUMN "public"."iot_carbon_share"."name" IS '协议名称';
COMMENT ON COLUMN "public"."iot_carbon_share"."url" IS '公共服务地址';
COMMENT ON COLUMN "public"."iot_carbon_share"."token" IS '企业令牌token';
COMMENT ON COLUMN "public"."iot_carbon_share"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."iot_carbon_share"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."iot_carbon_share"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_carbon_share"."creator" IS '创建人';
COMMENT ON COLUMN "public"."iot_carbon_share"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_carbon_share"."updater" IS '更新人';
COMMENT ON COLUMN "public"."iot_carbon_share"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."iot_carbon_share" IS '协议配置详情表';

-- ----------------------------
-- Table structure for iot_carbon_share_details
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_share_details";
CREATE TABLE "public"."iot_carbon_share_details" (
  "id" int8 NOT NULL,
  "type" varchar(255) COLLATE "pg_catalog"."default",
  "m_id" int8,
  "code" varchar(255) COLLATE "pg_catalog"."default",
  "name" varchar(500) COLLATE "pg_catalog"."default",
  "industry" varchar(500) COLLATE "pg_catalog"."default",
  "industry_sub" varchar(500) COLLATE "pg_catalog"."default",
  "boundary" varchar(4) COLLATE "pg_catalog"."default",
  "fsu" varchar(50) COLLATE "pg_catalog"."default",
  "f_unit" varchar(50) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."iot_carbon_share_details"."id" IS 'id';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."type" IS '类型，1结果数据，2过程数据';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."m_id" IS '产品id';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."code" IS '产品编码';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."name" IS '产品名称';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."industry" IS '所属行业/产品所属行业';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."industry_sub" IS '产品分类/产品所属行业子类型';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."boundary" IS '系统边界，产品碳足迹生命周期边界1.摇篮到大门，2摇篮到坟墓';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."fsu" IS '功能单位计量标准数';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."f_unit" IS '功能单位计量单位';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."tenant_code" IS '所属企业/租户code';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."creator" IS '创建者id';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."updater" IS '更新者id';
COMMENT ON COLUMN "public"."iot_carbon_share_details"."update_date" IS '更新时间';

-- ----------------------------
-- Table structure for iot_carbon_use_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_carbon_use_config";
CREATE TABLE "public"."iot_carbon_use_config" (
  "id" int8 NOT NULL,
  "life" numeric(20,10),
  "m_id" int8,
  "ev_id" int8,
  "use" numeric(20,10),
  "unit" varchar(255) COLLATE "pg_catalog"."default",
  "type" varchar(255) COLLATE "pg_catalog"."default",
  "num" int4,
  "customer_name" varchar(255) COLLATE "pg_catalog"."default",
  "customer_address" varchar(255) COLLATE "pg_catalog"."default",
  "pr_code" varchar(255) COLLATE "pg_catalog"."default",
  "f_ev_id" int8,
  "f_km" numeric(20,10),
  "f_unit" varchar(255) COLLATE "pg_catalog"."default",
  "m_code" varchar(255) COLLATE "pg_catalog"."default",
  "m_name" varchar(255) COLLATE "pg_catalog"."default",
  "m_unit" varchar(255) COLLATE "pg_catalog"."default",
  "w_unit" varchar(255) COLLATE "pg_catalog"."default",
  "p_weight" numeric(20,10),
  "group_id" int8
)
;
COMMENT ON COLUMN "public"."iot_carbon_use_config"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."life" IS '使用年限';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."m_id" IS '产品id';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."ev_id" IS '产品使用能源介质id/工单运输能源介质id 废弃能源介质id';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."use" IS '使用能源用量/工单运输里程/废弃能源用量';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."unit" IS '使用能源/运输功能单位';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."type" IS '配置类型1运输配置，2.使用配置，3废弃';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."num" IS '工单运输销售数量-废弃';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."customer_name" IS '客户名称 运输才有';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."customer_address" IS '客户地址 运输才有';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."pr_code" IS '生产记录编码-废弃';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."f_ev_id" IS '废弃运输能源介质id';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."f_km" IS '废弃运输里程';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."f_unit" IS '废弃运输功能单位';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."m_code" IS '产品编码';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."m_name" IS '产品名称';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."m_unit" IS '产品功能单位  件 套 ';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."w_unit" IS '产品重量单位';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."p_weight" IS '产品重量';
COMMENT ON COLUMN "public"."iot_carbon_use_config"."group_id" IS '提交数据组id';
COMMENT ON TABLE "public"."iot_carbon_use_config" IS '产品运输，使用，废弃处理，配置信息';

-- ----------------------------
-- Table structure for iot_configuration_design
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_configuration_design";
CREATE TABLE "public"."iot_configuration_design" (
  "id" int8 NOT NULL,
  "board_manage_id" int8,
  "width" int4,
  "height" int4,
  "background_image" text COLLATE "pg_catalog"."default",
  "background_color" varchar(64) COLLATE "pg_catalog"."default",
  "background_repeat" text COLLATE "pg_catalog"."default",
  "page_name" varchar(255) COLLATE "pg_catalog"."default",
  "device_ratio" varchar(255) COLLATE "pg_catalog"."default",
  "background_size" varchar(32) COLLATE "pg_catalog"."default",
  "picture_data" text COLLATE "pg_catalog"."default",
  "api_set_ids" varchar(255) COLLATE "pg_catalog"."default",
  "is_default_back_img" bool,
  "board_type" varchar COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_configuration_design"."id" IS '主键id';
COMMENT ON COLUMN "public"."iot_configuration_design"."board_manage_id" IS '组态看板id';
COMMENT ON COLUMN "public"."iot_configuration_design"."width" IS '看板宽度';
COMMENT ON COLUMN "public"."iot_configuration_design"."height" IS '看板高度';
COMMENT ON COLUMN "public"."iot_configuration_design"."background_image" IS '背景图片';
COMMENT ON COLUMN "public"."iot_configuration_design"."background_color" IS '背景颜色';
COMMENT ON COLUMN "public"."iot_configuration_design"."background_repeat" IS 'backgroundRepeat';
COMMENT ON COLUMN "public"."iot_configuration_design"."page_name" IS '页面名称';
COMMENT ON COLUMN "public"."iot_configuration_design"."device_ratio" IS 'device_ratio';
COMMENT ON COLUMN "public"."iot_configuration_design"."background_size" IS 'background_size';
COMMENT ON COLUMN "public"."iot_configuration_design"."picture_data" IS '图数据';
COMMENT ON COLUMN "public"."iot_configuration_design"."api_set_ids" IS '超级apiid，多个id以英文逗号,分割';
COMMENT ON COLUMN "public"."iot_configuration_design"."is_default_back_img" IS '组态看板url';
COMMENT ON COLUMN "public"."iot_configuration_design"."board_type" IS 'board_type';
COMMENT ON TABLE "public"."iot_configuration_design" IS '组态设计管理';

-- ----------------------------
-- Table structure for iot_dashboard
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_dashboard";
CREATE TABLE "public"."iot_dashboard" (
  "id" int8 NOT NULL,
  "dashboard_group_id" int8,
  "svg_url" varchar(500) COLLATE "pg_catalog"."default",
  "img_url" varchar(500) COLLATE "pg_catalog"."default",
  "title" varchar(64) COLLATE "pg_catalog"."default",
  "height" varchar(32) COLLATE "pg_catalog"."default",
  "width" varchar(32) COLLATE "pg_catalog"."default",
  "background_color" varchar(64) COLLATE "pg_catalog"."default",
  "background_picture" varchar COLLATE "pg_catalog"."default",
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "sort" int4,
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "type" varchar(5) COLLATE "pg_catalog"."default",
  "scada_url" varchar(25500) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_dashboard"."id" IS 'id';
COMMENT ON COLUMN "public"."iot_dashboard"."dashboard_group_id" IS '看板管理id';
COMMENT ON COLUMN "public"."iot_dashboard"."svg_url" IS 'svg图片地址';
COMMENT ON COLUMN "public"."iot_dashboard"."img_url" IS '图片地址';
COMMENT ON COLUMN "public"."iot_dashboard"."title" IS '标题';
COMMENT ON COLUMN "public"."iot_dashboard"."height" IS '高度';
COMMENT ON COLUMN "public"."iot_dashboard"."width" IS '宽度';
COMMENT ON COLUMN "public"."iot_dashboard"."background_color" IS '背景颜色';
COMMENT ON COLUMN "public"."iot_dashboard"."background_picture" IS '背景图片';
COMMENT ON COLUMN "public"."iot_dashboard"."remark" IS '描述';
COMMENT ON COLUMN "public"."iot_dashboard"."sort" IS '序号';
COMMENT ON COLUMN "public"."iot_dashboard"."tenant_code" IS '所属企业(租户code)';
COMMENT ON COLUMN "public"."iot_dashboard"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_dashboard"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_dashboard"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_dashboard"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_dashboard"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_dashboard"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_dashboard"."type" IS '看板类型';
COMMENT ON COLUMN "public"."iot_dashboard"."scada_url" IS '组态看板url';
COMMENT ON TABLE "public"."iot_dashboard" IS '看板表';

-- ----------------------------
-- Table structure for iot_dashboard_element
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_dashboard_element";
CREATE TABLE "public"."iot_dashboard_element" (
  "id" int8 NOT NULL,
  "dashboard_id" int8,
  "element_id" varchar(255) COLLATE "pg_catalog"."default",
  "element_name" varchar(255) COLLATE "pg_catalog"."default",
  "thing_code" varchar(64) COLLATE "pg_catalog"."default",
  "attr_code" varchar(64) COLLATE "pg_catalog"."default",
  "configuration_data" varchar COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "unit" varchar(10) COLLATE "pg_catalog"."default",
  "calculate_body" varchar COLLATE "pg_catalog"."default",
  "control_config" varchar(10) COLLATE "pg_catalog"."default",
  "control_style" varchar(255) COLLATE "pg_catalog"."default",
  "control_device" varchar(255) COLLATE "pg_catalog"."default",
  "control_device_attr" varchar(50) COLLATE "pg_catalog"."default",
  "control_cmd_id" int8,
  "control_permissions" varchar(5000) COLLATE "pg_catalog"."default",
  "control_relation" varchar(500) COLLATE "pg_catalog"."default",
  "thing_id" int8
)
;
COMMENT ON COLUMN "public"."iot_dashboard_element"."id" IS 'id';
COMMENT ON COLUMN "public"."iot_dashboard_element"."dashboard_id" IS '看板id';
COMMENT ON COLUMN "public"."iot_dashboard_element"."element_id" IS '元素id';
COMMENT ON COLUMN "public"."iot_dashboard_element"."element_name" IS '元素名称';
COMMENT ON COLUMN "public"."iot_dashboard_element"."thing_code" IS '映射物';
COMMENT ON COLUMN "public"."iot_dashboard_element"."attr_code" IS '映射属性';
COMMENT ON COLUMN "public"."iot_dashboard_element"."configuration_data" IS '配置';
COMMENT ON COLUMN "public"."iot_dashboard_element"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_dashboard_element"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_dashboard_element"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_dashboard_element"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_dashboard_element"."unit" IS '单位';
COMMENT ON COLUMN "public"."iot_dashboard_element"."calculate_body" IS '计算体';
COMMENT ON COLUMN "public"."iot_dashboard_element"."control_config" IS '控制配置，0-开启，1-关闭';
COMMENT ON COLUMN "public"."iot_dashboard_element"."control_style" IS '控制样式';
COMMENT ON COLUMN "public"."iot_dashboard_element"."control_device" IS '控制设备';
COMMENT ON COLUMN "public"."iot_dashboard_element"."control_device_attr" IS '控制设备属性';
COMMENT ON COLUMN "public"."iot_dashboard_element"."control_cmd_id" IS '控制指令';
COMMENT ON COLUMN "public"."iot_dashboard_element"."control_permissions" IS '控制权限';
COMMENT ON COLUMN "public"."iot_dashboard_element"."control_relation" IS '对应关系';
COMMENT ON COLUMN "public"."iot_dashboard_element"."thing_id" IS '物实体id';
COMMENT ON TABLE "public"."iot_dashboard_element" IS '看板元素表';

-- ----------------------------
-- Table structure for iot_dashboard_group
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_dashboard_group";
CREATE TABLE "public"."iot_dashboard_group" (
  "id" int8 NOT NULL,
  "name" varchar(64) COLLATE "pg_catalog"."default",
  "preview_picture" varchar COLLATE "pg_catalog"."default",
  "exist_menu" varchar(10) COLLATE "pg_catalog"."default",
  "exist_url" varchar(10) COLLATE "pg_catalog"."default",
  "multiple" varchar(10) COLLATE "pg_catalog"."default",
  "slideshow" varchar(10) COLLATE "pg_catalog"."default",
  "slideshow_interval" varchar(10) COLLATE "pg_catalog"."default",
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."iot_dashboard_group"."id" IS 'id';
COMMENT ON COLUMN "public"."iot_dashboard_group"."name" IS '名称';
COMMENT ON COLUMN "public"."iot_dashboard_group"."preview_picture" IS '预览图';
COMMENT ON COLUMN "public"."iot_dashboard_group"."exist_menu" IS '是否配置菜单(0-否,1-是)';
COMMENT ON COLUMN "public"."iot_dashboard_group"."exist_url" IS '是否生成分享地址(0-否,1-是';
COMMENT ON COLUMN "public"."iot_dashboard_group"."multiple" IS '是否是多个看板(0-否,1-是)';
COMMENT ON COLUMN "public"."iot_dashboard_group"."slideshow" IS '是否开启轮播(0-否,1-是)';
COMMENT ON COLUMN "public"."iot_dashboard_group"."slideshow_interval" IS '轮播间隔';
COMMENT ON COLUMN "public"."iot_dashboard_group"."remark" IS '描述';
COMMENT ON COLUMN "public"."iot_dashboard_group"."tenant_code" IS '所属企业(租户code)';
COMMENT ON COLUMN "public"."iot_dashboard_group"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_dashboard_group"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_dashboard_group"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_dashboard_group"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_dashboard_group"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_dashboard_group"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."iot_dashboard_group" IS '看板管理表';

-- ----------------------------
-- Table structure for iot_dashboard_svg
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_dashboard_svg";
CREATE TABLE "public"."iot_dashboard_svg" (
  "id" int8 NOT NULL,
  "dashboard_id" int8,
  "svg_xml" xml,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."iot_dashboard_svg"."id" IS '主键';
COMMENT ON COLUMN "public"."iot_dashboard_svg"."dashboard_id" IS '看板主键';
COMMENT ON COLUMN "public"."iot_dashboard_svg"."svg_xml" IS 'svg';
COMMENT ON COLUMN "public"."iot_dashboard_svg"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_dashboard_svg"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_dashboard_svg"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_dashboard_svg"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."iot_dashboard_svg" IS '看板svg';

-- ----------------------------
-- Table structure for iot_data_entry
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_data_entry";
CREATE TABLE "public"."iot_data_entry" (
  "id" int8 NOT NULL,
  "thing_code" varchar(255) COLLATE "pg_catalog"."default",
  "thing_name" varchar(255) COLLATE "pg_catalog"."default",
  "attr_code" varchar(255) COLLATE "pg_catalog"."default",
  "attr_name" varchar(255) COLLATE "pg_catalog"."default",
  "attr_value" varchar COLLATE "pg_catalog"."default",
  "ts" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8
)
;
COMMENT ON COLUMN "public"."iot_data_entry"."id" IS 'id';
COMMENT ON COLUMN "public"."iot_data_entry"."thing_code" IS '设备编号';
COMMENT ON COLUMN "public"."iot_data_entry"."thing_name" IS '设备名称';
COMMENT ON COLUMN "public"."iot_data_entry"."attr_code" IS '属性编号';
COMMENT ON COLUMN "public"."iot_data_entry"."attr_name" IS '属性名称';
COMMENT ON COLUMN "public"."iot_data_entry"."attr_value" IS '属性值';
COMMENT ON COLUMN "public"."iot_data_entry"."ts" IS '数据时间';
COMMENT ON COLUMN "public"."iot_data_entry"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_data_entry"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_data_entry"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_data_entry"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_data_entry"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."iot_data_entry"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_data_entry"."dept_id" IS '部门id';
COMMENT ON TABLE "public"."iot_data_entry" IS '数据报表';

-- ----------------------------
-- Table structure for iot_device_control
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_device_control";
CREATE TABLE "public"."iot_device_control" (
  "id" int8 NOT NULL,
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "thing_id" int8,
  "attr_code" varchar(20) COLLATE "pg_catalog"."default",
  "extend_id" int8,
  "relation_id" int8,
  "sup_msg" varchar(5000) COLLATE "pg_catalog"."default",
  "query_msg" varchar(5000) COLLATE "pg_catalog"."default",
  "ctl_body" varchar COLLATE "pg_catalog"."default",
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "attr_id" int8,
  "ctl_type" varchar(5) COLLATE "pg_catalog"."default",
  "ctl_json" varchar(10240) COLLATE "pg_catalog"."default",
  "user_list" varchar(2550) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_device_control"."id" IS '主键';
COMMENT ON COLUMN "public"."iot_device_control"."name" IS '控制名称';
COMMENT ON COLUMN "public"."iot_device_control"."thing_id" IS '设备主键';
COMMENT ON COLUMN "public"."iot_device_control"."attr_code" IS '属性编码';
COMMENT ON COLUMN "public"."iot_device_control"."extend_id" IS '通讯主键';
COMMENT ON COLUMN "public"."iot_device_control"."relation_id" IS '通讯关系主键';
COMMENT ON COLUMN "public"."iot_device_control"."sup_msg" IS '辅助参数';
COMMENT ON COLUMN "public"."iot_device_control"."query_msg" IS '查询参数';
COMMENT ON COLUMN "public"."iot_device_control"."ctl_body" IS '控制逻辑';
COMMENT ON COLUMN "public"."iot_device_control"."remark" IS '备注';
COMMENT ON COLUMN "public"."iot_device_control"."tenant_code" IS '所属企业(租户code)';
COMMENT ON COLUMN "public"."iot_device_control"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_device_control"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_device_control"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_device_control"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_device_control"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_device_control"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_device_control"."attr_id" IS '属性id';
COMMENT ON COLUMN "public"."iot_device_control"."ctl_type" IS '控制类型，1图，2切换，3数值';
COMMENT ON COLUMN "public"."iot_device_control"."ctl_json" IS ' 控制样式json 数组json  [
	 *     {
	 *     "no":"123",
	 *     "code":"a001",
	 *     "name":"空调开",
	 *     "url":"/dddd/eee.png"
	 *     },{
	 *     "no":"124",
	 *     "code":"a002",
	 *     "name":"空调关",
	 *     "url":"/dddd/ccc.png"
	 *     }
	 * ]';
COMMENT ON COLUMN "public"."iot_device_control"."user_list" IS '用户列表，多个用户以英文逗号分割';
COMMENT ON TABLE "public"."iot_device_control" IS '设备控制';

-- ----------------------------
-- Table structure for iot_device_control_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_device_control_log";
CREATE TABLE "public"."iot_device_control_log" (
  "id" int8 NOT NULL,
  "control_id" int8,
  "in_msg" varchar COLLATE "pg_catalog"."default",
  "out_msg" varchar COLLATE "pg_catalog"."default",
  "error_msg" varchar COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."iot_device_control_log"."id" IS '主键';
COMMENT ON COLUMN "public"."iot_device_control_log"."control_id" IS '控制主键';
COMMENT ON COLUMN "public"."iot_device_control_log"."in_msg" IS '请求参数';
COMMENT ON COLUMN "public"."iot_device_control_log"."out_msg" IS '输出结果';
COMMENT ON COLUMN "public"."iot_device_control_log"."error_msg" IS '异常信息';
COMMENT ON COLUMN "public"."iot_device_control_log"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_device_control_log"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_device_control_log"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_device_control_log"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."iot_device_control_log" IS '设备控制日志';

-- ----------------------------
-- Table structure for iot_device_management
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_device_management";
CREATE TABLE "public"."iot_device_management" (
  "id" int8 NOT NULL,
  "thing_relation_id" int8,
  "thing_id" int8,
  "thing_code" varchar(255) COLLATE "pg_catalog"."default",
  "thing_name" varchar(255) COLLATE "pg_catalog"."default",
  "thing_attr_code" varchar(255) COLLATE "pg_catalog"."default",
  "thing_attr_name" varchar(255) COLLATE "pg_catalog"."default",
  "thing_attr_unit" varchar(255) COLLATE "pg_catalog"."default",
  "sort" varchar(255) COLLATE "pg_catalog"."default",
  "ctl_id" int8,
  "title" varchar(255) COLLATE "pg_catalog"."default",
  "img" varchar(255) COLLATE "pg_catalog"."default",
  "view_type" varchar(255) COLLATE "pg_catalog"."default",
  "config_type" varchar(255) COLLATE "pg_catalog"."default",
  "thing_attr_boundary" varchar(255) COLLATE "pg_catalog"."default",
  "time_info" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_device_management"."id" IS 'id';
COMMENT ON COLUMN "public"."iot_device_management"."thing_relation_id" IS '物关系id';
COMMENT ON COLUMN "public"."iot_device_management"."thing_id" IS '物实体id';
COMMENT ON COLUMN "public"."iot_device_management"."thing_code" IS '物编码';
COMMENT ON COLUMN "public"."iot_device_management"."thing_name" IS '物名称';
COMMENT ON COLUMN "public"."iot_device_management"."thing_attr_code" IS '物属性编码';
COMMENT ON COLUMN "public"."iot_device_management"."thing_attr_name" IS '物属性名称';
COMMENT ON COLUMN "public"."iot_device_management"."thing_attr_unit" IS '物属性单位';
COMMENT ON COLUMN "public"."iot_device_management"."sort" IS '序号';
COMMENT ON COLUMN "public"."iot_device_management"."ctl_id" IS '控制命令id';
COMMENT ON COLUMN "public"."iot_device_management"."title" IS '属性标题/控制命令标题';
COMMENT ON COLUMN "public"."iot_device_management"."img" IS '图标图片';
COMMENT ON COLUMN "public"."iot_device_management"."view_type" IS '图例类型/自定义方法函数';
COMMENT ON COLUMN "public"."iot_device_management"."config_type" IS '配置类型 1历史数据图例，2最新值图标，3控制';
COMMENT ON COLUMN "public"."iot_device_management"."thing_attr_boundary" IS '上下限JSON{"up":"","down":""}';
COMMENT ON COLUMN "public"."iot_device_management"."time_info" IS '英文逗号分割，如2,3,4 表示2天3小时4分钟';
COMMENT ON TABLE "public"."iot_device_management" IS '设备监控属性配置';

-- ----------------------------
-- Table structure for iot_enterprise_dashboard
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_enterprise_dashboard";
CREATE TABLE "public"."iot_enterprise_dashboard" (
  "id" int8 NOT NULL,
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "large_screen_name" varchar(255) COLLATE "pg_catalog"."default",
  "large_screen_url" varchar(255) COLLATE "pg_catalog"."default",
  "large_screen_type" varchar(255) COLLATE "pg_catalog"."default",
  "detail_json" varchar(1024) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_enterprise_dashboard"."id" IS 'id';
COMMENT ON COLUMN "public"."iot_enterprise_dashboard"."tenant_code" IS '所属企业(租户code)';
COMMENT ON COLUMN "public"."iot_enterprise_dashboard"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_enterprise_dashboard"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_enterprise_dashboard"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_enterprise_dashboard"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_enterprise_dashboard"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_enterprise_dashboard"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_enterprise_dashboard"."large_screen_name" IS '大屏名称';
COMMENT ON COLUMN "public"."iot_enterprise_dashboard"."large_screen_url" IS '背景图片地址';
COMMENT ON COLUMN "public"."iot_enterprise_dashboard"."large_screen_type" IS '大屏类型：
1.只有鸟瞰图
2.鸟瞰图-左、三张看板
3.鸟瞰图-右、三张看板
4.鸟瞰图、6个看板';
COMMENT ON COLUMN "public"."iot_enterprise_dashboard"."detail_json" IS '详情json';
COMMENT ON TABLE "public"."iot_enterprise_dashboard" IS '企业主页配置管理';

-- ----------------------------
-- Table structure for iot_group_info
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_group_info";
CREATE TABLE "public"."iot_group_info" (
  "id" int8 NOT NULL,
  "name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "type" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "business_type" varchar(255) COLLATE "pg_catalog"."default",
  "is_default" int2 NOT NULL DEFAULT 0,
  "thumbnail_url" text COLLATE "pg_catalog"."default",
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "sort" int8 DEFAULT 0
)
;
COMMENT ON COLUMN "public"."iot_group_info"."id" IS 'id';
COMMENT ON COLUMN "public"."iot_group_info"."name" IS '组名称';
COMMENT ON COLUMN "public"."iot_group_info"."type" IS '组类型： thing/attr/tag/relation';
COMMENT ON COLUMN "public"."iot_group_info"."code" IS '组编码';
COMMENT ON COLUMN "public"."iot_group_info"."business_type" IS '组业务类型';
COMMENT ON COLUMN "public"."iot_group_info"."is_default" IS '0 默认 1.自定义';
COMMENT ON COLUMN "public"."iot_group_info"."thumbnail_url" IS '缩略图url';
COMMENT ON COLUMN "public"."iot_group_info"."remark" IS '备注说明';
COMMENT ON COLUMN "public"."iot_group_info"."tenant_code" IS '所属企业(租户code)';
COMMENT ON COLUMN "public"."iot_group_info"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_group_info"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_group_info"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_group_info"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_group_info"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_group_info"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_group_info"."sort" IS '排序';
COMMENT ON TABLE "public"."iot_group_info" IS '物的组信息表';

-- ----------------------------
-- Table structure for iot_group_relation
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_group_relation";
CREATE TABLE "public"."iot_group_relation" (
  "id" int8 NOT NULL,
  "group_id" int8 NOT NULL,
  "entity_id" int8 NOT NULL,
  "entity_type" varchar(64) COLLATE "pg_catalog"."default" NOT NULL
)
;
COMMENT ON COLUMN "public"."iot_group_relation"."id" IS 'id';
COMMENT ON COLUMN "public"."iot_group_relation"."group_id" IS '组id';
COMMENT ON COLUMN "public"."iot_group_relation"."entity_id" IS '实体id 比如thing_entity_id';
COMMENT ON COLUMN "public"."iot_group_relation"."entity_type" IS '实体类型：物实体- thing';
COMMENT ON TABLE "public"."iot_group_relation" IS '实体&组 的关系表';

-- ----------------------------
-- Table structure for iot_section_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_section_detail";
CREATE TABLE "public"."iot_section_detail" (
  "id" int8 NOT NULL,
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "alias_name" varchar(255) COLLATE "pg_catalog"."default",
  "group_id" int8,
  "image" text COLLATE "pg_catalog"."default",
  "image_type" varchar(255) COLLATE "pg_catalog"."default",
  "config" text COLLATE "pg_catalog"."default",
  "js_plugin" text COLLATE "pg_catalog"."default",
  "json" text COLLATE "pg_catalog"."default",
  "css" text COLLATE "pg_catalog"."default",
  "javascript" text COLLATE "pg_catalog"."default",
  "remarks" varchar(1024) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "is_default" bool,
  "section_type" varchar(255) COLLATE "pg_catalog"."default",
  "is_local" bool,
  "is_remote" bool,
  "fake_data" text COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_section_detail"."id" IS '部件id';
COMMENT ON COLUMN "public"."iot_section_detail"."name" IS '部件名称';
COMMENT ON COLUMN "public"."iot_section_detail"."alias_name" IS '部件别名';
COMMENT ON COLUMN "public"."iot_section_detail"."group_id" IS '部件组id';
COMMENT ON COLUMN "public"."iot_section_detail"."image" IS '文件url';
COMMENT ON COLUMN "public"."iot_section_detail"."image_type" IS '文件类型';
COMMENT ON COLUMN "public"."iot_section_detail"."config" IS '部件设置信息';
COMMENT ON COLUMN "public"."iot_section_detail"."js_plugin" IS '部件插件:数组结构';
COMMENT ON COLUMN "public"."iot_section_detail"."json" IS 'json';
COMMENT ON COLUMN "public"."iot_section_detail"."css" IS 'css';
COMMENT ON COLUMN "public"."iot_section_detail"."javascript" IS 'javascript';
COMMENT ON COLUMN "public"."iot_section_detail"."remarks" IS '备注说明';
COMMENT ON COLUMN "public"."iot_section_detail"."tenant_code" IS '所属企业(租户code)';
COMMENT ON COLUMN "public"."iot_section_detail"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_section_detail"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_section_detail"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_section_detail"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_section_detail"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_section_detail"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_section_detail"."is_default" IS '是否默认';
COMMENT ON COLUMN "public"."iot_section_detail"."section_type" IS '数据类型';
COMMENT ON COLUMN "public"."iot_section_detail"."is_local" IS '是否本地';
COMMENT ON COLUMN "public"."iot_section_detail"."is_remote" IS '是否远程';
COMMENT ON COLUMN "public"."iot_section_detail"."fake_data" IS '静态数据';
COMMENT ON TABLE "public"."iot_section_detail" IS '部件管理基本信息';

-- ----------------------------
-- Table structure for iot_source_material
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_source_material";
CREATE TABLE "public"."iot_source_material" (
  "id" int8 NOT NULL,
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "type" varchar(255) COLLATE "pg_catalog"."default",
  "is_default" int4,
  "group_id" int8,
  "image" text COLLATE "pg_catalog"."default",
  "remark" varchar(1024) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "material_file" text COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_source_material"."id" IS '素材id';
COMMENT ON COLUMN "public"."iot_source_material"."name" IS '素材名称';
COMMENT ON COLUMN "public"."iot_source_material"."type" IS '素材文件类型';
COMMENT ON COLUMN "public"."iot_source_material"."is_default" IS '是否默认0是，1否';
COMMENT ON COLUMN "public"."iot_source_material"."group_id" IS '所属素材组id';
COMMENT ON COLUMN "public"."iot_source_material"."image" IS '文件url';
COMMENT ON COLUMN "public"."iot_source_material"."remark" IS '备注说明';
COMMENT ON COLUMN "public"."iot_source_material"."tenant_code" IS '所属企业(租户code)';
COMMENT ON COLUMN "public"."iot_source_material"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_source_material"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_source_material"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_source_material"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_source_material"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_source_material"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_source_material"."material_file" IS '素材文件，svgxml/base64';
COMMENT ON TABLE "public"."iot_source_material" IS '素材管理';

-- ----------------------------
-- Table structure for iot_task
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_task";
CREATE TABLE "public"."iot_task" (
  "id" int8 NOT NULL,
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "type" varchar(5) COLLATE "pg_catalog"."default",
  "time_type" varchar(10) COLLATE "pg_catalog"."default",
  "bean_id" varchar(50) COLLATE "pg_catalog"."default",
  "start_date" timestamp(6),
  "end_date" timestamp(6),
  "func" varchar(500) COLLATE "pg_catalog"."default",
  "extend_data" varchar(255) COLLATE "pg_catalog"."default",
  "cron" varchar(50) COLLATE "pg_catalog"."default",
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6)
)
;
COMMENT ON COLUMN "public"."iot_task"."id" IS '主键';
COMMENT ON COLUMN "public"."iot_task"."name" IS '任务名称';
COMMENT ON COLUMN "public"."iot_task"."type" IS '任务类型';
COMMENT ON COLUMN "public"."iot_task"."time_type" IS '定时类型';
COMMENT ON COLUMN "public"."iot_task"."bean_id" IS 'beanName或控制主键';
COMMENT ON COLUMN "public"."iot_task"."start_date" IS '开始时间';
COMMENT ON COLUMN "public"."iot_task"."end_date" IS '结束时间';
COMMENT ON COLUMN "public"."iot_task"."func" IS '参数方法';
COMMENT ON COLUMN "public"."iot_task"."extend_data" IS '扩展字段,存放具体定时参数';
COMMENT ON COLUMN "public"."iot_task"."cron" IS 'cron表达式';
COMMENT ON COLUMN "public"."iot_task"."remark" IS '备注';
COMMENT ON COLUMN "public"."iot_task"."tenant_code" IS '所属企业(租户code)';
COMMENT ON COLUMN "public"."iot_task"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_task"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_task"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_task"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_task"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_task"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."iot_task" IS '定时任务';

-- ----------------------------
-- Table structure for iot_thing_api
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_thing_api";
CREATE TABLE "public"."iot_thing_api" (
  "id" int8 NOT NULL,
  "name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "thing_condition" text COLLATE "pg_catalog"."default",
  "attr_condition" text COLLATE "pg_catalog"."default",
  "time_condition" text COLLATE "pg_catalog"."default",
  "token" varchar(255) COLLATE "pg_catalog"."default",
  "expire" int8,
  "calls_num" int8 DEFAULT 0,
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "enable_status" varchar(2) COLLATE "pg_catalog"."default" NOT NULL DEFAULT 0,
  "route_url" varchar(500) COLLATE "pg_catalog"."default" NOT NULL,
  "route_id" int8 NOT NULL,
  "sort" varchar(50) COLLATE "pg_catalog"."default",
  "type" varchar(10) COLLATE "pg_catalog"."default" NOT NULL,
  "call_body" text COLLATE "pg_catalog"."default",
  "req_params" text COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_thing_api"."id" IS '主键';
COMMENT ON COLUMN "public"."iot_thing_api"."name" IS 'API名称';
COMMENT ON COLUMN "public"."iot_thing_api"."thing_condition" IS '物的条件查询参数';
COMMENT ON COLUMN "public"."iot_thing_api"."attr_condition" IS '物的属性查询参数';
COMMENT ON COLUMN "public"."iot_thing_api"."time_condition" IS '物的时间查询参数';
COMMENT ON COLUMN "public"."iot_thing_api"."token" IS '查询token';
COMMENT ON COLUMN "public"."iot_thing_api"."expire" IS '过期时间';
COMMENT ON COLUMN "public"."iot_thing_api"."calls_num" IS '调用次数';
COMMENT ON COLUMN "public"."iot_thing_api"."remark" IS '备注';
COMMENT ON COLUMN "public"."iot_thing_api"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."iot_thing_api"."company_id" IS '公司id';
COMMENT ON COLUMN "public"."iot_thing_api"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_thing_api"."creator" IS '创建人';
COMMENT ON COLUMN "public"."iot_thing_api"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_thing_api"."updater" IS '修改人';
COMMENT ON COLUMN "public"."iot_thing_api"."update_date" IS '修改时间';
COMMENT ON COLUMN "public"."iot_thing_api"."enable_status" IS '启用：0未启用1启用';
COMMENT ON COLUMN "public"."iot_thing_api"."route_url" IS '请求路由地址';
COMMENT ON COLUMN "public"."iot_thing_api"."route_id" IS '请求路由id';
COMMENT ON COLUMN "public"."iot_thing_api"."sort" IS '排序:desc asc';
COMMENT ON COLUMN "public"."iot_thing_api"."type" IS '0 组态设计 1超级api';
COMMENT ON COLUMN "public"."iot_thing_api"."call_body" IS '调用体';
COMMENT ON COLUMN "public"."iot_thing_api"."req_params" IS '请求参数';

-- ----------------------------
-- Table structure for iot_thing_api_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_thing_api_log";
CREATE TABLE "public"."iot_thing_api_log" (
  "id" int8 NOT NULL,
  "api_id" int8 NOT NULL,
  "call_entity" text COLLATE "pg_catalog"."default" NOT NULL,
  "creator" int8,
  "create_date" int4,
  "updater" int8,
  "update_date" int4,
  "api_name" varchar(255) COLLATE "pg_catalog"."default",
  "caller" varchar(255) COLLATE "pg_catalog"."default",
  "ip" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_thing_api_log"."id" IS '主键';
COMMENT ON COLUMN "public"."iot_thing_api_log"."api_id" IS '超级apiid';
COMMENT ON COLUMN "public"."iot_thing_api_log"."call_entity" IS '调用体';
COMMENT ON COLUMN "public"."iot_thing_api_log"."creator" IS '调用人';
COMMENT ON COLUMN "public"."iot_thing_api_log"."create_date" IS '调用时间';
COMMENT ON COLUMN "public"."iot_thing_api_log"."updater" IS '更新人';
COMMENT ON COLUMN "public"."iot_thing_api_log"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_thing_api_log"."api_name" IS '调用名称';
COMMENT ON COLUMN "public"."iot_thing_api_log"."caller" IS '调用方';
COMMENT ON COLUMN "public"."iot_thing_api_log"."ip" IS '调用ip';

-- ----------------------------
-- Table structure for iot_thing_base_info
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_thing_base_info";
CREATE TABLE "public"."iot_thing_base_info" (
  "id" int8 NOT NULL,
  "thing_id" int8,
  "standard" varchar(255) COLLATE "pg_catalog"."default",
  "image_url" varchar(255) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6),
  "director" varchar(255) COLLATE "pg_catalog"."default",
  "eq_position" varchar(255) COLLATE "pg_catalog"."default",
  "buy_date" timestamp(6),
  "eq_status" varchar(255) COLLATE "pg_catalog"."default",
  "manufacturer" varchar(255) COLLATE "pg_catalog"."default",
  "supplier" varchar(255) COLLATE "pg_catalog"."default",
  "price" varchar(16) COLLATE "pg_catalog"."default",
  "stock" varchar(16) COLLATE "pg_catalog"."default",
  "use_status" varchar(16) COLLATE "pg_catalog"."default",
  "use_dept_id" int8,
  "operator" varchar(255) COLLATE "pg_catalog"."default",
  "scrap" varchar(16) COLLATE "pg_catalog"."default",
  "scrap_disposal" varchar(16) COLLATE "pg_catalog"."default",
  "ex_factory_no" varchar(64) COLLATE "pg_catalog"."default",
  "ex_factory_date" timestamp(6),
  "params" varchar(255) COLLATE "pg_catalog"."default",
  "unit" varchar(16) COLLATE "pg_catalog"."default",
  "tip" varchar(255) COLLATE "pg_catalog"."default",
  "eq_code" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_thing_base_info"."thing_id" IS '实体id';
COMMENT ON COLUMN "public"."iot_thing_base_info"."standard" IS '设备规格';
COMMENT ON COLUMN "public"."iot_thing_base_info"."image_url" IS '设备图片url';
COMMENT ON COLUMN "public"."iot_thing_base_info"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_thing_base_info"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_thing_base_info"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_thing_base_info"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_thing_base_info"."director" IS '负责人id';
COMMENT ON COLUMN "public"."iot_thing_base_info"."eq_position" IS '设备位置';
COMMENT ON COLUMN "public"."iot_thing_base_info"."buy_date" IS '购置时间';
COMMENT ON COLUMN "public"."iot_thing_base_info"."eq_status" IS '设备状态';
COMMENT ON COLUMN "public"."iot_thing_base_info"."manufacturer" IS '生产厂商';
COMMENT ON COLUMN "public"."iot_thing_base_info"."supplier" IS '供应商';
COMMENT ON COLUMN "public"."iot_thing_base_info"."price" IS '参考价';
COMMENT ON COLUMN "public"."iot_thing_base_info"."stock" IS '库存';
COMMENT ON COLUMN "public"."iot_thing_base_info"."use_status" IS '使用状态';
COMMENT ON COLUMN "public"."iot_thing_base_info"."use_dept_id" IS '使用部门id';
COMMENT ON COLUMN "public"."iot_thing_base_info"."operator" IS '操作人id';
COMMENT ON COLUMN "public"."iot_thing_base_info"."scrap" IS '是否报废 0未报废 1已报废';
COMMENT ON COLUMN "public"."iot_thing_base_info"."scrap_disposal" IS '报废是否处理 0未处理 1已处理';
COMMENT ON COLUMN "public"."iot_thing_base_info"."ex_factory_no" IS '出厂编号';
COMMENT ON COLUMN "public"."iot_thing_base_info"."ex_factory_date" IS '出厂日期';
COMMENT ON COLUMN "public"."iot_thing_base_info"."params" IS '详细参数';
COMMENT ON COLUMN "public"."iot_thing_base_info"."unit" IS '计量单位';
COMMENT ON COLUMN "public"."iot_thing_base_info"."tip" IS '备注';
COMMENT ON COLUMN "public"."iot_thing_base_info"."eq_code" IS '设备编号';
COMMENT ON TABLE "public"."iot_thing_base_info" IS '设备属性信息';

-- ----------------------------
-- Table structure for iot_thing_biz_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_thing_biz_config";
CREATE TABLE "public"."iot_thing_biz_config" (
  "id" int8 NOT NULL,
  "thing_id" int8 NOT NULL,
  "thing_code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "thing_name" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "type" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8
)
;
COMMENT ON COLUMN "public"."iot_thing_biz_config"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."iot_thing_biz_config"."thing_id" IS '物实体id';
COMMENT ON COLUMN "public"."iot_thing_biz_config"."thing_code" IS '物code';
COMMENT ON COLUMN "public"."iot_thing_biz_config"."thing_name" IS '物名称';
COMMENT ON COLUMN "public"."iot_thing_biz_config"."type" IS '配置类型： 暂时只有变压器';
COMMENT ON COLUMN "public"."iot_thing_biz_config"."creator" IS '创建者id';
COMMENT ON COLUMN "public"."iot_thing_biz_config"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_thing_biz_config"."updater" IS '更新者id';
COMMENT ON COLUMN "public"."iot_thing_biz_config"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_thing_biz_config"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."iot_thing_biz_config"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."iot_thing_biz_config"."dept_id" IS '部门id';
COMMENT ON TABLE "public"."iot_thing_biz_config" IS '设备业务配置';

-- ----------------------------
-- Table structure for iot_thing_biz_config_item
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_thing_biz_config_item";
CREATE TABLE "public"."iot_thing_biz_config_item" (
  "id" int8 NOT NULL,
  "config_id" int8 NOT NULL,
  "item_name" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "item_alias" varchar(100) COLLATE "pg_catalog"."default",
  "item_value" varchar(255) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."iot_thing_biz_config_item"."id" IS '数据主键id';
COMMENT ON COLUMN "public"."iot_thing_biz_config_item"."config_id" IS '设备业务配置id';
COMMENT ON COLUMN "public"."iot_thing_biz_config_item"."item_name" IS '配置项名称';
COMMENT ON COLUMN "public"."iot_thing_biz_config_item"."item_alias" IS '配置项别名';
COMMENT ON COLUMN "public"."iot_thing_biz_config_item"."item_value" IS '配置项值';
COMMENT ON COLUMN "public"."iot_thing_biz_config_item"."creator" IS '创建者id';
COMMENT ON COLUMN "public"."iot_thing_biz_config_item"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_thing_biz_config_item"."updater" IS '更新者id';
COMMENT ON COLUMN "public"."iot_thing_biz_config_item"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."iot_thing_biz_config_item" IS '设备业务配置项';

-- ----------------------------
-- Table structure for iot_thing_dict
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_thing_dict";
CREATE TABLE "public"."iot_thing_dict" (
  "id" int8 NOT NULL,
  "code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "name" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "unit" varchar(50) COLLATE "pg_catalog"."default",
  "rate" int4,
  "color" varchar(25) COLLATE "pg_catalog"."default",
  "data_type" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "url" varchar(255) COLLATE "pg_catalog"."default",
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "extend_data" varchar(500) COLLATE "pg_catalog"."default",
  "is_default" int2 NOT NULL DEFAULT 1,
  "sort" int8 NOT NULL,
  "business_type" varchar(255) COLLATE "pg_catalog"."default",
  "group_name" varchar(255) COLLATE "pg_catalog"."default",
  "max_num" numeric,
  "min_num" numeric,
  "ev_type" varchar(255) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8,
  "company_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."iot_thing_dict"."id" IS '主键';
COMMENT ON COLUMN "public"."iot_thing_dict"."code" IS '字典编号';
COMMENT ON COLUMN "public"."iot_thing_dict"."name" IS '字典名称';
COMMENT ON COLUMN "public"."iot_thing_dict"."unit" IS '字典单位';
COMMENT ON COLUMN "public"."iot_thing_dict"."rate" IS '频率(s)';
COMMENT ON COLUMN "public"."iot_thing_dict"."color" IS '颜色';
COMMENT ON COLUMN "public"."iot_thing_dict"."data_type" IS '数据类型: instant - 瞬时
increase - 递增
region - 区间
control - 控制
alarm - 告警';
COMMENT ON COLUMN "public"."iot_thing_dict"."url" IS '图标';
COMMENT ON COLUMN "public"."iot_thing_dict"."remark" IS '备注';
COMMENT ON COLUMN "public"."iot_thing_dict"."extend_data" IS '扩展字段';
COMMENT ON COLUMN "public"."iot_thing_dict"."is_default" IS '是否系统字典：0-默认系统 1-自定义';
COMMENT ON COLUMN "public"."iot_thing_dict"."sort" IS '排序';
COMMENT ON COLUMN "public"."iot_thing_dict"."business_type" IS '监控分析页面默认配置json串';
COMMENT ON COLUMN "public"."iot_thing_dict"."group_name" IS '组名称';
COMMENT ON COLUMN "public"."iot_thing_dict"."max_num" IS '最大值';
COMMENT ON COLUMN "public"."iot_thing_dict"."min_num" IS '最小值';
COMMENT ON COLUMN "public"."iot_thing_dict"."ev_type" IS '能源品种类型';
COMMENT ON COLUMN "public"."iot_thing_dict"."dept_id" IS '部门ID';
COMMENT ON COLUMN "public"."iot_thing_dict"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_thing_dict"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_thing_dict"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_thing_dict"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."iot_thing_dict" IS '物字典信息表';

-- ----------------------------
-- Table structure for iot_thing_dict_relation
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_thing_dict_relation";
CREATE TABLE "public"."iot_thing_dict_relation" (
  "id" int8 NOT NULL,
  "group_name" varchar(255) COLLATE "pg_catalog"."default",
  "code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "name" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "unit" varchar(50) COLLATE "pg_catalog"."default",
  "rate" int4,
  "color" varchar(25) COLLATE "pg_catalog"."default",
  "data_type" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "url" varchar(255) COLLATE "pg_catalog"."default",
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "extend_data" varchar(500) COLLATE "pg_catalog"."default",
  "sort" int8 NOT NULL,
  "business_type" varchar(255) COLLATE "pg_catalog"."default",
  "max_num" numeric,
  "min_num" numeric,
  "entity_id" int8 NOT NULL,
  "ev_type" varchar(255) COLLATE "pg_catalog"."default",
  "entity_code" varchar(500) COLLATE "pg_catalog"."default",
  "entity_name" varchar(500) COLLATE "pg_catalog"."default",
  "template_mark" varchar(2) COLLATE "pg_catalog"."default" NOT NULL DEFAULT 0,
  "data_treating_mark" varchar(2) COLLATE "pg_catalog"."default" DEFAULT 0,
  "child_config" varchar(2048) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8
)
;
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."id" IS '主键';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."group_name" IS '组名称';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."code" IS '字典编号';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."name" IS '字典名称';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."unit" IS '字典单位';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."rate" IS '频率(s)';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."color" IS '颜色';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."data_type" IS '数据类型: instant - 瞬时
increase - 递增
region - 区间
control - 控制
alarm - 告警';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."url" IS '图标';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."remark" IS '备注';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."extend_data" IS '扩展字段';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."sort" IS '排序';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."business_type" IS '监控分析页面默认配置json串';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."max_num" IS '最大值';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."min_num" IS '最小值';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."entity_id" IS '物实体ID';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."ev_type" IS '能源品种类型';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."entity_code" IS '物编码';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."entity_name" IS '物名称';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."template_mark" IS '是否是模板，1模板，0 实体(默认)';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."data_treating_mark" IS '是否为数据处理: 0 否 1 是';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."child_config" IS '映射子集(子数据列表)';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."company_id" IS '公司id';
COMMENT ON COLUMN "public"."iot_thing_dict_relation"."dept_id" IS '部门ID';
COMMENT ON TABLE "public"."iot_thing_dict_relation" IS '物指标信息表';

-- ----------------------------
-- Table structure for iot_thing_entity
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_thing_entity";
CREATE TABLE "public"."iot_thing_entity" (
  "id" int8 NOT NULL,
  "code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "real_type" varchar(2) COLLATE "pg_catalog"."default" NOT NULL DEFAULT 1,
  "template_mark" varchar(2) COLLATE "pg_catalog"."default" NOT NULL DEFAULT 0,
  "type" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "enable_status" varchar(2) COLLATE "pg_catalog"."default" NOT NULL DEFAULT 1,
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "extend_data" text COLLATE "pg_catalog"."default",
  "img" varchar(500) COLLATE "pg_catalog"."default",
  "lon" varchar(255) COLLATE "pg_catalog"."default",
  "lat" varchar(255) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "dept_ids" varchar(2000) COLLATE "pg_catalog"."default",
  "tags" varchar(2000) COLLATE "pg_catalog"."default",
  "dept_id" int8
)
;
COMMENT ON COLUMN "public"."iot_thing_entity"."id" IS '主键ID';
COMMENT ON COLUMN "public"."iot_thing_entity"."code" IS 'thing_code';
COMMENT ON COLUMN "public"."iot_thing_entity"."name" IS '租户内物名称，租户自定义';
COMMENT ON COLUMN "public"."iot_thing_entity"."real_type" IS '租户内物存在类型，0虚拟 1真实';
COMMENT ON COLUMN "public"."iot_thing_entity"."template_mark" IS '是否是模板，1模板，0 实体(默认)';
COMMENT ON COLUMN "public"."iot_thing_entity"."type" IS '物类型';
COMMENT ON COLUMN "public"."iot_thing_entity"."enable_status" IS '启用停用，0停用，1启用，(停用的物，不会再获取数据且不会展示在页面，超管除外)';
COMMENT ON COLUMN "public"."iot_thing_entity"."remark" IS '备注说明';
COMMENT ON COLUMN "public"."iot_thing_entity"."extend_data" IS '拓展字段';
COMMENT ON COLUMN "public"."iot_thing_entity"."img" IS '图片url';
COMMENT ON COLUMN "public"."iot_thing_entity"."lon" IS '经度';
COMMENT ON COLUMN "public"."iot_thing_entity"."lat" IS '纬度';
COMMENT ON COLUMN "public"."iot_thing_entity"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."iot_thing_entity"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_thing_entity"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_thing_entity"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_thing_entity"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_thing_entity"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_thing_entity"."dept_ids" IS '权限分配：部门id';
COMMENT ON COLUMN "public"."iot_thing_entity"."tags" IS '标签';
COMMENT ON TABLE "public"."iot_thing_entity" IS '物实体表';

-- ----------------------------
-- Table structure for iot_thing_menu_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_thing_menu_config";
CREATE TABLE "public"."iot_thing_menu_config" (
  "id" int8 NOT NULL,
  "menu_id" varchar(255) COLLATE "pg_catalog"."default",
  "menu_config" varchar COLLATE "pg_catalog"."default",
  "config_type" varchar(2) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "view_config" text COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_thing_menu_config"."id" IS '主键ID';
COMMENT ON COLUMN "public"."iot_thing_menu_config"."menu_id" IS '菜单ID';
COMMENT ON COLUMN "public"."iot_thing_menu_config"."menu_config" IS '菜单配置信息{thingRelationConfig:[]}';
COMMENT ON COLUMN "public"."iot_thing_menu_config"."config_type" IS '配置类型 例如:监控分析配置,用量分析配置';
COMMENT ON COLUMN "public"."iot_thing_menu_config"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."iot_thing_menu_config"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_thing_menu_config"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_thing_menu_config"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_thing_menu_config"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_thing_menu_config"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_thing_menu_config"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_thing_menu_config"."view_config" IS '监控分析页面默认配置json串';
COMMENT ON TABLE "public"."iot_thing_menu_config" IS '物关系菜单配置表';

-- ----------------------------
-- Table structure for iot_thing_model
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_thing_model";
CREATE TABLE "public"."iot_thing_model" (
  "id" int8 NOT NULL,
  "code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "token" varchar(128) COLLATE "pg_catalog"."default",
  "gateway" varchar(2) COLLATE "pg_catalog"."default" DEFAULT 0,
  "status" varchar(2) COLLATE "pg_catalog"."default" DEFAULT 3,
  "status_ts" int8,
  "auth_num" int8 DEFAULT 0,
  "origin" varchar(128) COLLATE "pg_catalog"."default",
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "extend_data" varchar(255) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "real_type" varchar(2) COLLATE "pg_catalog"."default" NOT NULL DEFAULT 1
)
;
COMMENT ON COLUMN "public"."iot_thing_model"."id" IS 'id';
COMMENT ON COLUMN "public"."iot_thing_model"."code" IS '物编码';
COMMENT ON COLUMN "public"."iot_thing_model"."token" IS 'TB: token';
COMMENT ON COLUMN "public"."iot_thing_model"."gateway" IS '是否网关: 0否1是';
COMMENT ON COLUMN "public"."iot_thing_model"."status" IS '在线离线状态，0离线 1在线 2错误 3未接入';
COMMENT ON COLUMN "public"."iot_thing_model"."status_ts" IS '最新状态改变时间';
COMMENT ON COLUMN "public"."iot_thing_model"."auth_num" IS '被分配到几个租户';
COMMENT ON COLUMN "public"."iot_thing_model"."origin" IS '数据来源';
COMMENT ON COLUMN "public"."iot_thing_model"."remark" IS '备注说明';
COMMENT ON COLUMN "public"."iot_thing_model"."extend_data" IS '备注字段';
COMMENT ON COLUMN "public"."iot_thing_model"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_thing_model"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_thing_model"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_thing_model"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_thing_model"."real_type" IS '租户内物存在类型，0虚拟 1真实';
COMMENT ON TABLE "public"."iot_thing_model" IS '物模型表';

-- ----------------------------
-- Table structure for iot_thing_relation_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_thing_relation_detail";
CREATE TABLE "public"."iot_thing_relation_detail" (
  "id" int8 NOT NULL,
  "from_id" int8 NOT NULL,
  "from_code" varchar(255) COLLATE "pg_catalog"."default",
  "from_name" varchar(255) COLLATE "pg_catalog"."default",
  "to_id" int8 NOT NULL,
  "to_code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "to_name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "root_id" int8 NOT NULL,
  "config" varchar(2048) COLLATE "pg_catalog"."default",
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "sort" int8,
  "root_thing_id" int8,
  "url" varchar(255) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "tag" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."id" IS '主键';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."from_id" IS '上级物实体id';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."from_code" IS '上级物实体code';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."from_name" IS '上级节点名称';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."to_id" IS '下级物实体id';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."to_code" IS '下级物实体code';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."to_name" IS '下级物实体名称';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."root_id" IS '根主键';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."config" IS '其他信息(包含x、y、width、height、shape等)';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."remark" IS '备注';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."sort" IS '排序';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."root_thing_id" IS '根设备id';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."url" IS '图片信息';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."tenant_code" IS '所属企业(租户)';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."iot_thing_relation_detail"."tag" IS '物标签';
COMMENT ON TABLE "public"."iot_thing_relation_detail" IS '物关系详情信息表';

-- ----------------------------
-- Table structure for iot_thing_relation_root
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_thing_relation_root";
CREATE TABLE "public"."iot_thing_relation_root" (
  "id" int8 NOT NULL,
  "name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "remark" varchar(2048) COLLATE "pg_catalog"."default",
  "url" varchar(2048) COLLATE "pg_catalog"."default",
  "config" text COLLATE "pg_catalog"."default",
  "sort" int8 NOT NULL,
  "relation_show" int2 NOT NULL DEFAULT 1,
  "relation_sort" int4,
  "group_name" varchar(255) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."iot_thing_relation_root"."id" IS '主键';
COMMENT ON COLUMN "public"."iot_thing_relation_root"."name" IS '关系名称';
COMMENT ON COLUMN "public"."iot_thing_relation_root"."remark" IS '描述';
COMMENT ON COLUMN "public"."iot_thing_relation_root"."url" IS '图片地址';
COMMENT ON COLUMN "public"."iot_thing_relation_root"."config" IS '关系配置项';
COMMENT ON COLUMN "public"."iot_thing_relation_root"."sort" IS '排序';
COMMENT ON COLUMN "public"."iot_thing_relation_root"."relation_show" IS '是否在物关系显示 0:不展示 1.展示';
COMMENT ON COLUMN "public"."iot_thing_relation_root"."relation_sort" IS '物关系显示排序';
COMMENT ON COLUMN "public"."iot_thing_relation_root"."group_name" IS '组名称';
COMMENT ON COLUMN "public"."iot_thing_relation_root"."tenant_code" IS '所属企业(租户)';
COMMENT ON COLUMN "public"."iot_thing_relation_root"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_thing_relation_root"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_thing_relation_root"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_thing_relation_root"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_thing_relation_root"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_thing_relation_root"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."iot_thing_relation_root" IS '物关系根表';

-- ----------------------------
-- Table structure for iot_thing_source
-- ----------------------------
DROP TABLE IF EXISTS "public"."iot_thing_source";
CREATE TABLE "public"."iot_thing_source" (
  "id" int8 NOT NULL,
  "thing_id" int8 NOT NULL,
  "thing_name" varchar(255) COLLATE "pg_catalog"."default",
  "thing_code" varchar(255) COLLATE "pg_catalog"."default",
  "thing_attr_name" varchar(255) COLLATE "pg_catalog"."default",
  "thing_attr_code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "thing_attr_code_type" varchar(8) COLLATE "pg_catalog"."default",
  "thing_attr_type" varchar(8) COLLATE "pg_catalog"."default",
  "thing_attr_unit" varchar(50) COLLATE "pg_catalog"."default",
  "thing_icon" varchar(255) COLLATE "pg_catalog"."default",
  "thing_serial" varchar(8) COLLATE "pg_catalog"."default",
  "thing_attr_icon" varchar COLLATE "pg_catalog"."default",
  "time_horizon_type" varchar(8) COLLATE "pg_catalog"."default",
  "thing_attr_boundary" varchar COLLATE "pg_catalog"."default",
  "gather_frequency" int8,
  "root_id" int8,
  "config_type" varchar(8) COLLATE "pg_catalog"."default" NOT NULL,
  "data_treating_mark" varchar(8) COLLATE "pg_catalog"."default",
  "data_deal_config" text COLLATE "pg_catalog"."default",
  "show_status" varchar(255) COLLATE "pg_catalog"."default",
  "sort" int8,
  "from_id" int8 NOT NULL,
  "from_code" varchar(255) COLLATE "pg_catalog"."default",
  "from_name" varchar(255) COLLATE "pg_catalog"."default",
  "remark" varchar(128) COLLATE "pg_catalog"."default",
  "extend_data" varchar(256) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."iot_thing_source"."id" IS '主键ID';
COMMENT ON COLUMN "public"."iot_thing_source"."thing_id" IS '物id';
COMMENT ON COLUMN "public"."iot_thing_source"."thing_name" IS '物名称(数据源名称)';
COMMENT ON COLUMN "public"."iot_thing_source"."thing_code" IS '物编码';
COMMENT ON COLUMN "public"."iot_thing_source"."thing_attr_name" IS '物属性名称';
COMMENT ON COLUMN "public"."iot_thing_source"."thing_attr_code" IS '物属性code';
COMMENT ON COLUMN "public"."iot_thing_source"."thing_attr_code_type" IS '物属性code类型(yy mm hh)';
COMMENT ON COLUMN "public"."iot_thing_source"."thing_attr_type" IS '物属性数据类型';
COMMENT ON COLUMN "public"."iot_thing_source"."thing_attr_unit" IS '物属性单位';
COMMENT ON COLUMN "public"."iot_thing_source"."thing_icon" IS '颜色';
COMMENT ON COLUMN "public"."iot_thing_source"."thing_serial" IS '物序号(子数据源数据处理)';
COMMENT ON COLUMN "public"."iot_thing_source"."thing_attr_icon" IS '物属性图标';
COMMENT ON COLUMN "public"."iot_thing_source"."time_horizon_type" IS '时间范围类型';
COMMENT ON COLUMN "public"."iot_thing_source"."thing_attr_boundary" IS '物属性值范围(上限、下限、临界等)';
COMMENT ON COLUMN "public"."iot_thing_source"."gather_frequency" IS '采集频率';
COMMENT ON COLUMN "public"."iot_thing_source"."root_id" IS '根主键';
COMMENT ON COLUMN "public"."iot_thing_source"."config_type" IS '配置类型 例如:
1- 监控分析配置,
2- 用量分析配置
5- 用量统计报表配置
6-碳排统计报表配置
11- 碳排监控设置';
COMMENT ON COLUMN "public"."iot_thing_source"."data_treating_mark" IS '是否为数据处理:0 数据处理 1，不处理';
COMMENT ON COLUMN "public"."iot_thing_source"."data_deal_config" IS '数据处理（前端使用）';
COMMENT ON COLUMN "public"."iot_thing_source"."show_status" IS '是否展示初值终值，0 展示 1 不展示';
COMMENT ON COLUMN "public"."iot_thing_source"."sort" IS '序号';
COMMENT ON COLUMN "public"."iot_thing_source"."from_id" IS '源物id';
COMMENT ON COLUMN "public"."iot_thing_source"."from_code" IS '源物code';
COMMENT ON COLUMN "public"."iot_thing_source"."remark" IS '备注说明';
COMMENT ON COLUMN "public"."iot_thing_source"."extend_data" IS '拓展字段';
COMMENT ON COLUMN "public"."iot_thing_source"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."iot_thing_source"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."iot_thing_source"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."iot_thing_source"."creator" IS '创建者';
COMMENT ON COLUMN "public"."iot_thing_source"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."iot_thing_source"."updater" IS '更新者';
COMMENT ON COLUMN "public"."iot_thing_source"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."iot_thing_source" IS '监控分析、用量分析、设备管理设置表';

-- ----------------------------
-- Table structure for mock_data_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."mock_data_config";
CREATE TABLE "public"."mock_data_config" (
  "id" int8 NOT NULL,
  "thing_name" varchar(100) COLLATE "pg_catalog"."default",
  "thing_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "attr_name" varchar(100) COLLATE "pg_catalog"."default",
  "attr_code" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "formula" varchar(255) COLLATE "pg_catalog"."default",
  "frequency" int4,
  "time_unit" varchar(10) COLLATE "pg_catalog"."default",
  "on_time" bool,
  "enable" bool,
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "tenant_code" int8 NOT NULL,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."mock_data_config"."id" IS '主键';
COMMENT ON COLUMN "public"."mock_data_config"."thing_name" IS '目标物名称';
COMMENT ON COLUMN "public"."mock_data_config"."thing_code" IS '目标物编码';
COMMENT ON COLUMN "public"."mock_data_config"."attr_name" IS '目标属性名称';
COMMENT ON COLUMN "public"."mock_data_config"."attr_code" IS '目标属性编码';
COMMENT ON COLUMN "public"."mock_data_config"."formula" IS '计算公式';
COMMENT ON COLUMN "public"."mock_data_config"."frequency" IS '数据模拟频率';
COMMENT ON COLUMN "public"."mock_data_config"."time_unit" IS '频率单位：秒、分、时';
COMMENT ON COLUMN "public"."mock_data_config"."on_time" IS '是否整点:整点的秒=0，分=0、5、15、30、45';
COMMENT ON COLUMN "public"."mock_data_config"."enable" IS '是否启用计算';
COMMENT ON COLUMN "public"."mock_data_config"."remark" IS '备注';
COMMENT ON COLUMN "public"."mock_data_config"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."mock_data_config"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."mock_data_config"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."mock_data_config"."creator" IS '创建人';
COMMENT ON COLUMN "public"."mock_data_config"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."mock_data_config"."updater" IS '更新人';
COMMENT ON COLUMN "public"."mock_data_config"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."mock_data_config" IS '数据模拟配置表';

-- ----------------------------
-- Table structure for mock_data_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."mock_data_log";
CREATE TABLE "public"."mock_data_log" (
  "id" int8 NOT NULL,
  "mock_config_id" int8 NOT NULL,
  "formula" varchar(255) COLLATE "pg_catalog"."default",
  "time" int8,
  "result" varchar(255) COLLATE "pg_catalog"."default",
  "tenant_code" int8 NOT NULL,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."mock_data_log"."id" IS '主键';
COMMENT ON COLUMN "public"."mock_data_log"."mock_config_id" IS '数据模拟配置表id';
COMMENT ON COLUMN "public"."mock_data_log"."formula" IS '计算公式';
COMMENT ON COLUMN "public"."mock_data_log"."time" IS '数据时间';
COMMENT ON COLUMN "public"."mock_data_log"."result" IS '计算结果';
COMMENT ON COLUMN "public"."mock_data_log"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."mock_data_log"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."mock_data_log"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."mock_data_log"."creator" IS '创建人';
COMMENT ON COLUMN "public"."mock_data_log"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."mock_data_log"."updater" IS '更新人';
COMMENT ON COLUMN "public"."mock_data_log"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."mock_data_log" IS '数据模拟日志表';

-- ----------------------------
-- Table structure for mqtt_broker_connect
-- ----------------------------
DROP TABLE IF EXISTS "public"."mqtt_broker_connect";
CREATE TABLE "public"."mqtt_broker_connect" (
  "id" varchar(40) COLLATE "pg_catalog"."default" NOT NULL,
  "client_id" varchar(255) COLLATE "pg_catalog"."default",
  "user_name" varchar(255) COLLATE "pg_catalog"."default",
  "start_time" int8,
  "last_time" int8,
  "client_ip" varchar(255) COLLATE "pg_catalog"."default",
  "msg_num" int4,
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6)
)
;
COMMENT ON COLUMN "public"."mqtt_broker_connect"."id" IS '主键，当前连接的sessionId';
COMMENT ON COLUMN "public"."mqtt_broker_connect"."client_id" IS '客户端ID';
COMMENT ON COLUMN "public"."mqtt_broker_connect"."user_name" IS '用户名(设备token)';
COMMENT ON COLUMN "public"."mqtt_broker_connect"."start_time" IS '开始连接时间';
COMMENT ON COLUMN "public"."mqtt_broker_connect"."last_time" IS '最后连接时间';
COMMENT ON COLUMN "public"."mqtt_broker_connect"."client_ip" IS '客户端IP';
COMMENT ON COLUMN "public"."mqtt_broker_connect"."msg_num" IS '发送消息数量';
COMMENT ON COLUMN "public"."mqtt_broker_connect"."creator" IS '创建者';
COMMENT ON COLUMN "public"."mqtt_broker_connect"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."mqtt_broker_connect"."updater" IS '更新者';
COMMENT ON COLUMN "public"."mqtt_broker_connect"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."mqtt_broker_connect" IS 'mqttBroker连接日志';

-- ----------------------------
-- Table structure for mqtt_broker_msg
-- ----------------------------
DROP TABLE IF EXISTS "public"."mqtt_broker_msg";
CREATE TABLE "public"."mqtt_broker_msg" (
  "id" int8 NOT NULL,
  "client_id" varchar(255) COLLATE "pg_catalog"."default",
  "user_name" varchar(255) COLLATE "pg_catalog"."default",
  "msg" varchar COLLATE "pg_catalog"."default",
  "topic" varchar(255) COLLATE "pg_catalog"."default",
  "session_id" varchar(40) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6)
)
;
COMMENT ON COLUMN "public"."mqtt_broker_msg"."client_id" IS '客户端ID';
COMMENT ON COLUMN "public"."mqtt_broker_msg"."user_name" IS '用户名(设备token)';
COMMENT ON COLUMN "public"."mqtt_broker_msg"."msg" IS '消息';
COMMENT ON COLUMN "public"."mqtt_broker_msg"."topic" IS 'topic';
COMMENT ON COLUMN "public"."mqtt_broker_msg"."session_id" IS '推送消息sessionId';
COMMENT ON COLUMN "public"."mqtt_broker_msg"."creator" IS '创建者';
COMMENT ON COLUMN "public"."mqtt_broker_msg"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."mqtt_broker_msg"."updater" IS '更新者';
COMMENT ON COLUMN "public"."mqtt_broker_msg"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."mqtt_broker_msg" IS 'mqttBroker调试日志';

-- ----------------------------
-- Table structure for msg_cache
-- ----------------------------
DROP TABLE IF EXISTS "public"."msg_cache";
CREATE TABLE "public"."msg_cache" (
  "id" int8 NOT NULL,
  "cache_key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "cache_key_type" varchar(255) COLLATE "pg_catalog"."default",
  "cache_value" varchar(255) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "company_id" int8
)
;
COMMENT ON COLUMN "public"."msg_cache"."cache_key" IS '缓存键';
COMMENT ON COLUMN "public"."msg_cache"."cache_key_type" IS '键类型 0：token 1：模板';
COMMENT ON COLUMN "public"."msg_cache"."cache_value" IS '缓存内容';
COMMENT ON COLUMN "public"."msg_cache"."dept_id" IS '部门ID';
COMMENT ON COLUMN "public"."msg_cache"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."msg_cache"."creator" IS '创建者';
COMMENT ON COLUMN "public"."msg_cache"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."msg_cache"."updater" IS '更新者';
COMMENT ON COLUMN "public"."msg_cache"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."msg_cache"."company_id" IS '企业id';
COMMENT ON TABLE "public"."msg_cache" IS '消息缓存表';

-- ----------------------------
-- Table structure for msg_his
-- ----------------------------
DROP TABLE IF EXISTS "public"."msg_his";
CREATE TABLE "public"."msg_his" (
  "id" int8 NOT NULL,
  "publisher" varchar(100) COLLATE "pg_catalog"."default",
  "receiver" varchar(100) COLLATE "pg_catalog"."default",
  "his_msg" varchar(255) COLLATE "pg_catalog"."default",
  "push_config_id" varchar(100) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "publisher_code" varchar(100) COLLATE "pg_catalog"."default",
  "receiver_code" varchar(100) COLLATE "pg_catalog"."default",
  "company_id" int8,
  "status" varchar(5) COLLATE "pg_catalog"."default",
  "status_msg" varchar COLLATE "pg_catalog"."default",
  "push_setting_id" int8,
  "push_receive_status" varchar(5) COLLATE "pg_catalog"."default",
  "push_num" int8,
  "push_type" varchar(5) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."msg_his"."publisher" IS '推送方';
COMMENT ON COLUMN "public"."msg_his"."receiver" IS '接收方';
COMMENT ON COLUMN "public"."msg_his"."his_msg" IS '推送历史记录内容';
COMMENT ON COLUMN "public"."msg_his"."push_config_id" IS '推送配置项id';
COMMENT ON COLUMN "public"."msg_his"."dept_id" IS '部门ID';
COMMENT ON COLUMN "public"."msg_his"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."msg_his"."creator" IS '创建者';
COMMENT ON COLUMN "public"."msg_his"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."msg_his"."updater" IS '更新者';
COMMENT ON COLUMN "public"."msg_his"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."msg_his"."publisher_code" IS '推送方编码';
COMMENT ON COLUMN "public"."msg_his"."receiver_code" IS '接收方编码';
COMMENT ON COLUMN "public"."msg_his"."company_id" IS '企业id';
COMMENT ON COLUMN "public"."msg_his"."status" IS '推送状态(0-成功，1-失败)';
COMMENT ON COLUMN "public"."msg_his"."status_msg" IS '状态信息';
COMMENT ON COLUMN "public"."msg_his"."push_setting_id" IS '推送设置id';
COMMENT ON COLUMN "public"."msg_his"."push_receive_status" IS '推送接收状态0-已接收1-未接收';
COMMENT ON COLUMN "public"."msg_his"."push_num" IS '推送次数';
COMMENT ON COLUMN "public"."msg_his"."push_type" IS '推送类型';
COMMENT ON TABLE "public"."msg_his" IS '消息历史表';

-- ----------------------------
-- Table structure for msg_push
-- ----------------------------
DROP TABLE IF EXISTS "public"."msg_push";
CREATE TABLE "public"."msg_push" (
  "id" int8 NOT NULL,
  "config_name" varchar(50) COLLATE "pg_catalog"."default",
  "config_type" varchar(5) COLLATE "pg_catalog"."default",
  "template_msg" varchar(255) COLLATE "pg_catalog"."default",
  "template_id" int8,
  "config_params" text COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "execute_by_job" varchar(5) COLLATE "pg_catalog"."default",
  "company_id" int8
)
;
COMMENT ON COLUMN "public"."msg_push"."id" IS '主键';
COMMENT ON COLUMN "public"."msg_push"."config_name" IS '配置名';
COMMENT ON COLUMN "public"."msg_push"."config_type" IS '配置类型';
COMMENT ON COLUMN "public"."msg_push"."template_msg" IS '消息内容';
COMMENT ON COLUMN "public"."msg_push"."template_id" IS '模板id';
COMMENT ON COLUMN "public"."msg_push"."config_params" IS '配置参数';
COMMENT ON COLUMN "public"."msg_push"."dept_id" IS '部门ID';
COMMENT ON COLUMN "public"."msg_push"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."msg_push"."creator" IS '创建者';
COMMENT ON COLUMN "public"."msg_push"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."msg_push"."updater" IS '更新者';
COMMENT ON COLUMN "public"."msg_push"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."msg_push"."execute_by_job" IS '是否由定时任务执行 0:否 1:是';
COMMENT ON COLUMN "public"."msg_push"."company_id" IS '企业id';
COMMENT ON TABLE "public"."msg_push" IS '消息推送';

-- ----------------------------
-- Table structure for msg_push_setting
-- ----------------------------
DROP TABLE IF EXISTS "public"."msg_push_setting";
CREATE TABLE "public"."msg_push_setting" (
  "id" int8 NOT NULL,
  "push_ids" varchar(255) COLLATE "pg_catalog"."default",
  "template_id" int8,
  "receivers" varchar(255) COLLATE "pg_catalog"."default",
  "repeat_push" varchar(255) COLLATE "pg_catalog"."default",
  "interval_push" varchar(255) COLLATE "pg_catalog"."default",
  "interval_frequency" varchar(10) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6),
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "repeat_frequency" varchar(10) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."msg_push_setting"."id" IS '主键';
COMMENT ON COLUMN "public"."msg_push_setting"."push_ids" IS '推送ids';
COMMENT ON COLUMN "public"."msg_push_setting"."template_id" IS '模板id';
COMMENT ON COLUMN "public"."msg_push_setting"."receivers" IS '接收人集合';
COMMENT ON COLUMN "public"."msg_push_setting"."repeat_push" IS '重复推送，0-开启，1-关闭';
COMMENT ON COLUMN "public"."msg_push_setting"."interval_push" IS '间隔推送，0-开启，1-关闭';
COMMENT ON COLUMN "public"."msg_push_setting"."interval_frequency" IS '间隔推送频率';
COMMENT ON COLUMN "public"."msg_push_setting"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."msg_push_setting"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."msg_push_setting"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."msg_push_setting"."creator" IS '创建者';
COMMENT ON COLUMN "public"."msg_push_setting"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."msg_push_setting"."updater" IS '更新者';
COMMENT ON COLUMN "public"."msg_push_setting"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."msg_push_setting"."name" IS '推送设置名称';
COMMENT ON COLUMN "public"."msg_push_setting"."remark" IS '备注';
COMMENT ON COLUMN "public"."msg_push_setting"."repeat_frequency" IS '重复推送频率';
COMMENT ON TABLE "public"."msg_push_setting" IS '消息推送设置';

-- ----------------------------
-- Table structure for msg_template
-- ----------------------------
DROP TABLE IF EXISTS "public"."msg_template";
CREATE TABLE "public"."msg_template" (
  "id" int8 NOT NULL,
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "type" varchar(5) COLLATE "pg_catalog"."default",
  "subject" varchar(100) COLLATE "pg_catalog"."default",
  "content" text COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "company_id" int8
)
;
COMMENT ON COLUMN "public"."msg_template"."name" IS '模板名称';
COMMENT ON COLUMN "public"."msg_template"."type" IS '模板类型（暂时仅支持邮箱） 1：邮箱模板';
COMMENT ON COLUMN "public"."msg_template"."subject" IS '模板主题';
COMMENT ON COLUMN "public"."msg_template"."content" IS '消息正文内容';
COMMENT ON COLUMN "public"."msg_template"."dept_id" IS '部门ID';
COMMENT ON COLUMN "public"."msg_template"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."msg_template"."creator" IS '创建者';
COMMENT ON COLUMN "public"."msg_template"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."msg_template"."updater" IS '更新者';
COMMENT ON COLUMN "public"."msg_template"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."msg_template"."company_id" IS '企业id';
COMMENT ON TABLE "public"."msg_template" IS '消息模板';

-- ----------------------------
-- Table structure for msg_user
-- ----------------------------
DROP TABLE IF EXISTS "public"."msg_user";
CREATE TABLE "public"."msg_user" (
  "id" int8 NOT NULL,
  "user_id" int8,
  "email_username" varchar(255) COLLATE "pg_catalog"."default",
  "wx_open_id" varchar(255) COLLATE "pg_catalog"."default",
  "dingding_phone" varchar(255) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "wx_phone" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."msg_user"."id" IS 'id';
COMMENT ON COLUMN "public"."msg_user"."user_id" IS '用户id';
COMMENT ON COLUMN "public"."msg_user"."email_username" IS '邮箱用户名';
COMMENT ON COLUMN "public"."msg_user"."wx_open_id" IS '微信openId';
COMMENT ON COLUMN "public"."msg_user"."dingding_phone" IS '钉钉电话';
COMMENT ON COLUMN "public"."msg_user"."creator" IS '创建者';
COMMENT ON COLUMN "public"."msg_user"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."msg_user"."updater" IS '更新者';
COMMENT ON COLUMN "public"."msg_user"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."msg_user"."wx_phone" IS '微信电话';
COMMENT ON TABLE "public"."msg_user" IS '消息用户信息';

-- ----------------------------
-- Table structure for qrtz_blob_triggers
-- ----------------------------
DROP TABLE IF EXISTS "public"."qrtz_blob_triggers";
CREATE TABLE "public"."qrtz_blob_triggers" (
  "sched_name" varchar(120) COLLATE "pg_catalog"."default" NOT NULL,
  "trigger_name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "trigger_group" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "blob_data" bytea
)
;

-- ----------------------------
-- Table structure for qrtz_calendars
-- ----------------------------
DROP TABLE IF EXISTS "public"."qrtz_calendars";
CREATE TABLE "public"."qrtz_calendars" (
  "sched_name" varchar(120) COLLATE "pg_catalog"."default" NOT NULL,
  "calendar_name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "calendar" bytea NOT NULL
)
;

-- ----------------------------
-- Table structure for qrtz_cron_triggers
-- ----------------------------
DROP TABLE IF EXISTS "public"."qrtz_cron_triggers";
CREATE TABLE "public"."qrtz_cron_triggers" (
  "sched_name" varchar(120) COLLATE "pg_catalog"."default" NOT NULL,
  "trigger_name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "trigger_group" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "cron_expression" varchar(120) COLLATE "pg_catalog"."default" NOT NULL,
  "time_zone_id" varchar(80) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for qrtz_fired_triggers
-- ----------------------------
DROP TABLE IF EXISTS "public"."qrtz_fired_triggers";
CREATE TABLE "public"."qrtz_fired_triggers" (
  "sched_name" varchar(120) COLLATE "pg_catalog"."default" NOT NULL,
  "entry_id" varchar(95) COLLATE "pg_catalog"."default" NOT NULL,
  "trigger_name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "trigger_group" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "instance_name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "fired_time" int8 NOT NULL,
  "sched_time" int8 NOT NULL,
  "priority" int4 NOT NULL,
  "state" varchar(16) COLLATE "pg_catalog"."default" NOT NULL,
  "job_name" varchar(200) COLLATE "pg_catalog"."default",
  "job_group" varchar(200) COLLATE "pg_catalog"."default",
  "is_nonconcurrent" bool,
  "requests_recovery" bool
)
;

-- ----------------------------
-- Table structure for qrtz_job_details
-- ----------------------------
DROP TABLE IF EXISTS "public"."qrtz_job_details";
CREATE TABLE "public"."qrtz_job_details" (
  "sched_name" varchar(120) COLLATE "pg_catalog"."default" NOT NULL,
  "job_name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "job_group" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "description" varchar(250) COLLATE "pg_catalog"."default",
  "job_class_name" varchar(250) COLLATE "pg_catalog"."default" NOT NULL,
  "is_durable" bool NOT NULL,
  "is_nonconcurrent" bool NOT NULL,
  "is_update_data" bool NOT NULL,
  "requests_recovery" bool NOT NULL,
  "job_data" bytea
)
;

-- ----------------------------
-- Table structure for qrtz_locks
-- ----------------------------
DROP TABLE IF EXISTS "public"."qrtz_locks";
CREATE TABLE "public"."qrtz_locks" (
  "sched_name" varchar(120) COLLATE "pg_catalog"."default" NOT NULL,
  "lock_name" varchar(40) COLLATE "pg_catalog"."default" NOT NULL
)
;

-- ----------------------------
-- Table structure for qrtz_paused_trigger_grps
-- ----------------------------
DROP TABLE IF EXISTS "public"."qrtz_paused_trigger_grps";
CREATE TABLE "public"."qrtz_paused_trigger_grps" (
  "sched_name" varchar(120) COLLATE "pg_catalog"."default" NOT NULL,
  "trigger_group" varchar(200) COLLATE "pg_catalog"."default" NOT NULL
)
;

-- ----------------------------
-- Table structure for qrtz_scheduler_state
-- ----------------------------
DROP TABLE IF EXISTS "public"."qrtz_scheduler_state";
CREATE TABLE "public"."qrtz_scheduler_state" (
  "sched_name" varchar(120) COLLATE "pg_catalog"."default" NOT NULL,
  "instance_name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "last_checkin_time" int8 NOT NULL,
  "checkin_interval" int8 NOT NULL
)
;

-- ----------------------------
-- Table structure for qrtz_simple_triggers
-- ----------------------------
DROP TABLE IF EXISTS "public"."qrtz_simple_triggers";
CREATE TABLE "public"."qrtz_simple_triggers" (
  "sched_name" varchar(120) COLLATE "pg_catalog"."default" NOT NULL,
  "trigger_name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "trigger_group" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "repeat_count" int8 NOT NULL,
  "repeat_interval" int8 NOT NULL,
  "times_triggered" int8 NOT NULL
)
;

-- ----------------------------
-- Table structure for qrtz_simprop_triggers
-- ----------------------------
DROP TABLE IF EXISTS "public"."qrtz_simprop_triggers";
CREATE TABLE "public"."qrtz_simprop_triggers" (
  "sched_name" varchar(120) COLLATE "pg_catalog"."default" NOT NULL,
  "trigger_name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "trigger_group" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "str_prop_1" varchar(512) COLLATE "pg_catalog"."default",
  "str_prop_2" varchar(512) COLLATE "pg_catalog"."default",
  "str_prop_3" varchar(512) COLLATE "pg_catalog"."default",
  "int_prop_1" int4,
  "int_prop_2" int4,
  "long_prop_1" int8,
  "long_prop_2" int8,
  "dec_prop_1" numeric(13,4),
  "dec_prop_2" numeric(13,4),
  "bool_prop_1" bool,
  "bool_prop_2" bool
)
;

-- ----------------------------
-- Table structure for qrtz_triggers
-- ----------------------------
DROP TABLE IF EXISTS "public"."qrtz_triggers";
CREATE TABLE "public"."qrtz_triggers" (
  "sched_name" varchar(120) COLLATE "pg_catalog"."default" NOT NULL,
  "trigger_name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "trigger_group" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "job_name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "job_group" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "description" varchar(250) COLLATE "pg_catalog"."default",
  "next_fire_time" int8,
  "prev_fire_time" int8,
  "priority" int4,
  "trigger_state" varchar(16) COLLATE "pg_catalog"."default" NOT NULL,
  "trigger_type" varchar(8) COLLATE "pg_catalog"."default" NOT NULL,
  "start_time" int8 NOT NULL,
  "end_time" int8,
  "calendar_name" varchar(200) COLLATE "pg_catalog"."default",
  "misfire_instr" int2,
  "job_data" bytea
)
;

-- ----------------------------
-- Table structure for queue_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."queue_log";
CREATE TABLE "public"."queue_log" (
  "id" int8 NOT NULL,
  "time" timestamp(6),
  "queue_num" varchar(25) COLLATE "pg_catalog"."default",
  "enter_num" varchar(25) COLLATE "pg_catalog"."default",
  "poll_num" varchar(25) COLLATE "pg_catalog"."default",
  "channel_num" varchar(25) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6)
)
;
COMMENT ON COLUMN "public"."queue_log"."id" IS '主键';
COMMENT ON COLUMN "public"."queue_log"."time" IS '时间';
COMMENT ON COLUMN "public"."queue_log"."queue_num" IS '队列消息数';
COMMENT ON COLUMN "public"."queue_log"."enter_num" IS '进口消息量';
COMMENT ON COLUMN "public"."queue_log"."poll_num" IS '出口消息量';
COMMENT ON COLUMN "public"."queue_log"."channel_num" IS '通道数';
COMMENT ON COLUMN "public"."queue_log"."creator" IS '创建者';
COMMENT ON COLUMN "public"."queue_log"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."queue_log"."updater" IS '更新者';
COMMENT ON COLUMN "public"."queue_log"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."queue_log" IS '队列消息数量日志';

-- ----------------------------
-- Table structure for queue_msg_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."queue_msg_log";
CREATE TABLE "public"."queue_msg_log" (
  "id" int8 NOT NULL,
  "channel_name" varchar(30) COLLATE "pg_catalog"."default",
  "msg" varchar COLLATE "pg_catalog"."default",
  "time" int8,
  "creator" int8,
  "create_date" timestamp(6),
  "updater" int8,
  "update_date" timestamp(6)
)
;
COMMENT ON COLUMN "public"."queue_msg_log"."channel_name" IS '所属通道';
COMMENT ON COLUMN "public"."queue_msg_log"."msg" IS '消息体';
COMMENT ON COLUMN "public"."queue_msg_log"."time" IS '时间';
COMMENT ON COLUMN "public"."queue_msg_log"."creator" IS '创建者';
COMMENT ON COLUMN "public"."queue_msg_log"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."queue_msg_log"."updater" IS '更新者';
COMMENT ON COLUMN "public"."queue_msg_log"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."queue_msg_log" IS '队列消息日志';

-- ----------------------------
-- Table structure for schedule_job
-- ----------------------------
DROP TABLE IF EXISTS "public"."schedule_job";
CREATE TABLE "public"."schedule_job" (
  "id" int8 NOT NULL,
  "bean_name" varchar(200) COLLATE "pg_catalog"."default",
  "params" varchar(2000) COLLATE "pg_catalog"."default",
  "cron_expression" varchar(100) COLLATE "pg_catalog"."default",
  "status" int4,
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."schedule_job"."id" IS 'id';
COMMENT ON COLUMN "public"."schedule_job"."bean_name" IS 'spring bean名称';
COMMENT ON COLUMN "public"."schedule_job"."params" IS '参数';
COMMENT ON COLUMN "public"."schedule_job"."cron_expression" IS 'cron表达式';
COMMENT ON COLUMN "public"."schedule_job"."status" IS '任务状态  0：暂停  1：正常';
COMMENT ON COLUMN "public"."schedule_job"."remark" IS '备注';
COMMENT ON COLUMN "public"."schedule_job"."creator" IS '创建者';
COMMENT ON COLUMN "public"."schedule_job"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."schedule_job"."updater" IS '更新者';
COMMENT ON COLUMN "public"."schedule_job"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."schedule_job" IS '定时任务';

-- ----------------------------
-- Table structure for schedule_job_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."schedule_job_log";
CREATE TABLE "public"."schedule_job_log" (
  "id" int8 NOT NULL,
  "job_id" int8 NOT NULL,
  "bean_name" varchar(200) COLLATE "pg_catalog"."default",
  "params" varchar(2000) COLLATE "pg_catalog"."default",
  "status" int4,
  "error" varchar(10000) COLLATE "pg_catalog"."default",
  "times" int4,
  "create_date" timestamp(6),
  "ip" varchar(50) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."schedule_job_log"."id" IS 'id';
COMMENT ON COLUMN "public"."schedule_job_log"."bean_name" IS 'spring bean名称';
COMMENT ON COLUMN "public"."schedule_job_log"."params" IS '参数';
COMMENT ON COLUMN "public"."schedule_job_log"."status" IS '任务状态  0：失败    1：成功';
COMMENT ON COLUMN "public"."schedule_job_log"."error" IS '失败信息';
COMMENT ON COLUMN "public"."schedule_job_log"."times" IS '耗时(单位：毫秒)';
COMMENT ON COLUMN "public"."schedule_job_log"."ip" IS 'ip地址';
COMMENT ON TABLE "public"."schedule_job_log" IS '定时任务日志';

-- ----------------------------
-- Table structure for script_info
-- ----------------------------
DROP TABLE IF EXISTS "public"."script_info";
CREATE TABLE "public"."script_info" (
  "id" int8 NOT NULL,
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "script_type" varchar(25) COLLATE "pg_catalog"."default",
  "script_body" varchar COLLATE "pg_catalog"."default",
  "sup_msg" varchar(5000) COLLATE "pg_catalog"."default",
  "query_msg" varchar(5000) COLLATE "pg_catalog"."default",
  "debug" bool,
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "extend_data" varchar(5000) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."script_info"."name" IS '名称';
COMMENT ON COLUMN "public"."script_info"."script_type" IS '语法类型';
COMMENT ON COLUMN "public"."script_info"."script_body" IS '方法体';
COMMENT ON COLUMN "public"."script_info"."sup_msg" IS '辅助参数';
COMMENT ON COLUMN "public"."script_info"."query_msg" IS '查询参数';
COMMENT ON COLUMN "public"."script_info"."debug" IS '调试';
COMMENT ON COLUMN "public"."script_info"."remark" IS '描述';
COMMENT ON COLUMN "public"."script_info"."extend_data" IS '扩展字段';
COMMENT ON COLUMN "public"."script_info"."tenant_code" IS '所属企业(租户code)';
COMMENT ON COLUMN "public"."script_info"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."script_info"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."script_info"."creator" IS '创建者';
COMMENT ON COLUMN "public"."script_info"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."script_info"."updater" IS '更新者';
COMMENT ON COLUMN "public"."script_info"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."script_info" IS '数据解析';

-- ----------------------------
-- Table structure for script_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."script_log";
CREATE TABLE "public"."script_log" (
  "id" int8 NOT NULL,
  "script_id" int8,
  "msg" varchar COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."script_log"."script_id" IS '数据解析主键';
COMMENT ON COLUMN "public"."script_log"."msg" IS '消息';
COMMENT ON COLUMN "public"."script_log"."creator" IS '创建者';
COMMENT ON COLUMN "public"."script_log"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."script_log"."updater" IS '更新者';
COMMENT ON COLUMN "public"."script_log"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."script_log" IS '数据解析日志';

-- ----------------------------
-- Table structure for sys_dept
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_dept";
CREATE TABLE "public"."sys_dept" (
  "id" int8 NOT NULL,
  "pid" int8,
  "pids" varchar(500) COLLATE "pg_catalog"."default",
  "name" varchar(50) COLLATE "pg_catalog"."default",
  "sort" int4,
  "tenant_code" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."sys_dept"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_dept"."pid" IS '上级ID';
COMMENT ON COLUMN "public"."sys_dept"."pids" IS '所有上级ID，用逗号分开';
COMMENT ON COLUMN "public"."sys_dept"."name" IS '部门名称';
COMMENT ON COLUMN "public"."sys_dept"."sort" IS '排序';
COMMENT ON COLUMN "public"."sys_dept"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."sys_dept"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_dept"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_dept"."updater" IS '更新者';
COMMENT ON COLUMN "public"."sys_dept"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."sys_dept" IS '部门管理';

-- ----------------------------
-- Table structure for sys_dict_data
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_dict_data";
CREATE TABLE "public"."sys_dict_data" (
  "id" int8 NOT NULL,
  "dict_type_id" int8 NOT NULL,
  "dict_label" varchar(255) COLLATE "pg_catalog"."default",
  "dict_value" varchar(255) COLLATE "pg_catalog"."default",
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "sort" int4,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."sys_dict_data"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_dict_data"."dict_type_id" IS '字典类型ID';
COMMENT ON COLUMN "public"."sys_dict_data"."dict_label" IS '字典标签';
COMMENT ON COLUMN "public"."sys_dict_data"."dict_value" IS '字典值';
COMMENT ON COLUMN "public"."sys_dict_data"."remark" IS '备注';
COMMENT ON COLUMN "public"."sys_dict_data"."sort" IS '排序';
COMMENT ON COLUMN "public"."sys_dict_data"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_dict_data"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_dict_data"."updater" IS '更新者';
COMMENT ON COLUMN "public"."sys_dict_data"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."sys_dict_data" IS '字典数据';

-- ----------------------------
-- Table structure for sys_dict_type
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_dict_type";
CREATE TABLE "public"."sys_dict_type" (
  "id" int8 NOT NULL,
  "dict_type" varchar(100) COLLATE "pg_catalog"."default",
  "dict_name" varchar(255) COLLATE "pg_catalog"."default",
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "sort" int4,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."sys_dict_type"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_dict_type"."dict_type" IS '字典类型';
COMMENT ON COLUMN "public"."sys_dict_type"."dict_name" IS '字典名称';
COMMENT ON COLUMN "public"."sys_dict_type"."remark" IS '备注';
COMMENT ON COLUMN "public"."sys_dict_type"."sort" IS '排序';
COMMENT ON COLUMN "public"."sys_dict_type"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_dict_type"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_dict_type"."updater" IS '更新者';
COMMENT ON COLUMN "public"."sys_dict_type"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."sys_dict_type" IS '字典类型';

-- ----------------------------
-- Table structure for sys_energy_check
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_energy_check";
CREATE TABLE "public"."sys_energy_check" (
  "id" int8 NOT NULL,
  "location" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "dept_name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "check_time" date NOT NULL,
  "check_people" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "problem" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "requirement" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "image_url" varchar(255) COLLATE "pg_catalog"."default",
  "status" varchar(255) COLLATE "pg_catalog"."default" NOT NULL DEFAULT 0,
  "change_time" date,
  "creator" int8,
  "create_date" timestamp(6),
  "tenant_code" int8,
  "device_name" varchar(255) COLLATE "pg_catalog"."default",
  "remarks" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."sys_energy_check"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_energy_check"."location" IS '设备位置';
COMMENT ON COLUMN "public"."sys_energy_check"."dept_name" IS '责任部门';
COMMENT ON COLUMN "public"."sys_energy_check"."check_time" IS '检查时间';
COMMENT ON COLUMN "public"."sys_energy_check"."check_people" IS '检查人员';
COMMENT ON COLUMN "public"."sys_energy_check"."problem" IS '存在问题';
COMMENT ON COLUMN "public"."sys_energy_check"."requirement" IS '整改要求';
COMMENT ON COLUMN "public"."sys_energy_check"."image_url" IS '图片地址';
COMMENT ON COLUMN "public"."sys_energy_check"."status" IS '整改状态 0：待整改 1：已整改';
COMMENT ON COLUMN "public"."sys_energy_check"."change_time" IS '整改时间';
COMMENT ON COLUMN "public"."sys_energy_check"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_energy_check"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_energy_check"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."sys_energy_check"."device_name" IS '设备名称';
COMMENT ON COLUMN "public"."sys_energy_check"."remarks" IS '备注';
COMMENT ON TABLE "public"."sys_energy_check" IS '能源检查';

-- ----------------------------
-- Table structure for sys_energy_people
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_energy_people";
CREATE TABLE "public"."sys_energy_people" (
  "id" int8 NOT NULL,
  "username" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "realname" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "dept_name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "user_id" int8 NOT NULL,
  "email" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "tenant_code" int8,
  "creator" int8,
  "create_date" timestamp(6)
)
;
COMMENT ON COLUMN "public"."sys_energy_people"."id" IS '项目id';
COMMENT ON COLUMN "public"."sys_energy_people"."username" IS '用户名';
COMMENT ON COLUMN "public"."sys_energy_people"."realname" IS '姓名';
COMMENT ON COLUMN "public"."sys_energy_people"."dept_name" IS '部门名称';
COMMENT ON COLUMN "public"."sys_energy_people"."user_id" IS '用户id';
COMMENT ON COLUMN "public"."sys_energy_people"."email" IS '邮箱';
COMMENT ON COLUMN "public"."sys_energy_people"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."sys_energy_people"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_energy_people"."create_date" IS '创建时间';
COMMENT ON TABLE "public"."sys_energy_people" IS '节能项目-用户关联';

-- ----------------------------
-- Table structure for sys_energy_project
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_energy_project";
CREATE TABLE "public"."sys_energy_project" (
  "id" int8 NOT NULL,
  "project_name" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "department" varchar(125) COLLATE "pg_catalog"."default" NOT NULL,
  "people" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "save_energy" numeric(15,2) NOT NULL,
  "save_cost" numeric(15,2) NOT NULL,
  "implement_time" date NOT NULL,
  "detail" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "status" varchar(32) COLLATE "pg_catalog"."default" DEFAULT 0,
  "remark" varchar(32) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "creator" int8,
  "create_date" timestamp(6)
)
;
COMMENT ON COLUMN "public"."sys_energy_project"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_energy_project"."project_name" IS '项目名称';
COMMENT ON COLUMN "public"."sys_energy_project"."department" IS '部门';
COMMENT ON COLUMN "public"."sys_energy_project"."people" IS '实施人';
COMMENT ON COLUMN "public"."sys_energy_project"."save_energy" IS '节能量';
COMMENT ON COLUMN "public"."sys_energy_project"."save_cost" IS '节约费用';
COMMENT ON COLUMN "public"."sys_energy_project"."implement_time" IS '实施时间';
COMMENT ON COLUMN "public"."sys_energy_project"."detail" IS '详情';
COMMENT ON COLUMN "public"."sys_energy_project"."status" IS '审核状态 0:待审核 1：已审核 2:未通过';
COMMENT ON COLUMN "public"."sys_energy_project"."remark" IS '审核未通过备注';
COMMENT ON COLUMN "public"."sys_energy_project"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."sys_energy_project"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_energy_project"."create_date" IS '创建时间';
COMMENT ON TABLE "public"."sys_energy_project" IS '节能项目';

-- ----------------------------
-- Table structure for sys_industry_type
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_industry_type";
CREATE TABLE "public"."sys_industry_type" (
  "id" int8 NOT NULL,
  "code" varchar(20) COLLATE "pg_catalog"."default",
  "parent_code" varchar(20) COLLATE "pg_catalog"."default",
  "name" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "full_name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "jgzh" bool,
  "tenant_code" int8 NOT NULL,
  "dept_id" int8 NOT NULL,
  "delete_status" int2 NOT NULL DEFAULT 0
)
;
COMMENT ON COLUMN "public"."sys_industry_type"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_industry_type"."code" IS '编码';
COMMENT ON COLUMN "public"."sys_industry_type"."parent_code" IS '父节编码';
COMMENT ON COLUMN "public"."sys_industry_type"."name" IS '行业名称';
COMMENT ON COLUMN "public"."sys_industry_type"."full_name" IS '行业全名';
COMMENT ON COLUMN "public"."sys_industry_type"."jgzh" IS '是否能源加工转换类行业';
COMMENT ON COLUMN "public"."sys_industry_type"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."sys_industry_type"."dept_id" IS '企业ID';
COMMENT ON COLUMN "public"."sys_industry_type"."delete_status" IS '删除状态 0未删除 1删除';
COMMENT ON TABLE "public"."sys_industry_type" IS '行业类型';

-- ----------------------------
-- Table structure for sys_language
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_language";
CREATE TABLE "public"."sys_language" (
  "table_name" varchar(32) COLLATE "pg_catalog"."default" NOT NULL,
  "table_id" int8 NOT NULL,
  "field_name" varchar(32) COLLATE "pg_catalog"."default" NOT NULL,
  "field_value" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "language" varchar(10) COLLATE "pg_catalog"."default" NOT NULL
)
;
COMMENT ON COLUMN "public"."sys_language"."table_name" IS '表名';
COMMENT ON COLUMN "public"."sys_language"."table_id" IS '表主键';
COMMENT ON COLUMN "public"."sys_language"."field_name" IS '字段名';
COMMENT ON COLUMN "public"."sys_language"."field_value" IS '字段值';
COMMENT ON COLUMN "public"."sys_language"."language" IS '语言';
COMMENT ON TABLE "public"."sys_language" IS '国际化';

-- ----------------------------
-- Table structure for sys_log_error
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_log_error";
CREATE TABLE "public"."sys_log_error" (
  "id" int8 NOT NULL,
  "request_uri" varchar(200) COLLATE "pg_catalog"."default",
  "request_method" varchar(20) COLLATE "pg_catalog"."default",
  "request_params" text COLLATE "pg_catalog"."default",
  "user_agent" varchar(500) COLLATE "pg_catalog"."default",
  "ip" varchar(32) COLLATE "pg_catalog"."default",
  "error_info" text COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8
)
;
COMMENT ON COLUMN "public"."sys_log_error"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_log_error"."request_uri" IS '请求URI';
COMMENT ON COLUMN "public"."sys_log_error"."request_method" IS '请求方式';
COMMENT ON COLUMN "public"."sys_log_error"."request_params" IS '请求参数';
COMMENT ON COLUMN "public"."sys_log_error"."user_agent" IS '用户代理';
COMMENT ON COLUMN "public"."sys_log_error"."ip" IS '操作IP';
COMMENT ON COLUMN "public"."sys_log_error"."error_info" IS '异常信息';
COMMENT ON COLUMN "public"."sys_log_error"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_log_error"."create_date" IS '创建时间';
COMMENT ON TABLE "public"."sys_log_error" IS '异常日志';

-- ----------------------------
-- Table structure for sys_log_login
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_log_login";
CREATE TABLE "public"."sys_log_login" (
  "id" int8 NOT NULL,
  "operation" int4,
  "status" int4,
  "user_agent" varchar(500) COLLATE "pg_catalog"."default",
  "ip" varchar(32) COLLATE "pg_catalog"."default",
  "creator_name" varchar(50) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "internal_ip" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."sys_log_login"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_log_login"."operation" IS '用户操作   0：用户登录   1：用户退出';
COMMENT ON COLUMN "public"."sys_log_login"."status" IS '状态  0：失败    1：成功    2：账号已锁定';
COMMENT ON COLUMN "public"."sys_log_login"."user_agent" IS '用户代理';
COMMENT ON COLUMN "public"."sys_log_login"."ip" IS '操作IP';
COMMENT ON COLUMN "public"."sys_log_login"."creator_name" IS '用户名';
COMMENT ON COLUMN "public"."sys_log_login"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_log_login"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_log_login"."internal_ip" IS '内网ip';
COMMENT ON TABLE "public"."sys_log_login" IS '登录日志';

-- ----------------------------
-- Table structure for sys_log_operation
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_log_operation";
CREATE TABLE "public"."sys_log_operation" (
  "id" int8 NOT NULL,
  "operation" varchar(50) COLLATE "pg_catalog"."default",
  "request_uri" varchar(200) COLLATE "pg_catalog"."default",
  "request_method" varchar(20) COLLATE "pg_catalog"."default",
  "request_params" text COLLATE "pg_catalog"."default",
  "request_time" int4,
  "user_agent" varchar(500) COLLATE "pg_catalog"."default",
  "ip" varchar(32) COLLATE "pg_catalog"."default",
  "status" int4,
  "creator_name" varchar(50) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "internal_ip" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."sys_log_operation"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_log_operation"."operation" IS '用户操作';
COMMENT ON COLUMN "public"."sys_log_operation"."request_uri" IS '请求URI';
COMMENT ON COLUMN "public"."sys_log_operation"."request_method" IS '请求方式';
COMMENT ON COLUMN "public"."sys_log_operation"."request_params" IS '请求参数';
COMMENT ON COLUMN "public"."sys_log_operation"."request_time" IS '请求时长(毫秒)';
COMMENT ON COLUMN "public"."sys_log_operation"."user_agent" IS '用户代理';
COMMENT ON COLUMN "public"."sys_log_operation"."ip" IS '操作IP';
COMMENT ON COLUMN "public"."sys_log_operation"."status" IS '状态  0：失败   1：成功';
COMMENT ON COLUMN "public"."sys_log_operation"."creator_name" IS '用户名';
COMMENT ON COLUMN "public"."sys_log_operation"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_log_operation"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_log_operation"."internal_ip" IS '内网ip';
COMMENT ON TABLE "public"."sys_log_operation" IS '操作日志';

-- ----------------------------
-- Table structure for sys_mail_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_mail_log";
CREATE TABLE "public"."sys_mail_log" (
  "id" int8 NOT NULL,
  "template_id" int8 NOT NULL,
  "mail_from" varchar(200) COLLATE "pg_catalog"."default",
  "mail_to" varchar(400) COLLATE "pg_catalog"."default",
  "mail_cc" varchar(400) COLLATE "pg_catalog"."default",
  "subject" varchar(200) COLLATE "pg_catalog"."default",
  "content" text COLLATE "pg_catalog"."default",
  "status" int4,
  "creator" int8,
  "create_date" int8
)
;
COMMENT ON COLUMN "public"."sys_mail_log"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_mail_log"."template_id" IS '邮件模板ID';
COMMENT ON COLUMN "public"."sys_mail_log"."mail_from" IS '发送者';
COMMENT ON COLUMN "public"."sys_mail_log"."mail_to" IS '收件人';
COMMENT ON COLUMN "public"."sys_mail_log"."mail_cc" IS '抄送者';
COMMENT ON COLUMN "public"."sys_mail_log"."subject" IS '邮件主题';
COMMENT ON COLUMN "public"."sys_mail_log"."content" IS '邮件正文';
COMMENT ON COLUMN "public"."sys_mail_log"."status" IS '发送状态  0：失败  1：成功';
COMMENT ON COLUMN "public"."sys_mail_log"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_mail_log"."create_date" IS '创建时间';
COMMENT ON TABLE "public"."sys_mail_log" IS '邮件发送记录';

-- ----------------------------
-- Table structure for sys_mail_template
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_mail_template";
CREATE TABLE "public"."sys_mail_template" (
  "id" int8 NOT NULL,
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "subject" varchar(200) COLLATE "pg_catalog"."default",
  "content" text COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."sys_mail_template"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_mail_template"."name" IS '模板名称';
COMMENT ON COLUMN "public"."sys_mail_template"."subject" IS '邮件主题';
COMMENT ON COLUMN "public"."sys_mail_template"."content" IS '邮件正文';
COMMENT ON COLUMN "public"."sys_mail_template"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_mail_template"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_mail_template"."updater" IS '更新者';
COMMENT ON COLUMN "public"."sys_mail_template"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."sys_mail_template" IS '邮件模板';

-- ----------------------------
-- Table structure for sys_menu
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_menu";
CREATE TABLE "public"."sys_menu" (
  "id" int8 NOT NULL,
  "pid" int8,
  "url" varchar(200) COLLATE "pg_catalog"."default",
  "permissions" varchar(500) COLLATE "pg_catalog"."default",
  "type" int4,
  "open_style" int4,
  "icon" varchar(50) COLLATE "pg_catalog"."default",
  "sort" int4,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "sa_view" int4,
  "description" varchar COLLATE "pg_catalog"."default",
  "model" varchar(4) COLLATE "pg_catalog"."default",
  "model_url" varchar(1024) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."sys_menu"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_menu"."pid" IS '上级ID，一级菜单为0';
COMMENT ON COLUMN "public"."sys_menu"."url" IS '菜单URL';
COMMENT ON COLUMN "public"."sys_menu"."permissions" IS '授权(多个用逗号分隔，如：sys:user:list,sys:user:save)';
COMMENT ON COLUMN "public"."sys_menu"."type" IS '类型   0：菜单   1：按钮';
COMMENT ON COLUMN "public"."sys_menu"."open_style" IS '打开方式   0：内部   1：外部';
COMMENT ON COLUMN "public"."sys_menu"."icon" IS '菜单图标';
COMMENT ON COLUMN "public"."sys_menu"."sort" IS '排序';
COMMENT ON COLUMN "public"."sys_menu"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_menu"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_menu"."updater" IS '更新者';
COMMENT ON COLUMN "public"."sys_menu"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."sys_menu"."sa_view" IS '超管是否可见   0：否   1：是';
COMMENT ON COLUMN "public"."sys_menu"."description" IS '说明';
COMMENT ON COLUMN "public"."sys_menu"."model" IS '导航';
COMMENT ON COLUMN "public"."sys_menu"."model_url" IS '导航图标';
COMMENT ON TABLE "public"."sys_menu" IS '菜单管理';

-- ----------------------------
-- Table structure for sys_notice
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_notice";
CREATE TABLE "public"."sys_notice" (
  "id" int8 NOT NULL,
  "type" int4 NOT NULL,
  "title" varchar(200) COLLATE "pg_catalog"."default",
  "content" text COLLATE "pg_catalog"."default",
  "receiver_type" int4,
  "receiver_type_ids" varchar(500) COLLATE "pg_catalog"."default",
  "status" int4,
  "sender_name" varchar(50) COLLATE "pg_catalog"."default",
  "sender_date" timestamp(6),
  "creator" int8,
  "create_date" timestamp(6)
)
;
COMMENT ON COLUMN "public"."sys_notice"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_notice"."type" IS '通知类型';
COMMENT ON COLUMN "public"."sys_notice"."title" IS '标题';
COMMENT ON COLUMN "public"."sys_notice"."content" IS '内容';
COMMENT ON COLUMN "public"."sys_notice"."receiver_type" IS '接收者  0：全部  1：部门';
COMMENT ON COLUMN "public"."sys_notice"."receiver_type_ids" IS '接收者ID，用逗号分开';
COMMENT ON COLUMN "public"."sys_notice"."status" IS '发送状态  0：草稿  1：已发布';
COMMENT ON COLUMN "public"."sys_notice"."sender_name" IS '发送者';
COMMENT ON COLUMN "public"."sys_notice"."sender_date" IS '发送时间';
COMMENT ON COLUMN "public"."sys_notice"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_notice"."create_date" IS '创建时间';
COMMENT ON TABLE "public"."sys_notice" IS '通知管理';

-- ----------------------------
-- Table structure for sys_notice_user
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_notice_user";
CREATE TABLE "public"."sys_notice_user" (
  "receiver_id" int8 NOT NULL,
  "notice_id" int8 NOT NULL,
  "read_status" int4 NOT NULL,
  "read_date" timestamp(6)
)
;
COMMENT ON COLUMN "public"."sys_notice_user"."receiver_id" IS '接收者ID';
COMMENT ON COLUMN "public"."sys_notice_user"."notice_id" IS '通知ID';
COMMENT ON COLUMN "public"."sys_notice_user"."read_status" IS '阅读状态  0：未读  1：已读';
COMMENT ON COLUMN "public"."sys_notice_user"."read_date" IS '阅读时间';
COMMENT ON TABLE "public"."sys_notice_user" IS '我的通知';

-- ----------------------------
-- Table structure for sys_oss
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_oss";
CREATE TABLE "public"."sys_oss" (
  "id" int8 NOT NULL,
  "url" varchar(200) COLLATE "pg_catalog"."default",
  "type" varchar(5) COLLATE "pg_catalog"."default",
  "single" bool,
  "creator" int8,
  "create_date" int8
)
;
COMMENT ON COLUMN "public"."sys_oss"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_oss"."url" IS 'URL地址';
COMMENT ON COLUMN "public"."sys_oss"."type" IS '文件类型';
COMMENT ON COLUMN "public"."sys_oss"."single" IS '是否唯一';
COMMENT ON TABLE "public"."sys_oss" IS '文件上传';

-- ----------------------------
-- Table structure for sys_params
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_params";
CREATE TABLE "public"."sys_params" (
  "id" int8 NOT NULL,
  "param_code" varchar(32) COLLATE "pg_catalog"."default",
  "param_value" varchar(2000) COLLATE "pg_catalog"."default",
  "param_type" int4 NOT NULL DEFAULT 1,
  "remark" varchar(200) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."sys_params"."param_code" IS '参数编码';
COMMENT ON COLUMN "public"."sys_params"."param_value" IS '参数值';
COMMENT ON COLUMN "public"."sys_params"."param_type" IS '类型   0：系统参数   1：非系统参数';
COMMENT ON COLUMN "public"."sys_params"."remark" IS '备注';
COMMENT ON COLUMN "public"."sys_params"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_params"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_params"."updater" IS '更新者';
COMMENT ON COLUMN "public"."sys_params"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."sys_params" IS '参数管理';

-- ----------------------------
-- Table structure for sys_post
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_post";
CREATE TABLE "public"."sys_post" (
  "id" int8 NOT NULL,
  "post_code" varchar(100) COLLATE "pg_catalog"."default",
  "post_name" varchar(100) COLLATE "pg_catalog"."default",
  "sort" int4,
  "status" int4,
  "tenant_code" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."sys_post"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_post"."post_code" IS '岗位编码';
COMMENT ON COLUMN "public"."sys_post"."post_name" IS '岗位名称';
COMMENT ON COLUMN "public"."sys_post"."sort" IS '排序';
COMMENT ON COLUMN "public"."sys_post"."status" IS '状态  0：停用   1：正常';
COMMENT ON COLUMN "public"."sys_post"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."sys_post"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_post"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_post"."updater" IS '更新者';
COMMENT ON COLUMN "public"."sys_post"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."sys_post" IS '岗位管理';

-- ----------------------------
-- Table structure for sys_region
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_region";
CREATE TABLE "public"."sys_region" (
  "id" int8 NOT NULL,
  "pid" int8,
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "tree_level" int4,
  "leaf" int4,
  "sort" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."sys_region"."pid" IS '上级ID';
COMMENT ON COLUMN "public"."sys_region"."name" IS '名称';
COMMENT ON COLUMN "public"."sys_region"."tree_level" IS '层级';
COMMENT ON COLUMN "public"."sys_region"."leaf" IS '是否叶子节点  0：否   1：是';
COMMENT ON COLUMN "public"."sys_region"."sort" IS '排序';
COMMENT ON COLUMN "public"."sys_region"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_region"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_region"."updater" IS '更新者';
COMMENT ON COLUMN "public"."sys_region"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."sys_region" IS '行政区域';

-- ----------------------------
-- Table structure for sys_region_weather
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_region_weather";
CREATE TABLE "public"."sys_region_weather" (
  "region_id" int8,
  "weather_code" int8,
  "weather_name" varchar(255) COLLATE "pg_catalog"."default",
  "id" int8 NOT NULL
)
;
COMMENT ON COLUMN "public"."sys_region_weather"."region_id" IS '区域编码';
COMMENT ON COLUMN "public"."sys_region_weather"."weather_code" IS '天气城市编码';
COMMENT ON TABLE "public"."sys_region_weather" IS '区域对应天气编码';

-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_role";
CREATE TABLE "public"."sys_role" (
  "id" int8 NOT NULL,
  "name" varchar(50) COLLATE "pg_catalog"."default",
  "remark" varchar(100) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "tenant_code" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "default_role" bool,
  "company_id" int8,
  "type" varchar(5) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."sys_role"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_role"."name" IS '角色名称';
COMMENT ON COLUMN "public"."sys_role"."remark" IS '备注';
COMMENT ON COLUMN "public"."sys_role"."dept_id" IS '部门ID';
COMMENT ON COLUMN "public"."sys_role"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."sys_role"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_role"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_role"."updater" IS '更新者';
COMMENT ON COLUMN "public"."sys_role"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."sys_role"."default_role" IS '是否默认角色';
COMMENT ON COLUMN "public"."sys_role"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."sys_role"."type" IS '角色类型,0-企业角色,1-用户角色';
COMMENT ON TABLE "public"."sys_role" IS '角色管理';

-- ----------------------------
-- Table structure for sys_role_data_scope
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_role_data_scope";
CREATE TABLE "public"."sys_role_data_scope" (
  "id" int8 NOT NULL,
  "role_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8
)
;
COMMENT ON COLUMN "public"."sys_role_data_scope"."role_id" IS '角色ID';
COMMENT ON COLUMN "public"."sys_role_data_scope"."dept_id" IS '部门ID';
COMMENT ON COLUMN "public"."sys_role_data_scope"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_role_data_scope"."create_date" IS '创建时间';
COMMENT ON TABLE "public"."sys_role_data_scope" IS '角色数据权限';

-- ----------------------------
-- Table structure for sys_role_menu
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_role_menu";
CREATE TABLE "public"."sys_role_menu" (
  "id" int8 NOT NULL,
  "role_id" int8,
  "menu_id" int8,
  "creator" int8,
  "create_date" int8
)
;
COMMENT ON COLUMN "public"."sys_role_menu"."role_id" IS '角色ID';
COMMENT ON COLUMN "public"."sys_role_menu"."menu_id" IS '菜单ID';
COMMENT ON COLUMN "public"."sys_role_menu"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_role_menu"."create_date" IS '创建时间';
COMMENT ON TABLE "public"."sys_role_menu" IS '角色菜单关系';

-- ----------------------------
-- Table structure for sys_role_user
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_role_user";
CREATE TABLE "public"."sys_role_user" (
  "id" int8 NOT NULL,
  "role_id" int8,
  "user_id" int8,
  "creator" int8,
  "create_date" int8
)
;
COMMENT ON COLUMN "public"."sys_role_user"."role_id" IS '角色ID';
COMMENT ON COLUMN "public"."sys_role_user"."user_id" IS '用户ID';
COMMENT ON COLUMN "public"."sys_role_user"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_role_user"."create_date" IS '创建时间';
COMMENT ON TABLE "public"."sys_role_user" IS '角色用户关系';

-- ----------------------------
-- Table structure for sys_sms
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_sms";
CREATE TABLE "public"."sys_sms" (
  "id" int8 NOT NULL,
  "sms_code" varchar(32) COLLATE "pg_catalog"."default",
  "platform" int4,
  "sms_config" varchar(2000) COLLATE "pg_catalog"."default",
  "remark" varchar(200) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."sys_sms"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_sms"."sms_code" IS '短信编码';
COMMENT ON COLUMN "public"."sys_sms"."platform" IS '平台类型';
COMMENT ON COLUMN "public"."sys_sms"."sms_config" IS '短信配置';
COMMENT ON COLUMN "public"."sys_sms"."remark" IS '备注';
COMMENT ON COLUMN "public"."sys_sms"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_sms"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_sms"."updater" IS '更新者';
COMMENT ON COLUMN "public"."sys_sms"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."sys_sms" IS '短信';

-- ----------------------------
-- Table structure for sys_sms_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_sms_log";
CREATE TABLE "public"."sys_sms_log" (
  "id" int8 NOT NULL,
  "sms_code" varchar(32) COLLATE "pg_catalog"."default",
  "platform" int4,
  "mobile" varchar(20) COLLATE "pg_catalog"."default",
  "params_1" varchar(50) COLLATE "pg_catalog"."default",
  "params_2" varchar(50) COLLATE "pg_catalog"."default",
  "params_3" varchar(50) COLLATE "pg_catalog"."default",
  "params_4" varchar(50) COLLATE "pg_catalog"."default",
  "status" int4,
  "creator" int8,
  "create_date" int8
)
;
COMMENT ON COLUMN "public"."sys_sms_log"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_sms_log"."sms_code" IS '短信编码';
COMMENT ON COLUMN "public"."sys_sms_log"."platform" IS '平台类型';
COMMENT ON COLUMN "public"."sys_sms_log"."mobile" IS '手机号';
COMMENT ON COLUMN "public"."sys_sms_log"."params_1" IS '参数1';
COMMENT ON COLUMN "public"."sys_sms_log"."params_2" IS '参数2';
COMMENT ON COLUMN "public"."sys_sms_log"."params_3" IS '参数3';
COMMENT ON COLUMN "public"."sys_sms_log"."params_4" IS '参数4';
COMMENT ON COLUMN "public"."sys_sms_log"."status" IS '发送状态  0：失败  1：成功';
COMMENT ON COLUMN "public"."sys_sms_log"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_sms_log"."create_date" IS '创建时间';
COMMENT ON TABLE "public"."sys_sms_log" IS '短信发送记录';

-- ----------------------------
-- Table structure for sys_tenant
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_tenant";
CREATE TABLE "public"."sys_tenant" (
  "id" int8 NOT NULL,
  "tenant_code" int8,
  "tenant_name" varchar(50) COLLATE "pg_catalog"."default",
  "status" int4,
  "remark" varchar(200) COLLATE "pg_catalog"."default",
  "user_id" int8,
  "username" varchar(50) COLLATE "pg_catalog"."default",
  "del_flag" int4,
  "sys_tenant" int4,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "tenant_type" int4,
  "thing_code" varchar(50) COLLATE "pg_catalog"."default",
  "enterprise_quantity" int4,
  "enterprise_users" int4,
  "enterprise_things" int4
)
;
COMMENT ON COLUMN "public"."sys_tenant"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_tenant"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."sys_tenant"."tenant_name" IS '租户名称';
COMMENT ON COLUMN "public"."sys_tenant"."status" IS '状态  0：停用    1：正常';
COMMENT ON COLUMN "public"."sys_tenant"."remark" IS '备注';
COMMENT ON COLUMN "public"."sys_tenant"."user_id" IS '登录账号ID';
COMMENT ON COLUMN "public"."sys_tenant"."username" IS '登录账号';
COMMENT ON COLUMN "public"."sys_tenant"."del_flag" IS '删除标识 0：未删除    1：删除';
COMMENT ON COLUMN "public"."sys_tenant"."sys_tenant" IS '系统租户   0：否   1：是';
COMMENT ON COLUMN "public"."sys_tenant"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_tenant"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_tenant"."updater" IS '更新者';
COMMENT ON COLUMN "public"."sys_tenant"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."sys_tenant"."tenant_type" IS '企业类型(0：企业、1：租户)';
COMMENT ON COLUMN "public"."sys_tenant"."thing_code" IS '企业物编码';
COMMENT ON COLUMN "public"."sys_tenant"."enterprise_quantity" IS '企业数量';
COMMENT ON COLUMN "public"."sys_tenant"."enterprise_users" IS '企业用户数量';
COMMENT ON COLUMN "public"."sys_tenant"."enterprise_things" IS '企业物数量';
COMMENT ON TABLE "public"."sys_tenant" IS '租户管理';

-- ----------------------------
-- Table structure for sys_tenant_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_tenant_detail";
CREATE TABLE "public"."sys_tenant_detail" (
  "id" int8 NOT NULL,
  "name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "corporation_code" varchar(32) COLLATE "pg_catalog"."default",
  "industry_category" varchar(64) COLLATE "pg_catalog"."default",
  "industry_type" varchar(64) COLLATE "pg_catalog"."default",
  "region_code" varchar(32) COLLATE "pg_catalog"."default",
  "address" varchar(255) COLLATE "pg_catalog"."default",
  "contact" varchar(20) COLLATE "pg_catalog"."default",
  "contact_number" varchar(20) COLLATE "pg_catalog"."default",
  "email" varchar(320) COLLATE "pg_catalog"."default",
  "url" varchar(255) COLLATE "pg_catalog"."default",
  "lng_lat" varchar(255) COLLATE "pg_catalog"."default",
  "logo_url" varchar(255) COLLATE "pg_catalog"."default",
  "image_url" varchar(255) COLLATE "pg_catalog"."default",
  "remark" varchar COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "english_name" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."sys_tenant_detail"."id" IS '主键';
COMMENT ON COLUMN "public"."sys_tenant_detail"."name" IS '名称';
COMMENT ON COLUMN "public"."sys_tenant_detail"."corporation_code" IS '统一社会信用识别码';
COMMENT ON COLUMN "public"."sys_tenant_detail"."industry_category" IS '行业门类， industry_type中的二级类型';
COMMENT ON COLUMN "public"."sys_tenant_detail"."industry_type" IS '行业大类，industry_type中的顶级类型';
COMMENT ON COLUMN "public"."sys_tenant_detail"."region_code" IS '地区';
COMMENT ON COLUMN "public"."sys_tenant_detail"."address" IS '地址';
COMMENT ON COLUMN "public"."sys_tenant_detail"."contact" IS '联系人';
COMMENT ON COLUMN "public"."sys_tenant_detail"."contact_number" IS '联系电话';
COMMENT ON COLUMN "public"."sys_tenant_detail"."email" IS '邮箱';
COMMENT ON COLUMN "public"."sys_tenant_detail"."url" IS '企业官网';
COMMENT ON COLUMN "public"."sys_tenant_detail"."lng_lat" IS '经纬度';
COMMENT ON COLUMN "public"."sys_tenant_detail"."logo_url" IS 'logo';
COMMENT ON COLUMN "public"."sys_tenant_detail"."image_url" IS '企业图片';
COMMENT ON COLUMN "public"."sys_tenant_detail"."remark" IS '企业描述';
COMMENT ON COLUMN "public"."sys_tenant_detail"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_tenant_detail"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_tenant_detail"."updater" IS '更新者';
COMMENT ON COLUMN "public"."sys_tenant_detail"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."sys_tenant_detail"."english_name" IS '企业英文名';
COMMENT ON TABLE "public"."sys_tenant_detail" IS '企业详情';

-- ----------------------------
-- Table structure for sys_tenant_group
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_tenant_group";
CREATE TABLE "public"."sys_tenant_group" (
  "id" int8 NOT NULL,
  "parent_code" int8,
  "code" int8,
  "creator" int8,
  "create_date" int8,
  "parent_modify_code" int8
)
;
COMMENT ON COLUMN "public"."sys_tenant_group"."parent_code" IS '父租户code';
COMMENT ON COLUMN "public"."sys_tenant_group"."code" IS '子租户code';
COMMENT ON COLUMN "public"."sys_tenant_group"."parent_modify_code" IS '父级可修改节点code';
COMMENT ON TABLE "public"."sys_tenant_group" IS '租户组关系表';

-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_user";
CREATE TABLE "public"."sys_user" (
  "id" int8 NOT NULL,
  "username" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "password" varchar(100) COLLATE "pg_catalog"."default",
  "real_name" varchar(50) COLLATE "pg_catalog"."default",
  "head_url" varchar(200) COLLATE "pg_catalog"."default",
  "gender" int4,
  "email" varchar(100) COLLATE "pg_catalog"."default",
  "mobile" varchar(100) COLLATE "pg_catalog"."default",
  "dept_id" int8,
  "super_admin" int4,
  "super_tenant" int4,
  "status" int4,
  "tenant_code" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "open_id" varchar(100) COLLATE "pg_catalog"."default",
  "tenant_group" int4,
  "url" varchar(255) COLLATE "pg_catalog"."default",
  "tenant_list" varchar(2550) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."sys_user"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_user"."username" IS '用户名';
COMMENT ON COLUMN "public"."sys_user"."password" IS '密码';
COMMENT ON COLUMN "public"."sys_user"."real_name" IS '姓名';
COMMENT ON COLUMN "public"."sys_user"."head_url" IS '头像';
COMMENT ON COLUMN "public"."sys_user"."gender" IS '性别   0：男   1：女    2：保密';
COMMENT ON COLUMN "public"."sys_user"."email" IS '邮箱';
COMMENT ON COLUMN "public"."sys_user"."mobile" IS '手机号';
COMMENT ON COLUMN "public"."sys_user"."dept_id" IS '部门ID';
COMMENT ON COLUMN "public"."sys_user"."super_admin" IS '超级管理员   0：否   1：是';
COMMENT ON COLUMN "public"."sys_user"."super_tenant" IS '租户管理员   0：否   1：是';
COMMENT ON COLUMN "public"."sys_user"."status" IS '状态  0：停用    1：正常';
COMMENT ON COLUMN "public"."sys_user"."tenant_code" IS '租户编码';
COMMENT ON COLUMN "public"."sys_user"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_user"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_user"."updater" IS '更新者';
COMMENT ON COLUMN "public"."sys_user"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."sys_user"."open_id" IS '微信授权openId';
COMMENT ON COLUMN "public"."sys_user"."tenant_group" IS '租户组管理员   0：否   1：是';
COMMENT ON COLUMN "public"."sys_user"."url" IS '路由地址';
COMMENT ON COLUMN "public"."sys_user"."tenant_list" IS '用户可操作企业tenant_code列表';
COMMENT ON TABLE "public"."sys_user" IS '用户管理';

-- ----------------------------
-- Table structure for sys_user_menu
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_user_menu";
CREATE TABLE "public"."sys_user_menu" (
  "id" int8 NOT NULL,
  "user_id" int8,
  "menu_id" int8,
  "url" varchar(255) COLLATE "pg_catalog"."default",
  "show_logo" bool,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "logo" varchar(255) COLLATE "pg_catalog"."default",
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "tenant_code" int8
)
;
COMMENT ON COLUMN "public"."sys_user_menu"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_user_menu"."user_id" IS '登录用户';
COMMENT ON COLUMN "public"."sys_user_menu"."menu_id" IS '菜单id';
COMMENT ON COLUMN "public"."sys_user_menu"."url" IS '菜单URL';
COMMENT ON COLUMN "public"."sys_user_menu"."show_logo" IS '是否缩进展示logo';
COMMENT ON COLUMN "public"."sys_user_menu"."creator" IS '创建者';
COMMENT ON COLUMN "public"."sys_user_menu"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."sys_user_menu"."updater" IS '更新者';
COMMENT ON COLUMN "public"."sys_user_menu"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."sys_user_menu"."logo" IS 'logo';
COMMENT ON COLUMN "public"."sys_user_menu"."name" IS '平台名称';
COMMENT ON TABLE "public"."sys_user_menu" IS '用户菜单关系表';

-- ----------------------------
-- Table structure for sys_user_post
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_user_post";
CREATE TABLE "public"."sys_user_post" (
  "id" int8 NOT NULL,
  "post_id" int8,
  "user_id" int8,
  "creator" int8,
  "create_date" int8
)
;
COMMENT ON COLUMN "public"."sys_user_post"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_user_post"."post_id" IS '岗位ID';
COMMENT ON COLUMN "public"."sys_user_post"."user_id" IS '用户ID';
COMMENT ON TABLE "public"."sys_user_post" IS '用户岗位关系';

-- ----------------------------
-- Table structure for sys_user_token
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_user_token";
CREATE TABLE "public"."sys_user_token" (
  "id" int8 NOT NULL,
  "user_id" int8,
  "token" varchar(100) COLLATE "pg_catalog"."default",
  "expire_date" timestamp(6),
  "update_date" timestamp(6),
  "create_date" timestamp(6)
)
;
COMMENT ON COLUMN "public"."sys_user_token"."id" IS 'id';
COMMENT ON COLUMN "public"."sys_user_token"."user_id" IS '用户id';
COMMENT ON COLUMN "public"."sys_user_token"."token" IS '用户token';
COMMENT ON COLUMN "public"."sys_user_token"."expire_date" IS '过期时间';
COMMENT ON COLUMN "public"."sys_user_token"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."sys_user_token"."create_date" IS '创建时间';
COMMENT ON TABLE "public"."sys_user_token" IS '系统用户Token';

-- ----------------------------
-- Table structure for tenant_common_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."tenant_common_config";
CREATE TABLE "public"."tenant_common_config" (
  "id" int8 NOT NULL,
  "config_key" varchar(64) COLLATE "pg_catalog"."default",
  "config_name" varchar(64) COLLATE "pg_catalog"."default",
  "config_value" varchar COLLATE "pg_catalog"."default",
  "config_type" int4,
  "remark" varchar(256) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."tenant_common_config"."id" IS '主键id';
COMMENT ON COLUMN "public"."tenant_common_config"."config_key" IS '配置主键';
COMMENT ON COLUMN "public"."tenant_common_config"."config_name" IS '配置名称';
COMMENT ON COLUMN "public"."tenant_common_config"."config_value" IS '配置值';
COMMENT ON COLUMN "public"."tenant_common_config"."config_type" IS '配置类型';
COMMENT ON COLUMN "public"."tenant_common_config"."remark" IS '描述';
COMMENT ON COLUMN "public"."tenant_common_config"."tenant_code" IS '租户code';
COMMENT ON COLUMN "public"."tenant_common_config"."company_id" IS '公司id';
COMMENT ON COLUMN "public"."tenant_common_config"."dept_id" IS '顶级部门id';
COMMENT ON COLUMN "public"."tenant_common_config"."creator" IS '创建者';
COMMENT ON COLUMN "public"."tenant_common_config"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."tenant_common_config"."updater" IS '更新者';
COMMENT ON COLUMN "public"."tenant_common_config"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."tenant_common_config" IS '租户配置信息表';

-- ----------------------------
-- Table structure for thing_ts_kv
-- ----------------------------
DROP TABLE IF EXISTS "public"."thing_ts_kv";
CREATE TABLE "public"."thing_ts_kv" (
  "thing_code" varchar(255) COLLATE "pg_catalog"."default",
  "attr_key" varchar(255) COLLATE "pg_catalog"."default",
  "ts" numeric,
  "val" text COLLATE "pg_catalog"."default",
  "year" int4,
  "month" int4,
  "day" int4,
  "hour" int4,
  "minute" int4
)
;

-- ----------------------------
-- Table structure for thing_ts_kv_external
-- ----------------------------
DROP TABLE IF EXISTS "public"."thing_ts_kv_external";
CREATE TABLE "public"."thing_ts_kv_external" (
  "thing_code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "attr_key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "ts" int8 NOT NULL,
  "val" text COLLATE "pg_catalog"."default" NOT NULL,
  "year" int4,
  "month" int4,
  "day" int4,
  "hour" int4,
  "minute" int4
)
;
COMMENT ON COLUMN "public"."thing_ts_kv_external"."thing_code" IS '物编码';
COMMENT ON COLUMN "public"."thing_ts_kv_external"."attr_key" IS '属性编码';
COMMENT ON COLUMN "public"."thing_ts_kv_external"."ts" IS '时间';
COMMENT ON COLUMN "public"."thing_ts_kv_external"."val" IS '属性值';
COMMENT ON TABLE "public"."thing_ts_kv_external" IS 'tsvk 外部数据，按规则生成的，手动维护的，接入的等无需计算的属性数据';

-- ----------------------------
-- Table structure for transport_extend
-- ----------------------------
DROP TABLE IF EXISTS "public"."transport_extend";
CREATE TABLE "public"."transport_extend" (
  "id" int8 NOT NULL,
  "type" varchar(25) COLLATE "pg_catalog"."default",
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "configuration" varchar COLLATE "pg_catalog"."default",
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "company_id" int8,
  "dept_id" int8,
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."transport_extend"."id" IS '主键';
COMMENT ON COLUMN "public"."transport_extend"."type" IS '类型';
COMMENT ON COLUMN "public"."transport_extend"."name" IS '名称';
COMMENT ON COLUMN "public"."transport_extend"."configuration" IS '配置';
COMMENT ON COLUMN "public"."transport_extend"."remark" IS '备注';
COMMENT ON COLUMN "public"."transport_extend"."tenant_code" IS '所属企业(租户code)';
COMMENT ON COLUMN "public"."transport_extend"."company_id" IS '企业详情id';
COMMENT ON COLUMN "public"."transport_extend"."dept_id" IS '部门id';
COMMENT ON COLUMN "public"."transport_extend"."creator" IS '创建者';
COMMENT ON COLUMN "public"."transport_extend"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."transport_extend"."updater" IS '更新者';
COMMENT ON COLUMN "public"."transport_extend"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."transport_extend" IS '通讯配置';

-- ----------------------------
-- Table structure for transport_extend_calculation
-- ----------------------------
DROP TABLE IF EXISTS "public"."transport_extend_calculation";
CREATE TABLE "public"."transport_extend_calculation" (
  "id" int8 NOT NULL,
  "config_id" int8,
  "configuration" varchar COLLATE "pg_catalog"."default",
  "remark" varchar(500) COLLATE "pg_catalog"."default",
  "calculation_id" int8,
  "debug" bool,
  "type" varchar(5) COLLATE "pg_catalog"."default",
  "addr" varchar(255) COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8
)
;
COMMENT ON COLUMN "public"."transport_extend_calculation"."id" IS '主键';
COMMENT ON COLUMN "public"."transport_extend_calculation"."config_id" IS '通讯配置主键';
COMMENT ON COLUMN "public"."transport_extend_calculation"."configuration" IS '配置';
COMMENT ON COLUMN "public"."transport_extend_calculation"."remark" IS '备注';
COMMENT ON COLUMN "public"."transport_extend_calculation"."calculation_id" IS '计算主键';
COMMENT ON COLUMN "public"."transport_extend_calculation"."debug" IS '是否调试';
COMMENT ON COLUMN "public"."transport_extend_calculation"."type" IS '类型(读/写/读写)';
COMMENT ON COLUMN "public"."transport_extend_calculation"."addr" IS '配置json的地址(展示用)';
COMMENT ON COLUMN "public"."transport_extend_calculation"."creator" IS '创建者';
COMMENT ON COLUMN "public"."transport_extend_calculation"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."transport_extend_calculation"."updater" IS '更新者';
COMMENT ON COLUMN "public"."transport_extend_calculation"."update_date" IS '更新时间';
COMMENT ON TABLE "public"."transport_extend_calculation" IS '通讯配置关联计算';

-- ----------------------------
-- Table structure for transport_extend_msg
-- ----------------------------
DROP TABLE IF EXISTS "public"."transport_extend_msg";
CREATE TABLE "public"."transport_extend_msg" (
  "id" int8 NOT NULL,
  "config_id" int8,
  "input_msg" varchar COLLATE "pg_catalog"."default",
  "output_msg" varchar COLLATE "pg_catalog"."default",
  "creator" int8,
  "create_date" int8,
  "updater" int8,
  "update_date" int8,
  "error_msg" varchar COLLATE "pg_catalog"."default",
  "extend_calculation_id" int8,
  "company_d" int8,
  "debug" bool,
  "dept_id" int8,
  "origin" varchar(255) COLLATE "pg_catalog"."default",
  "tenant_code" int8,
  "ts" int8
)
;
COMMENT ON COLUMN "public"."transport_extend_msg"."id" IS '主键';
COMMENT ON COLUMN "public"."transport_extend_msg"."config_id" IS '通讯配置主键';
COMMENT ON COLUMN "public"."transport_extend_msg"."input_msg" IS '原始数据';
COMMENT ON COLUMN "public"."transport_extend_msg"."output_msg" IS '转换后数据';
COMMENT ON COLUMN "public"."transport_extend_msg"."creator" IS '创建者';
COMMENT ON COLUMN "public"."transport_extend_msg"."create_date" IS '创建时间';
COMMENT ON COLUMN "public"."transport_extend_msg"."updater" IS '更新者';
COMMENT ON COLUMN "public"."transport_extend_msg"."update_date" IS '更新时间';
COMMENT ON COLUMN "public"."transport_extend_msg"."error_msg" IS '错误消息';
COMMENT ON COLUMN "public"."transport_extend_msg"."extend_calculation_id" IS '通讯配置计算关系主键';
COMMENT ON TABLE "public"."transport_extend_msg" IS '通讯数据日志';

-- ----------------------------
-- Table structure for ts_kv_latest
-- ----------------------------
DROP TABLE IF EXISTS "public"."ts_kv_latest";
CREATE TABLE "public"."ts_kv_latest" (
  "thing_code" varchar(255) COLLATE "pg_catalog"."default",
  "attr_key" varchar(255) COLLATE "pg_catalog"."default",
  "ts" numeric,
  "val" text COLLATE "pg_catalog"."default",
  "year" int4,
  "month" int4,
  "day" int4,
  "hour" int4,
  "minute" int4
)
;

-- ----------------------------
-- Uniques structure for table calc_log
-- ----------------------------
ALTER TABLE "public"."calc_log" ADD CONSTRAINT "calc_log_uk" UNIQUE ("calc_target_config_id", "time");
COMMENT ON CONSTRAINT "calc_log_uk" ON "public"."calc_log" IS '物计算日志唯一键';

-- ----------------------------
-- Primary Key structure for table calc_log
-- ----------------------------
ALTER TABLE "public"."calc_log" ADD CONSTRAINT "calc_log_pk" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table calc_source_config
-- ----------------------------
ALTER TABLE "public"."calc_source_config" ADD CONSTRAINT "calc_source_config_pk" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table calc_target_config
-- ----------------------------
ALTER TABLE "public"."calc_target_config" ADD CONSTRAINT "calc_target_config_pk" PRIMARY KEY ("id");

-- ----------------------------
-- Uniques structure for table carbon_energy_dict_relation
-- ----------------------------
ALTER TABLE "public"."carbon_energy_dict_relation" ADD CONSTRAINT "unique_attr_code" UNIQUE ("attr_code");

-- ----------------------------
-- Primary Key structure for table carbon_energy_dict_relation
-- ----------------------------
ALTER TABLE "public"."carbon_energy_dict_relation" ADD CONSTRAINT "carbon_energy_dict_relation_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table carbon_pub_material_factor
-- ----------------------------
ALTER TABLE "public"."carbon_pub_material_factor" ADD CONSTRAINT "carbon_pub_material_factor_pk" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table carbon_pub_points_logs
-- ----------------------------
ALTER TABLE "public"."carbon_pub_points_logs" ADD CONSTRAINT "carbon_pub_points_logs_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_attacment
-- ----------------------------
ALTER TABLE "public"."eq_attacment" ADD CONSTRAINT "eq_attacment_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table eq_bx
-- ----------------------------
CREATE UNIQUE INDEX "bx_no" ON "public"."eq_bx" USING btree (
  "bx_no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table eq_bx
-- ----------------------------
ALTER TABLE "public"."eq_bx" ADD CONSTRAINT "eq_bx_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_by
-- ----------------------------
ALTER TABLE "public"."eq_by" ADD CONSTRAINT "eq_by_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_by_detail
-- ----------------------------
ALTER TABLE "public"."eq_by_detail" ADD CONSTRAINT "eq_by_detail_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_by_plan
-- ----------------------------
ALTER TABLE "public"."eq_by_plan" ADD CONSTRAINT "eq_by_plan_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_by_plan_part
-- ----------------------------
ALTER TABLE "public"."eq_by_plan_part" ADD CONSTRAINT "eq_by_plan_part_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_by_template
-- ----------------------------
ALTER TABLE "public"."eq_by_template" ADD CONSTRAINT "eq_by_template_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_by_template_detail
-- ----------------------------
ALTER TABLE "public"."eq_by_template_detail" ADD CONSTRAINT "eq_by_template_detail_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_check_result
-- ----------------------------
ALTER TABLE "public"."eq_check_result" ADD CONSTRAINT "check_result_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_check_setting
-- ----------------------------
ALTER TABLE "public"."eq_check_setting" ADD CONSTRAINT "eq_check_setting_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_check_standard
-- ----------------------------
ALTER TABLE "public"."eq_check_standard" ADD CONSTRAINT "eq_check_standard_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_check_standard_detail
-- ----------------------------
ALTER TABLE "public"."eq_check_standard_detail" ADD CONSTRAINT "eq_check_standard_detail_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_file_delete
-- ----------------------------
ALTER TABLE "public"."eq_file_delete" ADD CONSTRAINT "eq_file_delete_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_file_manage
-- ----------------------------
ALTER TABLE "public"."eq_file_manage" ADD CONSTRAINT "file_manage_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_part_record
-- ----------------------------
ALTER TABLE "public"."eq_part_record" ADD CONSTRAINT "eq_part_record_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_patrol_check_plan
-- ----------------------------
ALTER TABLE "public"."eq_patrol_check_plan" ADD CONSTRAINT "eq_patrolcheck_plan_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_patrol_check_record
-- ----------------------------
ALTER TABLE "public"."eq_patrol_check_record" ADD CONSTRAINT "eq_patrol_check_record_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_plan_record
-- ----------------------------
ALTER TABLE "public"."eq_plan_record" ADD CONSTRAINT "eq_plan_record_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_plan_remind_record
-- ----------------------------
ALTER TABLE "public"."eq_plan_remind_record" ADD CONSTRAINT "eq_plan_remind_record_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_scrap
-- ----------------------------
ALTER TABLE "public"."eq_scrap" ADD CONSTRAINT "eq_scrap_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_spot_check_plan
-- ----------------------------
ALTER TABLE "public"."eq_spot_check_plan" ADD CONSTRAINT "eq_spot_check_plan_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_spot_check_record
-- ----------------------------
ALTER TABLE "public"."eq_spot_check_record" ADD CONSTRAINT "eq_spot_check_record_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_user_group
-- ----------------------------
ALTER TABLE "public"."eq_user_group" ADD CONSTRAINT "eq_user_group_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_wx
-- ----------------------------
ALTER TABLE "public"."eq_wx" ADD CONSTRAINT "eq_wx_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table eq_wx_plan
-- ----------------------------
CREATE UNIQUE INDEX "wx_no" ON "public"."eq_wx_plan" USING btree (
  "wx_no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table eq_wx_plan
-- ----------------------------
ALTER TABLE "public"."eq_wx_plan" ADD CONSTRAINT "eq_wx_plan_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table eq_wx_replacement
-- ----------------------------
ALTER TABLE "public"."eq_wx_replacement" ADD CONSTRAINT "wx_change_replacement_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table gateway_component
-- ----------------------------
ALTER TABLE "public"."gateway_component" ADD CONSTRAINT "gateway_component_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table gateway_component_config
-- ----------------------------
ALTER TABLE "public"."gateway_component_config" ADD CONSTRAINT "gateway_component_config_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table gateway_component_instance
-- ----------------------------
ALTER TABLE "public"."gateway_component_instance" ADD CONSTRAINT "gateway_component_instance_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table iot_carbon_outbound_config
-- ----------------------------
ALTER TABLE "public"."iot_carbon_outbound_config" ADD CONSTRAINT "iot_carbon_outbound_config_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table iot_carbon_production_custom
-- ----------------------------
ALTER TABLE "public"."iot_carbon_production_custom" ADD CONSTRAINT "iot_carbon_production_custom_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table iot_device_management
-- ----------------------------
ALTER TABLE "public"."iot_device_management" ADD CONSTRAINT "iot_device_management_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table iot_thing_base_info
-- ----------------------------
CREATE UNIQUE INDEX "thing_id" ON "public"."iot_thing_base_info" USING btree (
  "thing_id" "pg_catalog"."int8_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table iot_thing_base_info
-- ----------------------------
ALTER TABLE "public"."iot_thing_base_info" ADD CONSTRAINT "iot_thing_base_info_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table iot_thing_dict_relation
-- ----------------------------
ALTER TABLE "public"."iot_thing_dict_relation" ADD CONSTRAINT "iot_thing_dict_relation_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Uniques structure for table iot_thing_entity
-- ----------------------------
ALTER TABLE "public"."iot_thing_entity" ADD CONSTRAINT "unique_code_tenant" UNIQUE ("code", "tenant_code");

-- ----------------------------
-- Primary Key structure for table iot_thing_entity
-- ----------------------------
ALTER TABLE "public"."iot_thing_entity" ADD CONSTRAINT "iot_thing_entity_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Uniques structure for table iot_thing_model
-- ----------------------------
ALTER TABLE "public"."iot_thing_model" ADD CONSTRAINT "iot_thing_model_code_key" UNIQUE ("code");

-- ----------------------------
-- Primary Key structure for table iot_thing_model
-- ----------------------------
ALTER TABLE "public"."iot_thing_model" ADD CONSTRAINT "iot_thing_model_pkey" PRIMARY KEY ("id", "code");

-- ----------------------------
-- Primary Key structure for table iot_thing_source
-- ----------------------------
ALTER TABLE "public"."iot_thing_source" ADD CONSTRAINT "iot_thing_source_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table mock_data_config
-- ----------------------------
ALTER TABLE "public"."mock_data_config" ADD CONSTRAINT "mock_data_config_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Uniques structure for table mock_data_log
-- ----------------------------
ALTER TABLE "public"."mock_data_log" ADD CONSTRAINT "mock_data_log_uk" UNIQUE ("mock_config_id", "time");
COMMENT ON CONSTRAINT "mock_data_log_uk" ON "public"."mock_data_log" IS '物计算日志唯一键';

-- ----------------------------
-- Primary Key structure for table mock_data_log
-- ----------------------------
ALTER TABLE "public"."mock_data_log" ADD CONSTRAINT "mock_data_log_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table sys_energy_check
-- ----------------------------
ALTER TABLE "public"."sys_energy_check" ADD CONSTRAINT "sys_energy_check_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table sys_energy_project
-- ----------------------------
ALTER TABLE "public"."sys_energy_project" ADD CONSTRAINT "sys_energy_project_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Uniques structure for table thing_ts_kv
-- ----------------------------
ALTER TABLE "public"."thing_ts_kv" ADD CONSTRAINT "unique_thing_attr_ts" UNIQUE ("thing_code", "attr_key", "ts");

-- ----------------------------
-- Primary Key structure for table thing_ts_kv_external
-- ----------------------------
ALTER TABLE "public"."thing_ts_kv_external" ADD CONSTRAINT "ts_kv_pkey" PRIMARY KEY ("thing_code", "attr_key", "ts");

-- ----------------------------
-- Uniques structure for table ts_kv_latest
-- ----------------------------
ALTER TABLE "public"."ts_kv_latest" ADD CONSTRAINT "unique_thing_attr" UNIQUE ("thing_code", "attr_key");
