CREATE TABLE "EMERGENCY"."dmmatype"
(
    "id" INT IDENTITY(1, 1) NOT NULL,
    "matype1" VARCHAR(100),
    "matype2" VARCHAR(100),
    "maname" VARCHAR(100),
    "maspec" VARCHAR(100),
    "maunit" VARCHAR(50),
    NOT CLUSTER PRIMARY KEY("id")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."dmmatype" IS '代码表，物资类别';
COMMENT ON COLUMN "EMERGENCY"."dmmatype"."maname" IS '名字';
COMMENT ON COLUMN "EMERGENCY"."dmmatype"."maspec" IS '规格';
COMMENT ON COLUMN "EMERGENCY"."dmmatype"."matype1" IS '大类';
COMMENT ON COLUMN "EMERGENCY"."dmmatype"."matype2" IS '类别';
COMMENT ON COLUMN "EMERGENCY"."dmmatype"."maunit" IS '计量单位';


CREATE TABLE "EMERGENCY"."inbound_info"
(
    "inbound_id" INT IDENTITY(1, 1) NOT NULL,
    "inbound_type" VARCHAR(128),
    "material_group" VARCHAR(128),
    "material_type" VARCHAR(128),
    "material_name" VARCHAR(256),
    "quantity" VARCHAR(25) DEFAULT 0,
    "inbound_time" VARCHAR(50),
    "is_available" VARCHAR(50),
    "status" VARCHAR(50),
    "submit_time" DATETIME(6),
    "user_id" VARCHAR(128),
    "warehouse" VARCHAR(256),
    "dept_id" VARCHAR(256),
    NOT CLUSTER PRIMARY KEY("inbound_id")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."inbound_info" IS '入库信息表';
COMMENT ON COLUMN "EMERGENCY"."inbound_info"."dept_id" IS '创建人部门ID';
COMMENT ON COLUMN "EMERGENCY"."inbound_info"."inbound_id" IS '入库信息id';
COMMENT ON COLUMN "EMERGENCY"."inbound_info"."inbound_time" IS '入库日期';
COMMENT ON COLUMN "EMERGENCY"."inbound_info"."inbound_type" IS '入库类型';
COMMENT ON COLUMN "EMERGENCY"."inbound_info"."is_available" IS '是否可用';
COMMENT ON COLUMN "EMERGENCY"."inbound_info"."material_group" IS '物资大类';
COMMENT ON COLUMN "EMERGENCY"."inbound_info"."material_name" IS '物资名称';
COMMENT ON COLUMN "EMERGENCY"."inbound_info"."material_type" IS '物资类别';
COMMENT ON COLUMN "EMERGENCY"."inbound_info"."quantity" IS '数量';
COMMENT ON COLUMN "EMERGENCY"."inbound_info"."status" IS '状态';
COMMENT ON COLUMN "EMERGENCY"."inbound_info"."submit_time" IS '提交时间';
COMMENT ON COLUMN "EMERGENCY"."inbound_info"."user_id" IS '用户id';
COMMENT ON COLUMN "EMERGENCY"."inbound_info"."warehouse" IS '库点简称';


CREATE TABLE "EMERGENCY"."inbound_material_info"
(
    "material_id" INT IDENTITY(1, 1) NOT NULL,
    "inbound_id" INT,
    "inbound_type" VARCHAR(255),
    "material_group" VARCHAR(255),
    "material_type" VARCHAR(255),
    "material_name" VARCHAR(255),
    "unit" VARCHAR(255),
    "quantity" VARCHAR(255) DEFAULT 0,
    "specs" VARCHAR(128),
    "inbound_time" VARCHAR(128),
    "unit_price" VARCHAR(255),
    "total_price" VARCHAR(255),
    "is_available" VARCHAR(50),
    "file_part" VARCHAR(128),
    "remarks" VARCHAR(3072),
    "material_tree" VARCHAR(128),
    "file_name" VARCHAR(128),
    NOT CLUSTER PRIMARY KEY("material_id")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."inbound_material_info" IS '入库信息-物资信息表';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."file_name" IS '文件名称';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."file_part" IS '文件上传';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."inbound_id" IS '入库信息表id';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."inbound_time" IS '入库日期';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."inbound_type" IS '入库类型';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."is_available" IS '是否可用';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."material_group" IS '物资大类';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."material_id" IS '入库物资id';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."material_name" IS '物资名称';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."material_tree" IS '物资树';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."material_type" IS '物资类别';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."quantity" IS '数量';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."remarks" IS '备注';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."specs" IS '规格';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."total_price" IS '总价';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."unit" IS '单位';
COMMENT ON COLUMN "EMERGENCY"."inbound_material_info"."unit_price" IS '单价';


CREATE TABLE "EMERGENCY"."inbound_status"
(
    "id" INT IDENTITY(1, 1) NOT NULL,
    "status" VARCHAR(50),
    "is_invalid" VARCHAR(50) DEFAULT 0,
    "file_part" VARCHAR(128),
    "auditing_time" DATETIME(6),
    "dept_id" VARCHAR(50),
    "user_id" VARCHAR(50),
    "opinion" VARCHAR(500),
    "file_name" VARCHAR(129),
    "inbound_id" INT,
    NOT CLUSTER PRIMARY KEY("id")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."inbound_status" IS '入库审核状态表';
COMMENT ON COLUMN "EMERGENCY"."inbound_status"."auditing_time" IS '审核时间';
COMMENT ON COLUMN "EMERGENCY"."inbound_status"."dept_id" IS '审核部门';
COMMENT ON COLUMN "EMERGENCY"."inbound_status"."file_name" IS '文件名称';
COMMENT ON COLUMN "EMERGENCY"."inbound_status"."file_part" IS '文件id';
COMMENT ON COLUMN "EMERGENCY"."inbound_status"."id" IS '主键';
COMMENT ON COLUMN "EMERGENCY"."inbound_status"."inbound_id" IS '入库信息id';
COMMENT ON COLUMN "EMERGENCY"."inbound_status"."is_invalid" IS '是否失效';
COMMENT ON COLUMN "EMERGENCY"."inbound_status"."opinion" IS '意见';
COMMENT ON COLUMN "EMERGENCY"."inbound_status"."status" IS '状态';
COMMENT ON COLUMN "EMERGENCY"."inbound_status"."user_id" IS '审核用户';


CREATE TABLE "EMERGENCY"."marepo"
(
    "id" BIGINT IDENTITY(1, 1) NOT NULL,
    "reponame" VARCHAR(200) NOT NULL,
    "maname" VARCHAR(200) NOT NULL,
    "matype1" VARCHAR(50),
    "matype2" VARCHAR(50),
    "matype1code" VARCHAR(50),
    "matype2code" VARCHAR(50),
    "maunit" VARCHAR(50),
    "maspec" VARCHAR(200),
    "manumber" NUMERIC,
    "mavalue" NUMERIC,
    "gmt_create" DATETIME(6),
    "gmt_modify" DATETIME(6),
    "isok" VARCHAR(50),
    "doc" VARCHAR(200),
    "maunitvalue" NUMERIC,
    NOT CLUSTER PRIMARY KEY("id")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."marepo" IS '物资库存表。ma代表物资，repo代表库';
COMMENT ON COLUMN "EMERGENCY"."marepo"."doc" IS '备注';
COMMENT ON COLUMN "EMERGENCY"."marepo"."gmt_create" IS '记录创建时间';
COMMENT ON COLUMN "EMERGENCY"."marepo"."gmt_modify" IS '记录更新时间';
COMMENT ON COLUMN "EMERGENCY"."marepo"."isok" IS '是否可用。Y=可用，N=不可用';
COMMENT ON COLUMN "EMERGENCY"."marepo"."maname" IS '物资名称';
COMMENT ON COLUMN "EMERGENCY"."marepo"."manumber" IS '物资数量';
COMMENT ON COLUMN "EMERGENCY"."marepo"."maspec" IS '物资规格';
COMMENT ON COLUMN "EMERGENCY"."marepo"."matype1" IS '物资大类';
COMMENT ON COLUMN "EMERGENCY"."marepo"."matype1code" IS '物资大类编码';
COMMENT ON COLUMN "EMERGENCY"."marepo"."matype2" IS '物资类别';
COMMENT ON COLUMN "EMERGENCY"."marepo"."matype2code" IS '物资类别编码';
COMMENT ON COLUMN "EMERGENCY"."marepo"."maunit" IS '物资计量单位';
COMMENT ON COLUMN "EMERGENCY"."marepo"."maunitvalue" IS '物资单价';
COMMENT ON COLUMN "EMERGENCY"."marepo"."mavalue" IS '物资价值';
COMMENT ON COLUMN "EMERGENCY"."marepo"."reponame" IS '库名称';


CREATE TABLE "EMERGENCY"."outbound_info"
(
    "outbound_id" INT IDENTITY(1, 1) NOT NULL,
    "outbound_type" VARCHAR(128),
    "material_group" VARCHAR(128),
    "material_type" VARCHAR(128),
    "material_name" VARCHAR(256),
    "quantity" VARCHAR(10),
    "called_province" VARCHAR(128),
    "outbound_time" VARCHAR(50),
    "is_available" VARCHAR(50),
    "status" VARCHAR(50),
    "submit_time" DATETIME(6),
    "user_id" VARCHAR(128),
    "warehouse" VARCHAR(256),
    "dept_id" VARCHAR(256),
    NOT CLUSTER PRIMARY KEY("outbound_id")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."outbound_info" IS '出库信息表';
COMMENT ON COLUMN "EMERGENCY"."outbound_info"."called_province" IS '调用省份';
COMMENT ON COLUMN "EMERGENCY"."outbound_info"."dept_id" IS '创建人部门ID';
COMMENT ON COLUMN "EMERGENCY"."outbound_info"."is_available" IS '是否可用';
COMMENT ON COLUMN "EMERGENCY"."outbound_info"."material_group" IS '物资大类';
COMMENT ON COLUMN "EMERGENCY"."outbound_info"."material_name" IS '物资名称';
COMMENT ON COLUMN "EMERGENCY"."outbound_info"."material_type" IS '物资类别';
COMMENT ON COLUMN "EMERGENCY"."outbound_info"."outbound_id" IS '出库信息id';
COMMENT ON COLUMN "EMERGENCY"."outbound_info"."outbound_time" IS '出库日期';
COMMENT ON COLUMN "EMERGENCY"."outbound_info"."outbound_type" IS '出库类型';
COMMENT ON COLUMN "EMERGENCY"."outbound_info"."quantity" IS '数量';
COMMENT ON COLUMN "EMERGENCY"."outbound_info"."status" IS '状态';
COMMENT ON COLUMN "EMERGENCY"."outbound_info"."submit_time" IS '提交时间';
COMMENT ON COLUMN "EMERGENCY"."outbound_info"."user_id" IS '用户id';
COMMENT ON COLUMN "EMERGENCY"."outbound_info"."warehouse" IS '库点简称';


CREATE TABLE "EMERGENCY"."outbound_material_info"
(
    "material_id" INT IDENTITY(1, 1) NOT NULL,
    "outbound_id" INT,
    "outbound_type" VARCHAR(128),
    "material_group" VARCHAR(128),
    "material_type" VARCHAR(128),
    "material_name" VARCHAR(128),
    "unit" VARCHAR(50),
    "quantity" VARCHAR(50),
    "province" VARCHAR(128),
    "specs" VARCHAR(128),
    "outbound_time" VARCHAR(50),
    "unit_price" VARCHAR(50),
    "total_price" VARCHAR(50),
    "is_available" VARCHAR(50),
    "file_part" VARCHAR(128),
    "remarks" VARCHAR(500),
    "material_tree" VARCHAR(128),
    "file_name" VARCHAR(128),
    NOT CLUSTER PRIMARY KEY("material_id")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."outbound_material_info" IS '出库信息-物资信息表';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."file_name" IS '文件名称';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."file_part" IS '文件上传';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."is_available" IS '是否可用';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."material_group" IS '物资大类';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."material_id" IS '出库物资id';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."material_name" IS '物资名称';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."material_tree" IS '物资树';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."material_type" IS '物资类别';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."outbound_id" IS '出库信息表id';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."outbound_time" IS '出库日期';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."outbound_type" IS '出库类型';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."province" IS '调用省份';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."quantity" IS '数量';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."remarks" IS '备注';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."specs" IS '规格';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."total_price" IS '总价';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."unit" IS '单位';
COMMENT ON COLUMN "EMERGENCY"."outbound_material_info"."unit_price" IS '单价';


CREATE TABLE "EMERGENCY"."outbound_status"
(
    "id" INT IDENTITY(1, 1) NOT NULL,
    "status" VARCHAR(50),
    "is_invalid" VARCHAR(50) DEFAULT 0,
    "file_part" VARCHAR(128),
    "auditing_time" DATETIME(6),
    "dept_id" VARCHAR(50),
    "user_id" VARCHAR(50),
    "opinion" VARCHAR(500),
    "file_name" VARCHAR(128),
    "outbound_id" INT,
    NOT CLUSTER PRIMARY KEY("id")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."outbound_status" IS '审核状态表';
COMMENT ON COLUMN "EMERGENCY"."outbound_status"."auditing_time" IS '审核时间';
COMMENT ON COLUMN "EMERGENCY"."outbound_status"."dept_id" IS '审核部门';
COMMENT ON COLUMN "EMERGENCY"."outbound_status"."file_name" IS '文件名称';
COMMENT ON COLUMN "EMERGENCY"."outbound_status"."file_part" IS '文件id';
COMMENT ON COLUMN "EMERGENCY"."outbound_status"."id" IS '主键';
COMMENT ON COLUMN "EMERGENCY"."outbound_status"."is_invalid" IS '是否失效';
COMMENT ON COLUMN "EMERGENCY"."outbound_status"."opinion" IS '意见';
COMMENT ON COLUMN "EMERGENCY"."outbound_status"."outbound_id" IS '出库id';
COMMENT ON COLUMN "EMERGENCY"."outbound_status"."status" IS '状态';
COMMENT ON COLUMN "EMERGENCY"."outbound_status"."user_id" IS '审核用户';


CREATE TABLE "EMERGENCY"."outrepo"
(
    "id" BIGINT IDENTITY(1, 1) NOT NULL,
    "reponame" VARCHAR(200) NOT NULL,
    "maname" VARCHAR(200) NOT NULL,
    "matype1" VARCHAR(50),
    "matype2" VARCHAR(50),
    "matype1code" VARCHAR(50),
    "matype2code" VARCHAR(50),
    "maunit" VARCHAR(50),
    "maspec" VARCHAR(50),
    "manumber" NUMERIC,
    "mavalue" NUMERIC,
    "maunitvalue" NUMERIC,
    "outrepodate" DATETIME(6),
    "outrepobatch" VARCHAR(50),
    "doc" VARCHAR(50),
    NOT CLUSTER PRIMARY KEY("id")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."outrepo" IS '出库表。ma代表物资，repo代表库';
COMMENT ON COLUMN "EMERGENCY"."outrepo"."doc" IS '备注';
COMMENT ON COLUMN "EMERGENCY"."outrepo"."maname" IS '物资名称';
COMMENT ON COLUMN "EMERGENCY"."outrepo"."manumber" IS '调拨物资数量';
COMMENT ON COLUMN "EMERGENCY"."outrepo"."maspec" IS '物资规格';
COMMENT ON COLUMN "EMERGENCY"."outrepo"."matype1" IS '物资大类';
COMMENT ON COLUMN "EMERGENCY"."outrepo"."matype1code" IS '物资大类编码';
COMMENT ON COLUMN "EMERGENCY"."outrepo"."matype2" IS '物资类别';
COMMENT ON COLUMN "EMERGENCY"."outrepo"."matype2code" IS '物资类别编码';
COMMENT ON COLUMN "EMERGENCY"."outrepo"."maunit" IS '物资计量单位';
COMMENT ON COLUMN "EMERGENCY"."outrepo"."maunitvalue" IS '物资单价';
COMMENT ON COLUMN "EMERGENCY"."outrepo"."mavalue" IS '物资价值';
COMMENT ON COLUMN "EMERGENCY"."outrepo"."outrepobatch" IS '出库批次编码';
COMMENT ON COLUMN "EMERGENCY"."outrepo"."outrepodate" IS '出库日期';
COMMENT ON COLUMN "EMERGENCY"."outrepo"."reponame" IS '库名称';


CREATE TABLE "EMERGENCY"."QRTZ_BLOB_TRIGGERS"
(
    "SCHED_NAME" VARCHAR(120) NOT NULL,
    "TRIGGER_NAME" VARCHAR(200) NOT NULL,
    "TRIGGER_GROUP" VARCHAR(200) NOT NULL,
    "BLOB_DATA" BLOB,
    NOT CLUSTER PRIMARY KEY("SCHED_NAME", "TRIGGER_NAME", "TRIGGER_GROUP"),
    CONSTRAINT "QRTZ_BLOB_TRIGGERS_IBFK_1" FOREIGN KEY("SCHED_NAME", "TRIGGER_NAME", "TRIGGER_GROUP") REFERENCES "EMERGENCY"."QRTZ_TRIGGERS"("SCHED_NAME", "TRIGGER_NAME", "TRIGGER_GROUP")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."QRTZ_CALENDARS"
(
    "SCHED_NAME" VARCHAR(120) NOT NULL,
    "CALENDAR_NAME" VARCHAR(200) NOT NULL,
    "CALENDAR" BLOB NOT NULL,
    NOT CLUSTER PRIMARY KEY("SCHED_NAME", "CALENDAR_NAME")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."QRTZ_CRON_TRIGGERS"
(
    "SCHED_NAME" VARCHAR(120) NOT NULL,
    "TRIGGER_NAME" VARCHAR(200) NOT NULL,
    "TRIGGER_GROUP" VARCHAR(200) NOT NULL,
    "CRON_EXPRESSION" VARCHAR(200) NOT NULL,
    "TIME_ZONE_ID" VARCHAR(80),
    NOT CLUSTER PRIMARY KEY("SCHED_NAME", "TRIGGER_NAME", "TRIGGER_GROUP"),
    CONSTRAINT "QRTZ_CRON_TRIGGERS_IBFK_1" FOREIGN KEY("SCHED_NAME", "TRIGGER_NAME", "TRIGGER_GROUP") REFERENCES "EMERGENCY"."QRTZ_TRIGGERS"("SCHED_NAME", "TRIGGER_NAME", "TRIGGER_GROUP")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."QRTZ_FIRED_TRIGGERS"
(
    "SCHED_NAME" VARCHAR(120) NOT NULL,
    "ENTRY_ID" VARCHAR(95) NOT NULL,
    "TRIGGER_NAME" VARCHAR(200) NOT NULL,
    "TRIGGER_GROUP" VARCHAR(200) NOT NULL,
    "INSTANCE_NAME" VARCHAR(200) NOT NULL,
    "FIRED_TIME" BIGINT NOT NULL,
    "SCHED_TIME" BIGINT NOT NULL,
    "PRIORITY" INT NOT NULL,
    "STATE" VARCHAR(16) NOT NULL,
    "JOB_NAME" VARCHAR(200),
    "JOB_GROUP" VARCHAR(200),
    "IS_NONCONCURRENT" VARCHAR(1),
    "REQUESTS_RECOVERY" VARCHAR(1),
    NOT CLUSTER PRIMARY KEY("SCHED_NAME", "ENTRY_ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."QRTZ_JOB_DETAILS"
(
    "SCHED_NAME" VARCHAR(120) NOT NULL,
    "JOB_NAME" VARCHAR(200) NOT NULL,
    "JOB_GROUP" VARCHAR(200) NOT NULL,
    "DESCRIPTION" VARCHAR(250),
    "JOB_CLASS_NAME" VARCHAR(250) NOT NULL,
    "IS_DURABLE" VARCHAR(1) NOT NULL,
    "IS_NONCONCURRENT" VARCHAR(1) NOT NULL,
    "IS_UPDATE_DATA" VARCHAR(1) NOT NULL,
    "REQUESTS_RECOVERY" VARCHAR(1) NOT NULL,
    "JOB_DATA" BLOB,
    NOT CLUSTER PRIMARY KEY("SCHED_NAME", "JOB_NAME", "JOB_GROUP")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."QRTZ_LOCKS"
(
    "SCHED_NAME" VARCHAR(120) NOT NULL,
    "LOCK_NAME" VARCHAR(40) NOT NULL,
    NOT CLUSTER PRIMARY KEY("SCHED_NAME", "LOCK_NAME")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."QRTZ_PAUSED_TRIGGER_GRPS"
(
    "SCHED_NAME" VARCHAR(120) NOT NULL,
    "TRIGGER_GROUP" VARCHAR(200) NOT NULL,
    NOT CLUSTER PRIMARY KEY("SCHED_NAME", "TRIGGER_GROUP")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."QRTZ_SCHEDULER_STATE"
(
    "SCHED_NAME" VARCHAR(120) NOT NULL,
    "INSTANCE_NAME" VARCHAR(200) NOT NULL,
    "LAST_CHECKIN_TIME" BIGINT NOT NULL,
    "CHECKIN_INTERVAL" BIGINT NOT NULL,
    NOT CLUSTER PRIMARY KEY("SCHED_NAME", "INSTANCE_NAME")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."QRTZ_SIMPLE_TRIGGERS"
(
    "SCHED_NAME" VARCHAR(120) NOT NULL,
    "TRIGGER_NAME" VARCHAR(200) NOT NULL,
    "TRIGGER_GROUP" VARCHAR(200) NOT NULL,
    "REPEAT_COUNT" BIGINT NOT NULL,
    "REPEAT_INTERVAL" BIGINT NOT NULL,
    "TIMES_TRIGGERED" BIGINT NOT NULL,
    NOT CLUSTER PRIMARY KEY("SCHED_NAME", "TRIGGER_NAME", "TRIGGER_GROUP"),
    CONSTRAINT "QRTZ_SIMPLE_TRIGGERS_IBFK_1" FOREIGN KEY("SCHED_NAME", "TRIGGER_NAME", "TRIGGER_GROUP") REFERENCES "EMERGENCY"."QRTZ_TRIGGERS"("SCHED_NAME", "TRIGGER_NAME", "TRIGGER_GROUP")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."QRTZ_SIMPROP_TRIGGERS"
(
    "SCHED_NAME" VARCHAR(120) NOT NULL,
    "TRIGGER_NAME" VARCHAR(200) NOT NULL,
    "TRIGGER_GROUP" VARCHAR(200) NOT NULL,
    "STR_PROP_1" VARCHAR(512),
    "STR_PROP_2" VARCHAR(512),
    "STR_PROP_3" VARCHAR(512),
    "INT_PROP_1" INT,
    "INT_PROP_2" INT,
    "LONG_PROP_1" BIGINT,
    "LONG_PROP_2" BIGINT,
    "DEC_PROP_1" DEC(13,4),
    "DEC_PROP_2" DEC(13,4),
    "BOOL_PROP_1" VARCHAR(1),
    "BOOL_PROP_2" VARCHAR(1),
    NOT CLUSTER PRIMARY KEY("SCHED_NAME", "TRIGGER_NAME", "TRIGGER_GROUP"),
    CONSTRAINT "QRTZ_SIMPROP_TRIGGERS_IBFK_1" FOREIGN KEY("SCHED_NAME", "TRIGGER_NAME", "TRIGGER_GROUP") REFERENCES "EMERGENCY"."QRTZ_TRIGGERS"("SCHED_NAME", "TRIGGER_NAME", "TRIGGER_GROUP")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."QRTZ_TRIGGERS"
(
    "SCHED_NAME" VARCHAR(120) NOT NULL,
    "TRIGGER_NAME" VARCHAR(200) NOT NULL,
    "TRIGGER_GROUP" VARCHAR(200) NOT NULL,
    "JOB_NAME" VARCHAR(200) NOT NULL,
    "JOB_GROUP" VARCHAR(200) NOT NULL,
    "DESCRIPTION" VARCHAR(250),
    "NEXT_FIRE_TIME" BIGINT,
    "PREV_FIRE_TIME" BIGINT,
    "PRIORITY" INT,
    "TRIGGER_STATE" VARCHAR(16) NOT NULL,
    "TRIGGER_TYPE" VARCHAR(8) NOT NULL,
    "START_TIME" BIGINT NOT NULL,
    "END_TIME" BIGINT,
    "CALENDAR_NAME" VARCHAR(200),
    "MISFIRE_INSTR" SMALLINT,
    "JOB_DATA" BLOB,
    NOT CLUSTER PRIMARY KEY("SCHED_NAME", "TRIGGER_NAME", "TRIGGER_GROUP"),
    CONSTRAINT "QRTZ_TRIGGERS_IBFK_1" FOREIGN KEY("SCHED_NAME", "JOB_NAME", "JOB_GROUP") REFERENCES "EMERGENCY"."QRTZ_JOB_DETAILS"("SCHED_NAME", "JOB_NAME", "JOB_GROUP")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE OR REPLACE  INDEX "SCHED_NAME" ON "EMERGENCY"."QRTZ_TRIGGERS"("SCHED_NAME" ASC,"JOB_NAME" ASC,"JOB_GROUP" ASC) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."SYS_DEPT"
(
    "DEPT_ID" VARCHAR(50) NOT NULL,
    "NAME" VARCHAR(120),
    "SORT_ORDER" INT DEFAULT 0 NOT NULL,
    "CREATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "UPDATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "CREATE_TIME" TIMESTAMP(0),
    "UPDATE_TIME" TIMESTAMP(0),
    "DEL_FLAG" CHAR(1) DEFAULT '0',
    "PARENT_ID" VARCHAR(50),
    "TENANT_ID" BIGINT,
    "DEPT_TYPE" VARCHAR(50),
    "LONGITUDE" VARCHAR(50),
    "DIMENSION" VARCHAR(50),
    "WAREHOUSE_TYPE" VARCHAR(200),
    "ABBREVIATION_NAME" VARCHAR(100),
    "LEGAL_PERSON" VARCHAR(200),
    "DEPT_PHONE" VARCHAR(50),
    "RESERVOIR_IMG" VARCHAR(500),
    "DEPT_PROVINCE" VARCHAR(255),
    "DEPT_CITY" VARCHAR(255),
    "DEPT_AREA" VARCHAR(255),
    "DEPT_ADDRESS" VARCHAR(255),
    "DEPT_MERGE_ADDRESS" VARCHAR(500),
    NOT CLUSTER PRIMARY KEY("DEPT_ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_DEPT" IS '部门管理';
COMMENT ON COLUMN "EMERGENCY"."SYS_DEPT"."ABBREVIATION_NAME" IS '部门名称缩写';
COMMENT ON COLUMN "EMERGENCY"."SYS_DEPT"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "EMERGENCY"."SYS_DEPT"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_DEPT"."DEPT_TYPE" IS '字段 dept_type 类型  1级国家局  2级 垂管局  3级仓库';
COMMENT ON COLUMN "EMERGENCY"."SYS_DEPT"."DIMENSION" IS '维度';
COMMENT ON COLUMN "EMERGENCY"."SYS_DEPT"."LONGITUDE" IS '经度';
COMMENT ON COLUMN "EMERGENCY"."SYS_DEPT"."SORT_ORDER" IS '排序';
COMMENT ON COLUMN "EMERGENCY"."SYS_DEPT"."UPDATE_BY" IS '修改人';
COMMENT ON COLUMN "EMERGENCY"."SYS_DEPT"."UPDATE_TIME" IS '修改时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_DEPT"."WAREHOUSE_TYPE" IS '仓库类型  参考字典项  warehouse_type';


CREATE TABLE "EMERGENCY"."SYS_DEPT_RELATION"
(
    "ANCESTOR" VARCHAR(50) NOT NULL,
    "DESCENDANT" VARCHAR(50) NOT NULL,
    NOT CLUSTER PRIMARY KEY("ANCESTOR", "DESCENDANT")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_DEPT_RELATION" IS '部门关系表';
COMMENT ON COLUMN "EMERGENCY"."SYS_DEPT_RELATION"."ANCESTOR" IS '祖先节点';
COMMENT ON COLUMN "EMERGENCY"."SYS_DEPT_RELATION"."DESCENDANT" IS '后代节点';


CREATE OR REPLACE  INDEX "IDX1" ON "EMERGENCY"."SYS_DEPT_RELATION"("ANCESTOR" ASC) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;
CREATE OR REPLACE  INDEX "IDX2" ON "EMERGENCY"."SYS_DEPT_RELATION"("DESCENDANT" ASC) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."SYS_DICT"
(
    "ID" BIGINT NOT NULL,
    "DICT_TYPE" VARCHAR(100),
    "DESCRIPTION" VARCHAR(100),
    "CREATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "UPDATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "CREATE_TIME" TIMESTAMP(0),
    "UPDATE_TIME" TIMESTAMP(0),
    "REMARKS" VARCHAR(255),
    "SYSTEM_FLAG" CHAR(1) DEFAULT '0',
    "DEL_FLAG" CHAR(1) DEFAULT '0',
    "TENANT_ID" BIGINT DEFAULT 0 NOT NULL,
    NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_DICT" IS '字典表';
COMMENT ON COLUMN "EMERGENCY"."SYS_DICT"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "EMERGENCY"."SYS_DICT"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_DICT"."ID" IS '编号';
COMMENT ON COLUMN "EMERGENCY"."SYS_DICT"."TENANT_ID" IS '所属租户';
COMMENT ON COLUMN "EMERGENCY"."SYS_DICT"."UPDATE_BY" IS '修改人';
COMMENT ON COLUMN "EMERGENCY"."SYS_DICT"."UPDATE_TIME" IS '更新时间';


CREATE OR REPLACE  INDEX "SYS_DICT_DEL_FLAG" ON "EMERGENCY"."SYS_DICT"("DEL_FLAG" ASC) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."SYS_DICT_ITEM"
(
    "ID" BIGINT NOT NULL,
    "DICT_ID" BIGINT NOT NULL,
    "ITEM_VALUE" VARCHAR(100),
    "LABEL" VARCHAR(100),
    "DICT_TYPE" VARCHAR(100),
    "DESCRIPTION" VARCHAR(100),
    "SORT_ORDER" INT DEFAULT 0 NOT NULL,
    "CREATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "UPDATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "CREATE_TIME" TIMESTAMP(0),
    "UPDATE_TIME" TIMESTAMP(0),
    "REMARKS" VARCHAR(255),
    "DEL_FLAG" CHAR(1) DEFAULT '0',
    "TENANT_ID" BIGINT DEFAULT 0 NOT NULL,
    NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_DICT_ITEM" IS '字典项';
COMMENT ON COLUMN "EMERGENCY"."SYS_DICT_ITEM"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "EMERGENCY"."SYS_DICT_ITEM"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_DICT_ITEM"."ID" IS '编号';
COMMENT ON COLUMN "EMERGENCY"."SYS_DICT_ITEM"."SORT_ORDER" IS '排序（升序）';
COMMENT ON COLUMN "EMERGENCY"."SYS_DICT_ITEM"."TENANT_ID" IS '所属租户';
COMMENT ON COLUMN "EMERGENCY"."SYS_DICT_ITEM"."UPDATE_BY" IS '修改人';
COMMENT ON COLUMN "EMERGENCY"."SYS_DICT_ITEM"."UPDATE_TIME" IS '更新时间';


CREATE OR REPLACE  INDEX "SYS_DICT_ITEM_DEL_FLAG" ON "EMERGENCY"."SYS_DICT_ITEM"("DEL_FLAG" ASC) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;
CREATE OR REPLACE  INDEX "SYS_DICT_VALUE" ON "EMERGENCY"."SYS_DICT_ITEM"("ITEM_VALUE" ASC) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;
CREATE OR REPLACE  INDEX "SYS_DICT_LABEL" ON "EMERGENCY"."SYS_DICT_ITEM"("LABEL" ASC) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."SYS_FILE"
(
    "ID" BIGINT NOT NULL,
    "FILE_NAME" VARCHAR(100),
    "BUCKET_NAME" VARCHAR(200),
    "ORIGINAL" VARCHAR(100),
    "TYPE" VARCHAR(50),
    "FILE_SIZE" BIGINT,
    "CREATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "UPDATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "CREATE_TIME" TIMESTAMP(0),
    "UPDATE_TIME" TIMESTAMP(0),
    "DEL_FLAG" CHAR(1) DEFAULT '0',
    "TENANT_ID" BIGINT,
    NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_FILE" IS '文件管理表';
COMMENT ON COLUMN "EMERGENCY"."SYS_FILE"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "EMERGENCY"."SYS_FILE"."CREATE_TIME" IS '上传时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_FILE"."FILE_SIZE" IS '文件大小';
COMMENT ON COLUMN "EMERGENCY"."SYS_FILE"."ID" IS '编号';
COMMENT ON COLUMN "EMERGENCY"."SYS_FILE"."TENANT_ID" IS '所属租户';
COMMENT ON COLUMN "EMERGENCY"."SYS_FILE"."UPDATE_BY" IS '修改人';
COMMENT ON COLUMN "EMERGENCY"."SYS_FILE"."UPDATE_TIME" IS '更新时间';


CREATE TABLE "EMERGENCY"."SYS_JOB"
(
    "JOB_ID" BIGINT NOT NULL,
    "JOB_NAME" VARCHAR(64) NOT NULL,
    "JOB_GROUP" VARCHAR(64) NOT NULL,
    "JOB_ORDER" CHAR(1) DEFAULT '1',
    "JOB_TYPE" CHAR(1) DEFAULT '1' NOT NULL,
    "EXECUTE_PATH" VARCHAR(500),
    "CLASS_NAME" VARCHAR(500),
    "METHOD_NAME" VARCHAR(500),
    "METHOD_PARAMS_VALUE" VARCHAR(2000),
    "CRON_EXPRESSION" VARCHAR(255),
    "MISFIRE_POLICY" VARCHAR(20) DEFAULT '3',
    "JOB_TENANT_TYPE" CHAR(1) DEFAULT '1',
    "JOB_STATUS" CHAR(1) DEFAULT '0',
    "JOB_EXECUTE_STATUS" CHAR(1) DEFAULT '0',
    "CREATE_BY" VARCHAR(64),
    "CREATE_TIME" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP() NOT NULL,
    "UPDATE_BY" VARCHAR(64) DEFAULT '',
    "UPDATE_TIME" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP() NOT NULL,
    "START_TIME" TIMESTAMP(0),
    "PREVIOUS_TIME" TIMESTAMP(0),
    "NEXT_TIME" TIMESTAMP(0),
    "TENANT_ID" BIGINT DEFAULT 1,
    "REMARK" VARCHAR(500) DEFAULT '',
    NOT CLUSTER PRIMARY KEY("JOB_ID", "JOB_NAME", "JOB_GROUP")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_JOB" IS '定时任务调度表';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."CLASS_NAME" IS 'job_type=1时，类完整路径;job_type=2时，spring bean名称;其它值为空';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."CREATE_BY" IS '创建者';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."CRON_EXPRESSION" IS 'cron执行表达式';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."EXECUTE_PATH" IS 'job_type=3时，rest调用地址，仅支持rest get协议,需要增加String返回值，0成功，1失败;job_type=4时，jar路径;其它值为空';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."JOB_EXECUTE_STATUS" IS '状态（0正常 1异常）';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."JOB_GROUP" IS '任务组名';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."JOB_ID" IS '任务id';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."JOB_NAME" IS '任务名称';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."JOB_ORDER" IS '组内执行顺利，值越大执行优先级越高，最大值9，最小值1';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."JOB_STATUS" IS '状态（1、未发布;2、运行中;3、暂停;4、删除;）';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."JOB_TENANT_TYPE" IS '1、多租户任务;2、非多租户任务';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."JOB_TYPE" IS '1、java类;2、spring bean名称;3、rest调用;4、jar调用;9其他';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."METHOD_NAME" IS '任务方法';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."METHOD_PARAMS_VALUE" IS '参数值';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."MISFIRE_POLICY" IS '错失执行策略（1错失周期立即执行 2错失周期执行一次 3下周期执行）';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."NEXT_TIME" IS '下次执行时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."PREVIOUS_TIME" IS '上次执行时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."REMARK" IS '备注信息';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."START_TIME" IS '初次执行时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."TENANT_ID" IS '租户';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."UPDATE_BY" IS '更新者';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB"."UPDATE_TIME" IS '更新时间';


CREATE TABLE "EMERGENCY"."SYS_JOB_LOG"
(
    "JOB_LOG_ID" BIGINT NOT NULL,
    "JOB_ID" BIGINT NOT NULL,
    "JOB_NAME" VARCHAR(64),
    "JOB_GROUP" VARCHAR(64),
    "JOB_ORDER" CHAR(1),
    "JOB_TYPE" CHAR(1) DEFAULT '1' NOT NULL,
    "EXECUTE_PATH" VARCHAR(500),
    "CLASS_NAME" VARCHAR(500),
    "METHOD_NAME" VARCHAR(500),
    "METHOD_PARAMS_VALUE" VARCHAR(2000),
    "CRON_EXPRESSION" VARCHAR(255),
    "JOB_MESSAGE" VARCHAR(500),
    "JOB_LOG_STATUS" CHAR(1) DEFAULT '0',
    "EXECUTE_TIME" VARCHAR(30),
    "EXCEPTION_INFO" VARCHAR(2000) DEFAULT '',
    "CREATE_TIME" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP() NOT NULL,
    "TENANT_ID" BIGINT DEFAULT 1 NOT NULL,
    NOT CLUSTER PRIMARY KEY("JOB_LOG_ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_JOB_LOG" IS '定时任务执行日志表';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."CLASS_NAME" IS 'job_type=1时，类完整路径;job_type=2时，spring bean名称;其它值为空';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."CRON_EXPRESSION" IS 'cron执行表达式';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."EXCEPTION_INFO" IS '异常信息';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."EXECUTE_PATH" IS 'job_type=3时，rest调用地址，仅支持post协议;job_type=4时，jar路径;其它值为空';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."EXECUTE_TIME" IS '执行时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."JOB_GROUP" IS '任务组名';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."JOB_ID" IS '任务id';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."JOB_LOG_ID" IS '任务日志ID';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."JOB_LOG_STATUS" IS '执行状态（0正常 1失败）';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."JOB_MESSAGE" IS '日志信息';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."JOB_NAME" IS '任务名称';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."JOB_ORDER" IS '组内执行顺利，值越大执行优先级越高，最大值9，最小值1';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."JOB_TYPE" IS '1、java类;2、spring bean名称;3、rest调用;4、jar调用;9其他';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."METHOD_NAME" IS '任务方法';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."METHOD_PARAMS_VALUE" IS '参数值';
COMMENT ON COLUMN "EMERGENCY"."SYS_JOB_LOG"."TENANT_ID" IS '租户id';


CREATE TABLE "EMERGENCY"."SYS_LOG"
(
    "ID" BIGINT NOT NULL,
    "LOG_TYPE" CHAR(1) DEFAULT '0',
    "TITLE" VARCHAR(255),
    "SERVICE_ID" VARCHAR(32),
    "CREATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "UPDATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "CREATE_TIME" TIMESTAMP(0),
    "UPDATE_TIME" TIMESTAMP(0),
    "REMOTE_ADDR" VARCHAR(255),
    "USER_AGENT" VARCHAR(1000),
    "REQUEST_URI" VARCHAR(255),
    "METHOD" VARCHAR(10),
    "PARAMS" TEXT,
    "TIME" BIGINT,
    "DEL_FLAG" CHAR(1) DEFAULT '0',
    "EXCEPTION" TEXT,
    "TENANT_ID" BIGINT DEFAULT 0,
    "REQUEST_PARAM" TEXT,
    "RESPONSE_PARAM" TEXT,
    NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_LOG" IS '日志表';
COMMENT ON COLUMN "EMERGENCY"."SYS_LOG"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "EMERGENCY"."SYS_LOG"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_LOG"."ID" IS '编号';
COMMENT ON COLUMN "EMERGENCY"."SYS_LOG"."REQUEST_PARAM" IS '入参';
COMMENT ON COLUMN "EMERGENCY"."SYS_LOG"."RESPONSE_PARAM" IS '出参';
COMMENT ON COLUMN "EMERGENCY"."SYS_LOG"."TENANT_ID" IS '所属租户';
COMMENT ON COLUMN "EMERGENCY"."SYS_LOG"."TIME" IS '执行时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_LOG"."UPDATE_BY" IS '修改人';
COMMENT ON COLUMN "EMERGENCY"."SYS_LOG"."UPDATE_TIME" IS '更新时间';


CREATE OR REPLACE  INDEX "SYS_LOG_CREATE_DATE" ON "EMERGENCY"."SYS_LOG"("CREATE_TIME" ASC) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;
CREATE OR REPLACE  INDEX "SYS_LOG_REQUEST_URI" ON "EMERGENCY"."SYS_LOG"("REQUEST_URI" ASC) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;
CREATE OR REPLACE  INDEX "SYS_LOG_TYPE" ON "EMERGENCY"."SYS_LOG"("LOG_TYPE" ASC) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."SYS_MENU"
(
    "MENU_ID" BIGINT NOT NULL,
    "NAME" VARCHAR(255),
    "PERMISSION" VARCHAR(255),
    "PATH" VARCHAR(128),
    "PARENT_ID" BIGINT,
    "ICON" VARCHAR(32),
    "SORT_ORDER" INT DEFAULT 1,
    "KEEP_ALIVE" CHAR(1) DEFAULT '0',
    "MENU_TYPE" CHAR(1) DEFAULT '0',
    "CREATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "CREATE_TIME" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP(),
    "UPDATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "UPDATE_TIME" TIMESTAMP(0),
    "DEL_FLAG" CHAR(1) DEFAULT '0',
    "TENANT_ID" DECIMAL,
    NOT CLUSTER PRIMARY KEY("MENU_ID"),
    CHECK("TENANT_ID" >= 0)) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_MENU" IS '菜单权限表';
COMMENT ON COLUMN "EMERGENCY"."SYS_MENU"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "EMERGENCY"."SYS_MENU"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_MENU"."MENU_ID" IS '菜单ID';
COMMENT ON COLUMN "EMERGENCY"."SYS_MENU"."PARENT_ID" IS '父菜单ID';
COMMENT ON COLUMN "EMERGENCY"."SYS_MENU"."SORT_ORDER" IS '排序值';
COMMENT ON COLUMN "EMERGENCY"."SYS_MENU"."TENANT_ID" IS '租户ID';
COMMENT ON COLUMN "EMERGENCY"."SYS_MENU"."UPDATE_BY" IS '修改人';
COMMENT ON COLUMN "EMERGENCY"."SYS_MENU"."UPDATE_TIME" IS '更新时间';


CREATE TABLE "EMERGENCY"."SYS_OAUTH_CLIENT_DETAILS"
(
    "ID" BIGINT NOT NULL,
    "CLIENT_ID" VARCHAR(32) NOT NULL,
    "RESOURCE_IDS" VARCHAR(256),
    "CLIENT_SECRET" VARCHAR(256),
    "SCOPE" VARCHAR(256),
    "AUTHORIZED_GRANT_TYPES" VARCHAR(256),
    "WEB_SERVER_REDIRECT_URI" VARCHAR(256),
    "AUTHORITIES" VARCHAR(256),
    "ACCESS_TOKEN_VALIDITY" INT,
    "REFRESH_TOKEN_VALIDITY" INT,
    "ADDITIONAL_INFORMATION" VARCHAR(4096),
    "AUTOAPPROVE" VARCHAR(256),
    "DEL_FLAG" CHAR(1) DEFAULT '0',
    "CREATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "UPDATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "CREATE_TIME" TIMESTAMP(0),
    "UPDATE_TIME" TIMESTAMP(0),
    "TENANT_ID" BIGINT DEFAULT 0 NOT NULL,
    NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_OAUTH_CLIENT_DETAILS" IS '终端信息表';
COMMENT ON COLUMN "EMERGENCY"."SYS_OAUTH_CLIENT_DETAILS"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "EMERGENCY"."SYS_OAUTH_CLIENT_DETAILS"."CREATE_TIME" IS '上传时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_OAUTH_CLIENT_DETAILS"."ID" IS 'ID';
COMMENT ON COLUMN "EMERGENCY"."SYS_OAUTH_CLIENT_DETAILS"."TENANT_ID" IS '所属租户';
COMMENT ON COLUMN "EMERGENCY"."SYS_OAUTH_CLIENT_DETAILS"."UPDATE_BY" IS '修改人';
COMMENT ON COLUMN "EMERGENCY"."SYS_OAUTH_CLIENT_DETAILS"."UPDATE_TIME" IS '更新时间';


CREATE TABLE "EMERGENCY"."SYS_POST"
(
    "POST_ID" BIGINT NOT NULL,
    "POST_CODE" VARCHAR(64) NOT NULL,
    "POST_NAME" VARCHAR(50) NOT NULL,
    "POST_SORT" INT NOT NULL,
    "REMARK" VARCHAR(500),
    "DEL_FLAG" CHAR(1) DEFAULT '0' NOT NULL,
    "CREATE_TIME" TIMESTAMP(0),
    "CREATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "UPDATE_TIME" TIMESTAMP(0),
    "UPDATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "TENANT_ID" BIGINT,
    NOT CLUSTER PRIMARY KEY("POST_ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_POST" IS '岗位信息表';
COMMENT ON COLUMN "EMERGENCY"."SYS_POST"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "EMERGENCY"."SYS_POST"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_POST"."DEL_FLAG" IS '是否删除  -1：已删除  0：正常';
COMMENT ON COLUMN "EMERGENCY"."SYS_POST"."POST_CODE" IS '岗位编码';
COMMENT ON COLUMN "EMERGENCY"."SYS_POST"."POST_ID" IS '岗位ID';
COMMENT ON COLUMN "EMERGENCY"."SYS_POST"."POST_NAME" IS '岗位名称';
COMMENT ON COLUMN "EMERGENCY"."SYS_POST"."POST_SORT" IS '岗位排序';
COMMENT ON COLUMN "EMERGENCY"."SYS_POST"."REMARK" IS '岗位描述';
COMMENT ON COLUMN "EMERGENCY"."SYS_POST"."TENANT_ID" IS '租户ID';
COMMENT ON COLUMN "EMERGENCY"."SYS_POST"."UPDATE_BY" IS '更新人';
COMMENT ON COLUMN "EMERGENCY"."SYS_POST"."UPDATE_TIME" IS '更新时间';


CREATE TABLE "EMERGENCY"."SYS_PUBLIC_PARAM"
(
    "PUBLIC_ID" BIGINT NOT NULL,
    "PUBLIC_NAME" VARCHAR(128),
    "PUBLIC_KEY" VARCHAR(128),
    "PUBLIC_VALUE" VARCHAR(128),
    "STATUS" CHAR(1) DEFAULT '0',
    "VALIDATE_CODE" VARCHAR(64),
    "CREATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "UPDATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "CREATE_TIME" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP() NOT NULL,
    "UPDATE_TIME" TIMESTAMP(0),
    "PUBLIC_TYPE" CHAR(1) DEFAULT '0',
    "SYSTEM_FLAG" CHAR(1) DEFAULT '0',
    "DEL_FLAG" CHAR(1) DEFAULT '0',
    "TENANT_ID" BIGINT,
    NOT CLUSTER PRIMARY KEY("PUBLIC_ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_PUBLIC_PARAM" IS '公共参数配置表';
COMMENT ON COLUMN "EMERGENCY"."SYS_PUBLIC_PARAM"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "EMERGENCY"."SYS_PUBLIC_PARAM"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_PUBLIC_PARAM"."PUBLIC_ID" IS '编号';
COMMENT ON COLUMN "EMERGENCY"."SYS_PUBLIC_PARAM"."TENANT_ID" IS '租户ID';
COMMENT ON COLUMN "EMERGENCY"."SYS_PUBLIC_PARAM"."UPDATE_BY" IS '修改人';
COMMENT ON COLUMN "EMERGENCY"."SYS_PUBLIC_PARAM"."UPDATE_TIME" IS '修改时间';


CREATE TABLE "EMERGENCY"."SYS_ROLE"
(
    "ROLE_ID" BIGINT NOT NULL,
    "ROLE_NAME" VARCHAR(64),
    "ROLE_CODE" VARCHAR(64),
    "ROLE_DESC" VARCHAR(255),
    "DS_TYPE" CHAR(1) DEFAULT '2',
    "DS_SCOPE" VARCHAR(255),
    "CREATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "UPDATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "CREATE_TIME" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP() NOT NULL,
    "UPDATE_TIME" TIMESTAMP(0),
    "DEL_FLAG" CHAR(1) DEFAULT '0',
    "TENANT_ID" BIGINT,
    NOT CLUSTER PRIMARY KEY("ROLE_ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_ROLE" IS '系统角色表';
COMMENT ON COLUMN "EMERGENCY"."SYS_ROLE"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "EMERGENCY"."SYS_ROLE"."UPDATE_BY" IS '修改人';


CREATE OR REPLACE  INDEX "ROLE_IDX1_ROLE_CODE" ON "EMERGENCY"."SYS_ROLE"("ROLE_CODE" ASC) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."SYS_ROLE_MENU"
(
    "ROLE_ID" BIGINT NOT NULL,
    "MENU_ID" BIGINT NOT NULL,
    NOT CLUSTER PRIMARY KEY("ROLE_ID", "MENU_ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_ROLE_MENU" IS '角色菜单表';
COMMENT ON COLUMN "EMERGENCY"."SYS_ROLE_MENU"."MENU_ID" IS '菜单ID';
COMMENT ON COLUMN "EMERGENCY"."SYS_ROLE_MENU"."ROLE_ID" IS '角色ID';


CREATE TABLE "EMERGENCY"."SYS_SOCIAL_DETAILS"
(
    "ID" BIGINT NOT NULL,
    "TYPE" VARCHAR(16),
    "REMARK" VARCHAR(64),
    "APP_ID" VARCHAR(64),
    "APP_SECRET" VARCHAR(64),
    "REDIRECT_URL" VARCHAR(128),
    "EXT" VARCHAR(255),
    "CREATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "UPDATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "CREATE_TIME" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP(),
    "UPDATE_TIME" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP(),
    "DEL_FLAG" CHAR(1) DEFAULT '0',
    "TENANT_ID" BIGINT DEFAULT 0 NOT NULL,
    NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_SOCIAL_DETAILS" IS '系统社交登录账号表';
COMMENT ON COLUMN "EMERGENCY"."SYS_SOCIAL_DETAILS"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "EMERGENCY"."SYS_SOCIAL_DETAILS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_SOCIAL_DETAILS"."EXT" IS '拓展字段';
COMMENT ON COLUMN "EMERGENCY"."SYS_SOCIAL_DETAILS"."ID" IS '主鍵';
COMMENT ON COLUMN "EMERGENCY"."SYS_SOCIAL_DETAILS"."TENANT_ID" IS '所属租户';
COMMENT ON COLUMN "EMERGENCY"."SYS_SOCIAL_DETAILS"."UPDATE_BY" IS '修改人';
COMMENT ON COLUMN "EMERGENCY"."SYS_SOCIAL_DETAILS"."UPDATE_TIME" IS '更新时间';


CREATE TABLE "EMERGENCY"."SYS_TENANT"
(
    "ID" BIGINT NOT NULL,
    "NAME" VARCHAR(255),
    "CODE" VARCHAR(64),
    "TENANT_DOMAIN" VARCHAR(255),
    "START_TIME" TIMESTAMP(0),
    "END_TIME" TIMESTAMP(0),
    "STATUS" CHAR(1) DEFAULT '0',
    "DEL_FLAG" CHAR(1) DEFAULT '0',
    "CREATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "UPDATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "CREATE_TIME" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP() NOT NULL,
    "UPDATE_TIME" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP() NOT NULL,
    "MENU_ID" BIGINT,
    NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_TENANT" IS '租户表';
COMMENT ON COLUMN "EMERGENCY"."SYS_TENANT"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "EMERGENCY"."SYS_TENANT"."CREATE_TIME" IS '创建';
COMMENT ON COLUMN "EMERGENCY"."SYS_TENANT"."END_TIME" IS '结束时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_TENANT"."ID" IS '租户id';
COMMENT ON COLUMN "EMERGENCY"."SYS_TENANT"."START_TIME" IS '开始时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_TENANT"."UPDATE_BY" IS '修改人';
COMMENT ON COLUMN "EMERGENCY"."SYS_TENANT"."UPDATE_TIME" IS '更新时间';


CREATE TABLE "EMERGENCY"."SYS_TENANT_MENU"
(
    "ID" BIGINT NOT NULL,
    "NAME" VARCHAR(255) NOT NULL,
    "MENU_IDS" TEXT NOT NULL,
    "STATUS" CHAR(1) DEFAULT '0' NOT NULL,
    "DEL_FLAG" CHAR(1) DEFAULT '0',
    "CREATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "UPDATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "CREATE_TIME" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP() NOT NULL,
    "UPDATE_TIME" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP() NOT NULL,
    NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON COLUMN "EMERGENCY"."SYS_TENANT_MENU"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "EMERGENCY"."SYS_TENANT_MENU"."CREATE_TIME" IS '创建';
COMMENT ON COLUMN "EMERGENCY"."SYS_TENANT_MENU"."MENU_IDS" IS '菜单id集合';
COMMENT ON COLUMN "EMERGENCY"."SYS_TENANT_MENU"."NAME" IS '租户菜单名称';
COMMENT ON COLUMN "EMERGENCY"."SYS_TENANT_MENU"."STATUS" IS '租户菜单,9:冻结,0:正常';
COMMENT ON COLUMN "EMERGENCY"."SYS_TENANT_MENU"."UPDATE_BY" IS '修改人';
COMMENT ON COLUMN "EMERGENCY"."SYS_TENANT_MENU"."UPDATE_TIME" IS '更新时间';


CREATE TABLE "EMERGENCY"."SYS_TREE_DICT"
(
    "ID" VARCHAR2(255) NOT NULL,
    "PARENT_ID" VARCHAR2(255),
    "NAME_" VARCHAR2(255),
    "CONTENT_" VARCHAR2(200),
    "SORT_" INTEGER,
    "TYPE_" INTEGER,
    "DEL_FLAG" INTEGER,
    "CREATE_BY" BIGINT,
    "UPDATE_BY" BIGINT,
    "CREATE_TIME" TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP(),
    "UPDATE_TIME" TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP(),
    "CODE_" VARCHAR2(255),
    "PATH_" VARCHAR2(1000),
    "DIFFERENCE_" VARCHAR2(10),
    "PARENT_CODE" VARCHAR2(255),
    NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_TREE_DICT" IS '系统树形字典';
COMMENT ON COLUMN "EMERGENCY"."SYS_TREE_DICT"."CODE_" IS '物资code';
COMMENT ON COLUMN "EMERGENCY"."SYS_TREE_DICT"."CONTENT_" IS '内容';
COMMENT ON COLUMN "EMERGENCY"."SYS_TREE_DICT"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "EMERGENCY"."SYS_TREE_DICT"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_TREE_DICT"."DEL_FLAG" IS '是否删除  -1：已删除  0：正常';
COMMENT ON COLUMN "EMERGENCY"."SYS_TREE_DICT"."DIFFERENCE_" IS '1 物资大类   2 物资类别  3 物资名称  4 物资单位';
COMMENT ON COLUMN "EMERGENCY"."SYS_TREE_DICT"."ID" IS 'ID';
COMMENT ON COLUMN "EMERGENCY"."SYS_TREE_DICT"."NAME_" IS '名称';
COMMENT ON COLUMN "EMERGENCY"."SYS_TREE_DICT"."PARENT_CODE" IS '父级CODE';
COMMENT ON COLUMN "EMERGENCY"."SYS_TREE_DICT"."PARENT_ID" IS '父级ID';
COMMENT ON COLUMN "EMERGENCY"."SYS_TREE_DICT"."PATH_" IS '物资code全路径';
COMMENT ON COLUMN "EMERGENCY"."SYS_TREE_DICT"."SORT_" IS '排序';
COMMENT ON COLUMN "EMERGENCY"."SYS_TREE_DICT"."TYPE_" IS '类型  1 物资信息';
COMMENT ON COLUMN "EMERGENCY"."SYS_TREE_DICT"."UPDATE_BY" IS '修改人';
COMMENT ON COLUMN "EMERGENCY"."SYS_TREE_DICT"."UPDATE_TIME" IS '修改时间';


CREATE TABLE "EMERGENCY"."SYS_USER"
(
    "USER_ID" VARCHAR(50) NOT NULL,
    "USERNAME" VARCHAR(64),
    "PASSWORD" VARCHAR(255),
    "SALT" VARCHAR(255),
    "PHONE" VARCHAR(20),
    "AVATAR" VARCHAR(255),
    "NICKNAME" VARCHAR(64),
    "NAME" VARCHAR(64),
    "EMAIL" VARCHAR(128),
    "DEPT_ID" BIGINT,
    "CREATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "UPDATE_BY" VARCHAR(64) DEFAULT '' NOT NULL,
    "CREATE_TIME" TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP(),
    "UPDATE_TIME" TIMESTAMP(0),
    "LOCK_FLAG" CHAR(1) DEFAULT '0',
    "DEL_FLAG" CHAR(1) DEFAULT '0',
    "WX_OPENID" VARCHAR(32),
    "MINI_OPENID" VARCHAR(32),
    "QQ_OPENID" VARCHAR(32),
    "GITEE_LOGIN" VARCHAR(100),
    "OSC_ID" VARCHAR(100),
    "TENANT_ID" BIGINT DEFAULT 0 NOT NULL,
    NOT CLUSTER PRIMARY KEY("USER_ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_USER" IS '用户表';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER"."DEPT_ID" IS '部门ID';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER"."EMAIL" IS '拓展字段:邮箱';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER"."GITEE_LOGIN" IS '码云 标识';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER"."MINI_OPENID" IS '小程序openId';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER"."NAME" IS '拓展字段:姓名';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER"."NICKNAME" IS '拓展字段:昵称';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER"."OSC_ID" IS '开源中国 标识';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER"."QQ_OPENID" IS 'QQ openId';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER"."TENANT_ID" IS '所属租户';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER"."UPDATE_BY" IS '修改人';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER"."UPDATE_TIME" IS '修改时间';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER"."USER_ID" IS '主键ID';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER"."WX_OPENID" IS '微信登录openId';


CREATE OR REPLACE  INDEX "USER_QQ_OPENID" ON "EMERGENCY"."SYS_USER"("QQ_OPENID" ASC) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;
CREATE OR REPLACE  INDEX "USER_WX_OPENID" ON "EMERGENCY"."SYS_USER"("WX_OPENID" ASC) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;
CREATE OR REPLACE  INDEX "USER_IDX1_USERNAME" ON "EMERGENCY"."SYS_USER"("USERNAME" ASC) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;
CREATE OR REPLACE UNIQUE  INDEX "idx_name_USERNAME" ON "EMERGENCY"."SYS_USER"("USERNAME" ASC) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

CREATE TABLE "EMERGENCY"."SYS_USER_POST"
(
    "USER_ID" VARCHAR(50) NOT NULL,
    "POST_ID" BIGINT NOT NULL,
    NOT CLUSTER PRIMARY KEY("USER_ID", "POST_ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_USER_POST" IS '用户与岗位关联表';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER_POST"."POST_ID" IS '岗位ID';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER_POST"."USER_ID" IS '用户ID';


CREATE TABLE "EMERGENCY"."SYS_USER_ROLE"
(
    "USER_ID" VARCHAR(50) NOT NULL,
    "ROLE_ID" BIGINT NOT NULL,
    NOT CLUSTER PRIMARY KEY("USER_ID", "ROLE_ID")) STORAGE(ON "EMERGENCY", CLUSTERBTR) ;

COMMENT ON TABLE "EMERGENCY"."SYS_USER_ROLE" IS '用户角色表';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER_ROLE"."ROLE_ID" IS '角色ID';
COMMENT ON COLUMN "EMERGENCY"."SYS_USER_ROLE"."USER_ID" IS '用户ID';



