
CREATE TABLE UC_DEMENSION
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   DEM_NAME_            NVARCHAR2(64)         DEFAULT NULL,
   CODE_                NVARCHAR2(64)         DEFAULT NULL,
   IS_DEFAULT_          INTEGER              DEFAULT NULL,
   DEM_DESC_            NVARCHAR2(255)        DEFAULT NULL,
   ORGAN_ID_            NVARCHAR2(64)         DEFAULT NULL,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   UPDATE_TIME_         DATE,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_DEMENSION PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_DEMENSION IS
'维度管理';

COMMENT ON COLUMN UC_DEMENSION.DEM_NAME_ IS
'维度名称';

COMMENT ON COLUMN UC_DEMENSION.CODE_ IS
'维度代码';

COMMENT ON COLUMN UC_DEMENSION.IS_DEFAULT_ IS
'是否默认(1:默认,0:非默认)';

COMMENT ON COLUMN UC_DEMENSION.DEM_DESC_ IS
'描述';

COMMENT ON COLUMN UC_DEMENSION.ORGAN_ID_ IS
'机构id';

COMMENT ON COLUMN UC_DEMENSION.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_DEMENSION.VERSION_ IS
'版本号';

CREATE TABLE UC_ELECTRONIC_SEAL 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   USER_ID_             NVARCHAR2(64),
   FILE_ID_             NVARCHAR2(64),
   PASSWORD_            NVARCHAR2(64),
   IS_USE_              INTEGER,
   CREATE_TIME_         DATE                 DEFAULT NULL,
   UPDATE_TIME_         DATE                 DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_ELECTRONIC_SEAL PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_ELECTRONIC_SEAL IS
'电子签章表';

COMMENT ON COLUMN UC_ELECTRONIC_SEAL.ID_ IS
'主键ID';

COMMENT ON COLUMN UC_ELECTRONIC_SEAL.USER_ID_ IS
'用户ID';

COMMENT ON COLUMN UC_ELECTRONIC_SEAL.FILE_ID_ IS
'签章图片ID';

COMMENT ON COLUMN UC_ELECTRONIC_SEAL.PASSWORD_ IS
'使用密码';

COMMENT ON COLUMN UC_ELECTRONIC_SEAL.IS_USE_ IS
'当前是否使用';

COMMENT ON COLUMN UC_ELECTRONIC_SEAL.CREATE_TIME_ IS
'创建时间';

COMMENT ON COLUMN UC_ELECTRONIC_SEAL.UPDATE_TIME_ IS
'更新时间';

COMMENT ON COLUMN UC_ELECTRONIC_SEAL.CREATE_BY_ IS
'创建人';

COMMENT ON COLUMN UC_ELECTRONIC_SEAL.UPDATE_BY_ IS
'更新人';

COMMENT ON COLUMN UC_ELECTRONIC_SEAL.TENANT_ID_ IS
'租户ID';

CREATE TABLE UC_HOLIDAY 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(128)        DEFAULT NULL,
   KEY_                 NVARCHAR2(128)        DEFAULT NULL,
   DESC_                CLOB,
   IS_DELE_             SMALLINT             DEFAULT NULL,
   CREATE_TIME_         DATE                 DEFAULT NULL,
   UPDATE_TIME_         DATE                 DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   VERSION_             INTEGER              DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_HOLIDAY PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_HOLIDAY IS
'法定节假日';

COMMENT ON COLUMN UC_HOLIDAY.ID_ IS
'主键';

COMMENT ON COLUMN UC_HOLIDAY.NAME_ IS
'节日名称';

COMMENT ON COLUMN UC_HOLIDAY.KEY_ IS
'节日KEY';

COMMENT ON COLUMN UC_HOLIDAY.DESC_ IS
'描述';

COMMENT ON COLUMN UC_HOLIDAY.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_HOLIDAY.CREATE_TIME_ IS
'创建时间';

COMMENT ON COLUMN UC_HOLIDAY.UPDATE_TIME_ IS
'更新时间';

COMMENT ON COLUMN UC_HOLIDAY.CREATE_BY_ IS
'创建人ID';

COMMENT ON COLUMN UC_HOLIDAY.UPDATE_BY_ IS
'更新人ID';

COMMENT ON COLUMN UC_HOLIDAY.CREATE_ORG_ID_ IS
'创建组织ID';

COMMENT ON COLUMN UC_HOLIDAY.VERSION_ IS
'版本';

COMMENT ON COLUMN UC_HOLIDAY.TENANT_ID_ IS
'租户ID';

CREATE TABLE UC_HOLIDAY_TIME 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   START_TIME_          DATE                 DEFAULT NULL,
   END_TIME_            DATE                 DEFAULT NULL,
   HOLIDAY_ID_          NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   TYPE_                SMALLINT,
   CONSTRAINT PK_UC_HOLIDAY_TIME PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_HOLIDAY_TIME IS
'假期时间';

COMMENT ON COLUMN UC_HOLIDAY_TIME.ID_ IS
'主键';

COMMENT ON COLUMN UC_HOLIDAY_TIME.START_TIME_ IS
'假期开始时间';

COMMENT ON COLUMN UC_HOLIDAY_TIME.END_TIME_ IS
'假期结束时间';

COMMENT ON COLUMN UC_HOLIDAY_TIME.HOLIDAY_ID_ IS
'假期ID';

COMMENT ON COLUMN UC_HOLIDAY_TIME.TENANT_ID_ IS
'租户ID';

COMMENT ON COLUMN UC_HOLIDAY_TIME.TYPE_ IS
'类型：0假期 1补班';

CREATE TABLE UC_LOGIN_LOG 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(64)         DEFAULT NULL,
   ACCOUNT_             NVARCHAR2(64)         DEFAULT NULL,
   IP_                  NVARCHAR2(20)         DEFAULT NULL,
   LOGIN_TYPE_          NVARCHAR2(20)         DEFAULT NULL,
   PC_SUM_              INTEGER              DEFAULT 0,
   MOBILE_SUM_          INTEGER              DEFAULT 0,
   LOGIN_SUM_           INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_TIME_         DATE,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   IS_DELE_             CHAR(1)              DEFAULT NULL,
   VERSION_             INTEGER              DEFAULT NULL,
   CONSTRAINT PK_UC_LOGIN_LOG PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_LOGIN_LOG IS
'用户登录日志表';

COMMENT ON COLUMN UC_LOGIN_LOG.ID_ IS
'主键，用户id';

COMMENT ON COLUMN UC_LOGIN_LOG.NAME_ IS
'用户名';

COMMENT ON COLUMN UC_LOGIN_LOG.ACCOUNT_ IS
'用户账号';

COMMENT ON COLUMN UC_LOGIN_LOG.IP_ IS
'登录IP';

COMMENT ON COLUMN UC_LOGIN_LOG.LOGIN_TYPE_ IS
'登录类型（pc：电脑端登录，mobile：移动端登录）';

COMMENT ON COLUMN UC_LOGIN_LOG.PC_SUM_ IS
'PC端登录次数';

COMMENT ON COLUMN UC_LOGIN_LOG.MOBILE_SUM_ IS
'移动端登录次数';

COMMENT ON COLUMN UC_LOGIN_LOG.LOGIN_SUM_ IS
'登录次数';

COMMENT ON COLUMN UC_LOGIN_LOG.CREATE_BY_ IS
'创建人';

COMMENT ON COLUMN UC_LOGIN_LOG.CREATE_ORG_ID_ IS
'创建人所属部门id';

COMMENT ON COLUMN UC_LOGIN_LOG.UPDATE_BY_ IS
'更新人id';

COMMENT ON COLUMN UC_LOGIN_LOG.TENANT_ID_ IS
'租户id';

COMMENT ON COLUMN UC_LOGIN_LOG.VERSION_ IS
'版本号';

CREATE TABLE UC_MATRIX 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   CODE_                NVARCHAR2(255)        DEFAULT NULL,
   NAME_                NVARCHAR2(255)        DEFAULT NULL,
   TYPE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   TYPE_NAME_           NVARCHAR2(255)        DEFAULT NULL,
   STATUS_              INTEGER              DEFAULT NULL,
   MANAGER_ID_          NVARCHAR2(64)         DEFAULT NULL,
   MANAGER_NAME_        NVARCHAR2(255)        DEFAULT NULL,
   IS_DELE_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE                 DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE                 DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   ENABLED_             NUMBER DEFAULT 1,
   CONSTRAINT PK_UC_MATRIX PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_MATRIX IS
'矩阵管理';

COMMENT ON COLUMN UC_MATRIX.ID_ IS
'主键';

COMMENT ON COLUMN UC_MATRIX.CODE_ IS
'编码/别名';

COMMENT ON COLUMN UC_MATRIX.NAME_ IS
'名称';

COMMENT ON COLUMN UC_MATRIX.TYPE_ID_ IS
'分类ID';

COMMENT ON COLUMN UC_MATRIX.TYPE_NAME_ IS
'分类名称';

COMMENT ON COLUMN UC_MATRIX.STATUS_ IS
'状态：0待发布、1已发布';

COMMENT ON COLUMN UC_MATRIX.MANAGER_ID_ IS
'管理员ID';

COMMENT ON COLUMN UC_MATRIX.MANAGER_NAME_ IS
'管理员名称';

COMMENT ON COLUMN UC_MATRIX.IS_DELE_ IS
'是否删除：0未除、1已删';

COMMENT ON COLUMN UC_MATRIX.CREATE_BY_ IS
'创建人';

COMMENT ON COLUMN UC_MATRIX.CREATE_TIME_ IS
'创建时间';

COMMENT ON COLUMN UC_MATRIX.CREATE_ORG_ID_ IS
'创建人部门id';

COMMENT ON COLUMN UC_MATRIX.UPDATE_BY_ IS
'更新人';

COMMENT ON COLUMN UC_MATRIX.UPDATE_TIME_ IS
'更新时间';

COMMENT ON COLUMN UC_MATRIX.TENANT_ID_ IS
'租户id';
COMMENT ON COLUMN UC_MATRIX.ENABLED_ IS '是否启用: 0禁用 1启用';

CREATE TABLE UC_MATRIX_COL_DEF 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   MATRIX_ID_           NVARCHAR2(255)        DEFAULT NULL,
   CODE_                NVARCHAR2(20)         DEFAULT NULL,
   NAME_                NVARCHAR2(128)        DEFAULT NULL,
   STATUS_              INTEGER              DEFAULT NULL,
   COL_TYPE_            INTEGER              DEFAULT NULL,
   SELECT_TYPE_         INTEGER              DEFAULT NULL,
   CTRL_TYPE_           NVARCHAR2(20)         DEFAULT NULL,
   QUERY_ALIAS_         NVARCHAR2(255)        DEFAULT NULL,
   COL_CONFIG_          NVARCHAR2(255)        DEFAULT NULL,
   IS_DELE_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE                 DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE                 DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   SN_                  INTEGER              DEFAULT NULL,
   BIND_KEY_            NVARCHAR2(255)        DEFAULT NULL,
   BIND_VALUE_          NVARCHAR2(255)        DEFAULT NULL,
   SEARCH_FIELD_        NVARCHAR2(50)         DEFAULT NULL,
   CONSTRAINT PK_UC_MATRIX_COL_DEF PRIMARY KEY (ID_)
);
COMMENT ON TABLE UC_MATRIX_COL_DEF IS '矩阵列定义';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.ID_ IS '主键';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.MATRIX_ID_ IS '所属矩阵ID';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.CODE_ IS '列字段名';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.NAME_ IS '列中文名';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.STATUS_ IS '列状态：0未创建列、1已创建列';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.COL_TYPE_ IS '列类型：1条件列、2角色列';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.SELECT_TYPE_ IS '选择类型：1单选、2多选';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.CTRL_TYPE_ IS '控件类型';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.QUERY_ALIAS_ IS '关联查询alias';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.COL_CONFIG_ IS '列配置信息';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.IS_DELE_ IS '是否删除：0未删、1已删';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.CREATE_BY_ IS '创建人';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.CREATE_TIME_ IS '创建时间';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.CREATE_ORG_ID_ IS '创建人部门id'; 
COMMENT ON COLUMN UC_MATRIX_COL_DEF.UPDATE_BY_ IS '更新人';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.UPDATE_TIME_ IS '更新时间';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.TENANT_ID_ IS '租户id';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.SN_ IS '排序';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.BIND_KEY_ IS '条件列的回填KEY的绑定值';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.BIND_VALUE_ IS '条件列的回填value的绑定值';
COMMENT ON COLUMN UC_MATRIX_COL_DEF.SEARCH_FIELD_ IS '搜索条件字段标识';

CREATE TABLE UC_OPERATE_LOG 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   REQ_IP_              NVARCHAR2(255)        DEFAULT NULL,
   REQ_TYPE_            NVARCHAR2(64)         DEFAULT NULL,
   REQ_URL_             NVARCHAR2(200)        DEFAULT NULL,
   REQ_PARAM_           CLOB,
   START_TIME_          DATE,
   END_TIME_            DATE,
   OPERATOR_NAME_       NVARCHAR2(64)         DEFAULT NULL,
   NOTE_                NVARCHAR2(2000)       DEFAULT NULL,
   SUCCESS_             INTEGER              DEFAULT NULL,
   FAIL_REASON_         NVARCHAR2(2000)       DEFAULT NULL,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   CONSTRAINT PK_UC_OPERATE_LOG PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_OPERATE_LOG IS
'操作日志';

COMMENT ON COLUMN UC_OPERATE_LOG.REQ_IP_ IS
'请求ip地址';

COMMENT ON COLUMN UC_OPERATE_LOG.REQ_TYPE_ IS
'请求方式';

COMMENT ON COLUMN UC_OPERATE_LOG.REQ_URL_ IS
'请求地址';

COMMENT ON COLUMN UC_OPERATE_LOG.OPERATOR_NAME_ IS
'操作人';

COMMENT ON COLUMN UC_OPERATE_LOG.NOTE_ IS
'说明';

COMMENT ON COLUMN UC_OPERATE_LOG.SUCCESS_ IS
'是否成功';

COMMENT ON COLUMN UC_OPERATE_LOG.FAIL_REASON_ IS
'失败原因';

COMMENT ON COLUMN UC_OPERATE_LOG.IS_DELE_ IS
'是否已删，1已删除，0未删除';

CREATE TABLE UC_ORG 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(150)         DEFAULT NULL,
   PARENT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   ORDER_NO_            INTEGER              DEFAULT NULL,
   CODE_                NVARCHAR2(64)         NOT NULL,
   GRADE_               NVARCHAR2(64)         DEFAULT NULL,
   PATH_                NVARCHAR2(512)        DEFAULT NULL,
   PATH_NAME_           NVARCHAR2(512)        DEFAULT NULL,
   DEM_ID_              NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   LIMIT_NUM_           INTEGER              DEFAULT 0 NOT NULL,
   NOW_NUM_             INTEGER              DEFAULT NULL,
   EXCEED_LIMIT_NUM_    INTEGER              DEFAULT 0 NOT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_ORG PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_ORG IS
'组织架构';

COMMENT ON COLUMN UC_ORG.NAME_ IS
'名称';

COMMENT ON COLUMN UC_ORG.PARENT_ID_ IS
'父组织id';

COMMENT ON COLUMN UC_ORG.ORDER_NO_ IS
'排序号';

COMMENT ON COLUMN UC_ORG.CODE_ IS
'组织代码';

COMMENT ON COLUMN UC_ORG.GRADE_ IS
'级别';

COMMENT ON COLUMN UC_ORG.PATH_ IS
'组织id路径，包含层级关系';

COMMENT ON COLUMN UC_ORG.PATH_NAME_ IS
'组织名路径，包含层级关系';

COMMENT ON COLUMN UC_ORG.DEM_ID_ IS
'维度id';

COMMENT ON COLUMN UC_ORG.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_ORG.VERSION_ IS
'版本号';

COMMENT ON COLUMN UC_ORG.LIMIT_NUM_ IS
'组织限编用户数量(0:不受限制)';

COMMENT ON COLUMN UC_ORG.NOW_NUM_ IS
'组织现编用户数量';

COMMENT ON COLUMN UC_ORG.EXCEED_LIMIT_NUM_ IS
'是否允许超过限编(0:允许；1:不允许)';

CREATE TABLE UC_ORGAN 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   CODE_                NVARCHAR2(64)         DEFAULT NULL,
   NAME_                NVARCHAR2(255)        DEFAULT NULL,
   DESC_                NVARCHAR2(512)        DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CONSTRAINT PK_UC_ORGAN PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_ORGAN IS
'机构管理';

COMMENT ON COLUMN UC_ORGAN.CODE_ IS
'机构编码';

COMMENT ON COLUMN UC_ORGAN.NAME_ IS
'机构名称';

COMMENT ON COLUMN UC_ORGAN.DESC_ IS
'机构描述';

COMMENT ON COLUMN UC_ORGAN.CREATE_BY_ IS
'创建人';

COMMENT ON COLUMN UC_ORGAN.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_ORGAN.VERSION_ IS
'版本号';

CREATE TABLE UC_ORG_AUTH 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   ORG_ID_              NVARCHAR2(64)         DEFAULT NULL,
   DEM_ID_              NVARCHAR2(64)         DEFAULT NULL,
   ORG_PERMS_           NVARCHAR2(255)        DEFAULT NULL,
   USER_PERMS_          NVARCHAR2(255)        DEFAULT NULL,
   POS_PERMS_           NVARCHAR2(255)        DEFAULT NULL,
   ORGAUTH_PERMS_       NVARCHAR2(255)        DEFAULT NULL,
   LAYOUT_PERMS_        NVARCHAR2(255)        DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   ROLE_PERMS_          NVARCHAR2(255)        DEFAULT NULL,
   ROLE_CONFIG_         CLOB,
   CONSTRAINT PK_UC_ORG_AUTH PRIMARY KEY (ID_)
);
COMMENT ON TABLE UC_ORG_AUTH IS '分级组织管理';
COMMENT ON COLUMN UC_ORG_AUTH.USER_ID_ IS '分级组织管理员id';
COMMENT ON COLUMN UC_ORG_AUTH.ORG_ID_ IS '对应管理组织id';
COMMENT ON COLUMN UC_ORG_AUTH.DEM_ID_ IS '对应维度id';
COMMENT ON COLUMN UC_ORG_AUTH.ORG_PERMS_ IS '组织管理权限';
COMMENT ON COLUMN UC_ORG_AUTH.USER_PERMS_ IS '用户管理权限';
COMMENT ON COLUMN UC_ORG_AUTH.POS_PERMS_ IS '岗位管理权限';
COMMENT ON COLUMN UC_ORG_AUTH.ORGAUTH_PERMS_ IS '分级管理员权限';
COMMENT ON COLUMN UC_ORG_AUTH.LAYOUT_PERMS_ IS '首页布局管理权限';
COMMENT ON COLUMN UC_ORG_AUTH.IS_DELE_ IS '是否已删，1已删除，0未删除';
COMMENT ON COLUMN UC_ORG_AUTH.VERSION_ IS '版本号';
COMMENT ON COLUMN UC_ORG_AUTH.ROLE_PERMS_ IS '角色管理权限';
COMMENT ON COLUMN UC_ORG_AUTH.ROLE_CONFIG_ IS '角色配置';

CREATE TABLE UC_ORG_JOB 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(64)         NOT NULL,
   CODE_                NVARCHAR2(64)         NOT NULL,
   JOB_LEVEL_           NVARCHAR2(64)         DEFAULT NULL,
   DESCRIPTION_         NVARCHAR2(512)        DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_ORG_JOB PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_ORG_JOB IS
'职务定义';

COMMENT ON COLUMN UC_ORG_JOB.NAME_ IS
'名称';

COMMENT ON COLUMN UC_ORG_JOB.CODE_ IS
'编码';

COMMENT ON COLUMN UC_ORG_JOB.JOB_LEVEL_ IS
'职务级别';

COMMENT ON COLUMN UC_ORG_JOB.DESCRIPTION_ IS
'描述';

COMMENT ON COLUMN UC_ORG_JOB.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_ORG_JOB.VERSION_ IS
'版本号';

CREATE TABLE UC_ORG_PARAMS 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   ORG_ID_              NVARCHAR2(64)         DEFAULT NULL,
   CODE_                NVARCHAR2(64)         DEFAULT NULL,
   VALUE_               NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_ORG_PARAMS PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_ORG_PARAMS IS
'组织参数';

COMMENT ON COLUMN UC_ORG_PARAMS.ORG_ID_ IS
'组织id';

COMMENT ON COLUMN UC_ORG_PARAMS.CODE_ IS
'参数代码';

COMMENT ON COLUMN UC_ORG_PARAMS.VALUE_ IS
'值';

COMMENT ON COLUMN UC_ORG_PARAMS.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_ORG_PARAMS.VERSION_ IS
'版本号';

CREATE TABLE UC_ORG_POST 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   ORG_ID_              NVARCHAR2(64)         DEFAULT NULL,
   JOB_ID_              NVARCHAR2(64)         DEFAULT NULL,
   POS_NAME_            NVARCHAR2(64)         DEFAULT NULL,
   CODE_                NVARCHAR2(64)         DEFAULT NULL,
   IS_CHARGE_           INTEGER              DEFAULT 0 NOT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   PARENT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_ORG_POST PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_ORG_POST IS
'部门岗位';

COMMENT ON COLUMN UC_ORG_POST.ORG_ID_ IS
'组织id';

COMMENT ON COLUMN UC_ORG_POST.JOB_ID_ IS
'职务id';

COMMENT ON COLUMN UC_ORG_POST.POS_NAME_ IS
'岗位名称';

COMMENT ON COLUMN UC_ORG_POST.CODE_ IS
'岗位编码';

COMMENT ON COLUMN UC_ORG_POST.IS_CHARGE_ IS
'是否主岗位：1主岗位，0 非主岗位';

COMMENT ON COLUMN UC_ORG_POST.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_ORG_POST.VERSION_ IS
'版本号';

CREATE TABLE UC_ORG_ROLE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   ROLE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   ORG_ID_              NVARCHAR2(64)         DEFAULT NULL,
   IS_INHERIT_          INTEGER              DEFAULT 0,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_ORG_ROLE PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_ORG_ROLE IS
'组织角色管理';

COMMENT ON COLUMN UC_ORG_ROLE.ROLE_ID_ IS
'角色id';

COMMENT ON COLUMN UC_ORG_ROLE.ORG_ID_ IS
'组织id';

COMMENT ON COLUMN UC_ORG_ROLE.IS_INHERIT_ IS
'子组织是否可以继承,0:不可1:可以';

COMMENT ON COLUMN UC_ORG_ROLE.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_ORG_ROLE.VERSION_ IS
'版本号';

CREATE TABLE UC_ORG_USER 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   ORG_ID_              NVARCHAR2(64)         DEFAULT NULL,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   IS_MASTER_           INTEGER              DEFAULT 0 NOT NULL,
   POS_ID_              NVARCHAR2(64)         DEFAULT NULL,
   IS_CHARGE_           INTEGER              DEFAULT 0,
   START_DATE_          DATE,
   END_DATE_            DATE,
   IS_REL_ACTIVE_       INTEGER              NOT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   DEM_ID_              NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_ORG_USER PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_ORG_USER IS
'用户组织关系';

COMMENT ON COLUMN UC_ORG_USER.ORG_ID_ IS
'组织编号';

COMMENT ON COLUMN UC_ORG_USER.USER_ID_ IS
'用户编号';

COMMENT ON COLUMN UC_ORG_USER.IS_MASTER_ IS
'0:非主部门，1：主部门';

COMMENT ON COLUMN UC_ORG_USER.POS_ID_ IS
'岗位id';

COMMENT ON COLUMN UC_ORG_USER.IS_CHARGE_ IS
'2组织主负责人，1组织负责人，0 不是负责人';

COMMENT ON COLUMN UC_ORG_USER.IS_REL_ACTIVE_ IS
'是否有效，0:无效，1：有效';

COMMENT ON COLUMN UC_ORG_USER.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_ORG_USER.VERSION_ IS
'版本号';

COMMENT ON COLUMN UC_ORG_USER.DEM_ID_ IS
'维度ID';

CREATE TABLE UC_PARAMS 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(64)         DEFAULT NULL,
   CODE_                NVARCHAR2(64)         DEFAULT NULL,
   TYPE_                NVARCHAR2(64)         DEFAULT NULL,
   CTL_TYPE_            NVARCHAR2(64)         DEFAULT NULL,
   JSON_                NVARCHAR2(1700)        DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_TYPE_ID_      NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_PARAMS PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_PARAMS IS
'用户组织参数';

COMMENT ON COLUMN UC_PARAMS.NAME_ IS
'参数名称';

COMMENT ON COLUMN UC_PARAMS.CODE_ IS
'参数代码';

COMMENT ON COLUMN UC_PARAMS.TYPE_ IS
'类型';

COMMENT ON COLUMN UC_PARAMS.CTL_TYPE_ IS
'控件类型';

COMMENT ON COLUMN UC_PARAMS.JSON_ IS
'jsON值';

COMMENT ON COLUMN UC_PARAMS.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_PARAMS.VERSION_ IS
'版本号';


CREATE TABLE UC_PWD_STRATEGY 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   INIT_PWD_            NVARCHAR2(64)         DEFAULT NULL,
   PWD_RULE_            SMALLINT             DEFAULT NULL,
   PWD_LENGTH_          SMALLINT             DEFAULT NULL,
   DURATION_            SMALLINT             DEFAULT NULL,
   ENABLE_              SMALLINT             DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_PWD_STRATEGY PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_PWD_STRATEGY IS
'密码策略';

COMMENT ON COLUMN UC_PWD_STRATEGY.PWD_RULE_ IS
'密码规则';

COMMENT ON COLUMN UC_PWD_STRATEGY.PWD_LENGTH_ IS
'密码长度';

COMMENT ON COLUMN UC_PWD_STRATEGY.DURATION_ IS
'密码时长（单位：天）';

COMMENT ON COLUMN UC_PWD_STRATEGY.ENABLE_ IS
'启用策略	0:停用，1:启用';

CREATE TABLE UC_REL_AUTH 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   REL_ID_              NVARCHAR2(64)         DEFAULT NULL,
   TYPE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_REL_AUTH PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_REL_AUTH IS
'分级组织管理';

COMMENT ON COLUMN UC_REL_AUTH.USER_ID_ IS
'分级汇报线管理员id';

COMMENT ON COLUMN UC_REL_AUTH.REL_ID_ IS
'对应汇报线节点id';

COMMENT ON COLUMN UC_REL_AUTH.TYPE_ID_ IS
'对应汇报线分类id';

COMMENT ON COLUMN UC_REL_AUTH.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_REL_AUTH.VERSION_ IS
'版本号';

CREATE TABLE UC_REL_TYPE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(64)         DEFAULT NULL,
   CODE_                NVARCHAR2(64)         DEFAULT NULL,
   DESCRIPTION_         NVARCHAR2(255)        DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CONSTRAINT PK_UC_REL_TYPE PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_REL_TYPE IS
'分级组织类别';

COMMENT ON COLUMN UC_REL_TYPE.NAME_ IS
'汇报关系分类名称';

COMMENT ON COLUMN UC_REL_TYPE.CODE_ IS
'英文别名';

COMMENT ON COLUMN UC_REL_TYPE.DESCRIPTION_ IS
'描述';

COMMENT ON COLUMN UC_REL_TYPE.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_REL_TYPE.VERSION_ IS
'版本号';

CREATE TABLE UC_ROLE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(150)        DEFAULT NULL,
   CODE_                NVARCHAR2(64)         DEFAULT NULL,
   ENABLED_             INTEGER              DEFAULT NULL,
   DESCRIPTION_         NVARCHAR2(150)        DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_ROLE PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_ROLE IS
'汇报关系分类管理';

COMMENT ON COLUMN UC_ROLE.NAME_ IS
'角色名称';

COMMENT ON COLUMN UC_ROLE.CODE_ IS
'英文别名';

COMMENT ON COLUMN UC_ROLE.ENABLED_ IS
'可用 0：禁用，1：启用';

COMMENT ON COLUMN UC_ROLE.DESCRIPTION_ IS
'描述';

COMMENT ON COLUMN UC_ROLE.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_ROLE.VERSION_ IS
'版本号';

CREATE TABLE UC_SHIFT_RULE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(128)        DEFAULT NULL,
   KEY_                 NVARCHAR2(128)        DEFAULT NULL,
   DESC_                CLOB,
   RULE_                CLOB,
   HOLIDAY_ID_          NVARCHAR2(64)         DEFAULT NULL,
   IS_DELE_             NVARCHAR2(1)          DEFAULT NULL,
   CREATE_TIME_         DATE                 DEFAULT NULL,
   UPDATE_TIME_         DATE                 DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   VERSION_             INTEGER              DEFAULT NULL,
   CONSTRAINT PK_UC_SHIFT_RULE PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_SHIFT_RULE IS
'排班规则';

COMMENT ON COLUMN UC_SHIFT_RULE.ID_ IS
'主键';

COMMENT ON COLUMN UC_SHIFT_RULE.NAME_ IS
'名称';

COMMENT ON COLUMN UC_SHIFT_RULE.KEY_ IS
'KEY';

COMMENT ON COLUMN UC_SHIFT_RULE.DESC_ IS
'描述';

COMMENT ON COLUMN UC_SHIFT_RULE.RULE_ IS
'规则';

COMMENT ON COLUMN UC_SHIFT_RULE.HOLIDAY_ID_ IS
'节假日ID';

COMMENT ON COLUMN UC_SHIFT_RULE.IS_DELE_ IS
'是否删除 1删除 0未删除';

COMMENT ON COLUMN UC_SHIFT_RULE.CREATE_TIME_ IS
'创建时间';

COMMENT ON COLUMN UC_SHIFT_RULE.UPDATE_TIME_ IS
'更新时间';

COMMENT ON COLUMN UC_SHIFT_RULE.CREATE_BY_ IS
'创建人';

COMMENT ON COLUMN UC_SHIFT_RULE.UPDATE_BY_ IS
'更新人';

COMMENT ON COLUMN UC_SHIFT_RULE.CREATE_ORG_ID_ IS
'创建人组织ID';

COMMENT ON COLUMN UC_SHIFT_RULE.TENANT_ID_ IS
'租户ID';

COMMENT ON COLUMN UC_SHIFT_RULE.VERSION_ IS
'版本';

CREATE TABLE UC_SHIFT_USER 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   SHIFT_ID_            NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   IS_DELE_             NVARCHAR2(1)          DEFAULT NULL,
   VERSION_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE                 DEFAULT NULL,
   UPDATE_TIME_         DATE                 DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_SHIFT_USER PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_SHIFT_USER IS
'排班用户表';

COMMENT ON COLUMN UC_SHIFT_USER.ID_ IS
'主键';

COMMENT ON COLUMN UC_SHIFT_USER.USER_ID_ IS
'用户ID';

COMMENT ON COLUMN UC_SHIFT_USER.SHIFT_ID_ IS
'排班ID';

COMMENT ON COLUMN UC_SHIFT_USER.TENANT_ID_ IS
'租户ID';

COMMENT ON COLUMN UC_SHIFT_USER.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_SHIFT_USER.VERSION_ IS
'版本';

COMMENT ON COLUMN UC_SHIFT_USER.CREATE_BY_ IS
'创建人ID';

COMMENT ON COLUMN UC_SHIFT_USER.UPDATE_BY_ IS
'更新人ID';

COMMENT ON COLUMN UC_SHIFT_USER.CREATE_TIME_ IS
'创建时间';

COMMENT ON COLUMN UC_SHIFT_USER.UPDATE_TIME_ IS
'更新时间';

COMMENT ON COLUMN UC_SHIFT_USER.CREATE_ORG_ID_ IS
'创建者所属组织ID';

CREATE TABLE UC_TENANT_AUTH 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   TYPE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   USER_NAME_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_TENANT_AUTH PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_TENANT_AUTH IS
'租户管理员';

CREATE TABLE UC_TENANT_IGNORE_MENU 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   MENU_CODE_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_TENANT_IGNORE_MENU PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_TENANT_IGNORE_MENU IS
'租户禁用菜单';

CREATE TABLE UC_TENANT_LOGS 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   TYPE_                NVARCHAR2(64)         DEFAULT NULL,
   NAME_                NVARCHAR2(300)        DEFAULT NULL,
   REQ_URL_             NVARCHAR2(300)        DEFAULT NULL,
   IP_                  NVARCHAR2(20)         DEFAULT NULL,
   PARAMS_              NVARCHAR2(2000)       DEFAULT NULL,
   OPE_CONTENT_         CLOB,
   RESULT_              SMALLINT             DEFAULT NULL,
   REASON_              NVARCHAR2(2000)       DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_TENANT_LOGS PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_TENANT_LOGS IS
'租户管理操作日志';

COMMENT ON COLUMN UC_TENANT_LOGS.RESULT_ IS
'操作结果（1:成功，0:失败）';

CREATE TABLE UC_TENANT_MAIL_SERVER 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   MAIL_TYPE_           NVARCHAR2(64)         DEFAULT NULL,
   MAIL_HOST_           NVARCHAR2(128)        DEFAULT NULL,
   MAIL_PASS_           NVARCHAR2(128)        DEFAULT NULL,
   NICK_NAME_           NVARCHAR2(128)        DEFAULT NULL,
   USER_NAME_           NVARCHAR2(128)        DEFAULT NULL,
   MAIL_PORT_           INTEGER               DEFAULT NULL,
   USE_SSL_             SMALLINT              DEFAULT NULL,
   DESC_                NVARCHAR2(300)        DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   SMTP_HOST_           NVARCHAR2(128)        DEFAULT NULL,
   SEND_PORT_           NVARCHAR2(20)         DEFAULT NULL,
   CONSTRAINT PK_UC_TENANT_MAIL_SERVER PRIMARY KEY (ID_)
);
COMMENT ON TABLE UC_TENANT_MAIL_SERVER IS '租户邮件服务器';
COMMENT ON COLUMN UC_TENANT_MAIL_SERVER.MAIL_PORT_ IS '端口号';
COMMENT ON COLUMN UC_TENANT_MAIL_SERVER.USE_SSL_ IS '是否使用SSL认证。0：否；1：是';
COMMENT ON COLUMN UC_TENANT_MAIL_SERVER.SMTP_HOST_ is 'smt主机';
COMMENT ON COLUMN UC_TENANT_MAIL_SERVER.SEND_PORT_ is '邮件服务器的端口';

CREATE TABLE UC_TENANT_MANAGE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   TYPE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   NAME_                NVARCHAR2(300)        DEFAULT NULL,
   CODE_                NVARCHAR2(128)        DEFAULT NULL,
   STATUS_              NVARCHAR2(20)         DEFAULT NULL,
   SHORTHAND_           NVARCHAR2(150)        DEFAULT NULL,
   DOMAIN_              NVARCHAR2(128)        DEFAULT NULL,
   MANAGE_LOGO_         NVARCHAR2(1200)       DEFAULT NULL,
   FRONT_LOGO_          NVARCHAR2(1200)       DEFAULT NULL,
   ICO_                 NVARCHAR2(1200)       DEFAULT NULL,
   DESC_                NVARCHAR2(300)        DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)               DEFAULT '0',
   NAME_FRONT_          NVARCHAR2(300)        DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   BASE_URL_            NVARCHAR2(128)        DEFAULT NULL,
   CONSTRAINT PK_UC_TENANT_MANAGE PRIMARY KEY (ID_)
);
COMMENT ON TABLE UC_TENANT_MANAGE IS '租户管理';
COMMENT ON COLUMN UC_TENANT_MANAGE.IS_DELE_ IS '是否已删，1已删除，0未删除';
COMMENT ON COLUMN UC_TENANT_MANAGE.NAME_FRONT_ IS '应用端租户名称';
COMMENT ON COLUMN UC_TENANT_MANAGE.BASE_URL_ IS '租户域名';

CREATE TABLE UC_TENANT_PARAMS 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CODE_                NVARCHAR2(64)         DEFAULT NULL,
   VALUE_               NVARCHAR2(600)        DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_TENANT_PARAMS PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_TENANT_PARAMS IS
'租户拓展参数';

CREATE TABLE UC_TENANT_TYPE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(64)         DEFAULT NULL,
   CODE_                NVARCHAR2(64)         DEFAULT NULL,
   STATUS_              NVARCHAR2(20)         DEFAULT NULL,
   IS_DEFAULT_          CHAR(1)              DEFAULT NULL,
   DESC_                NVARCHAR2(300)        DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_TENANT_TYPE PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_TENANT_TYPE IS
'租户类型';

CREATE TABLE UC_USER 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   FULLNAME_            NVARCHAR2(255)        DEFAULT NULL,
   ACCOUNT_             NVARCHAR2(255)        DEFAULT NULL,
   PASSWORD_            NVARCHAR2(64)         DEFAULT NULL,
   EMAIL_               NVARCHAR2(64)         DEFAULT NULL,
   MOBILE_              NVARCHAR2(255)        DEFAULT NULL,
   WEIXIN_              NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   ADDRESS_             NVARCHAR2(512)        DEFAULT NULL,
   PHOTO_               NVARCHAR2(255)        DEFAULT NULL,
   SEX_                 NVARCHAR2(64)         DEFAULT NULL,
   FROM_                NVARCHAR2(64)         DEFAULT NULL,
   STATUS_              INTEGER               DEFAULT NULL,
   HAS_SYNC_TO_WX_      INTEGER               DEFAULT NULL,
   NOTIFY_TYPE_         NVARCHAR2(64)         DEFAULT NULL,
   USER_NUMBER_         NVARCHAR2(64)         DEFAULT NULL,
   ID_CARD_             NVARCHAR2(38)         DEFAULT NULL,
   PHONE_               NVARCHAR2(64)         DEFAULT NULL,
   BIRTHDAY_            DATE,
   ENTRY_DATE_          DATE,
   LEAVE_DATE_          DATE,
   EDUCATION_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   IS_DELE_             CHAR(1)               DEFAULT '0',
   VERSION_             INTEGER               DEFAULT NULL,
   PWD_CREATE_TIME_     DATE,
   CLIENT_ID_           NVARCHAR2(255),
   CLIENT_TOKEN_        NVARCHAR2(255),
   TWO_VERIFY_SECRET_   NVARCHAR2(50)        default null,
   CONSTRAINT PK_UC_USER PRIMARY KEY (ID_)
);
COMMENT ON TABLE UC_USER IS '用户管理';
COMMENT ON COLUMN UC_USER.FULLNAME_ IS '姓名';
COMMENT ON COLUMN UC_USER.ACCOUNT_ IS '帐号';
COMMENT ON COLUMN UC_USER.PASSWORD_ IS '密码';
COMMENT ON COLUMN UC_USER.EMAIL_ IS '邮箱';
COMMENT ON COLUMN UC_USER.MOBILE_ IS '手机号码';
COMMENT ON COLUMN UC_USER.WEIXIN_ IS '微信号';
COMMENT ON COLUMN UC_USER.ADDRESS_ IS '地址';
COMMENT ON COLUMN UC_USER.PHOTO_ IS '头像';
COMMENT ON COLUMN UC_USER.SEX_ IS '性别：男，女，未知';
COMMENT ON COLUMN UC_USER.FROM_ IS '来源';
COMMENT ON COLUMN UC_USER.STATUS_ IS '0:禁用，1正常';
COMMENT ON COLUMN UC_USER.HAS_SYNC_TO_WX_ IS '微信同步关注状态: 0：未同步  1：已同步，尚未关注  2：已同步且已关注';
COMMENT ON COLUMN UC_USER.NOTIFY_TYPE_ IS '自定义接收消息类型';
COMMENT ON COLUMN UC_USER.USER_NUMBER_ IS '工号';
COMMENT ON COLUMN UC_USER.ID_CARD_ IS '身份证号';
COMMENT ON COLUMN UC_USER.PHONE_ IS '办公电话';
COMMENT ON COLUMN UC_USER.EDUCATION_ IS '学历';
COMMENT ON COLUMN UC_USER.IS_DELE_ IS '是否已删，1已删除，0未删除';
COMMENT ON COLUMN UC_USER.VERSION_ IS '版本号';
COMMENT ON COLUMN UC_USER.CLIENT_ID_ IS '推送服务令牌（设备唯一标识）';
COMMENT ON COLUMN UC_USER.CLIENT_TOKEN_ IS '设备令牌（iOS设备唯一标识）';
COMMENT ON COLUMN uc_user.TWO_VERIFY_SECRET_ IS '双因素验证绑定密钥';

CREATE TABLE UC_USER_GROUP 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(255)        DEFAULT NULL,
   JSON_                NVARCHAR2(2000)       DEFAULT NULL,
   CODE_                NVARCHAR2(64)         DEFAULT NULL,
   DESCRIPTION_         NVARCHAR2(512)        DEFAULT NULL,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   ORG_ID_              NVARCHAR2(64)         DEFAULT NULL,
   ROLE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   POS_ID_              NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_USER_GROUP PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_USER_GROUP IS
'群组管理';

COMMENT ON COLUMN UC_USER_GROUP.NAME_ IS
'名称';

COMMENT ON COLUMN UC_USER_GROUP.JSON_ IS
'群里的人或组';

COMMENT ON COLUMN UC_USER_GROUP.CODE_ IS
'群组代码';

COMMENT ON COLUMN UC_USER_GROUP.DESCRIPTION_ IS
'描述';

COMMENT ON COLUMN UC_USER_GROUP.USER_ID_ IS
'用户id';

COMMENT ON COLUMN UC_USER_GROUP.ORG_ID_ IS
'组织id';

COMMENT ON COLUMN UC_USER_GROUP.ROLE_ID_ IS
'角色id';

COMMENT ON COLUMN UC_USER_GROUP.POS_ID_ IS
'岗位id';

COMMENT ON COLUMN UC_USER_GROUP.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_USER_GROUP.VERSION_ IS
'版本号';

CREATE TABLE UC_USER_PARAMS 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   CODE_                NVARCHAR2(64)         DEFAULT NULL,
   VALUE_               NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_USER_PARAMS PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_USER_PARAMS IS
'用户数';

COMMENT ON COLUMN UC_USER_PARAMS.USER_ID_ IS
'用户id';

COMMENT ON COLUMN UC_USER_PARAMS.CODE_ IS
'参数代码';

COMMENT ON COLUMN UC_USER_PARAMS.VALUE_ IS
'参数值';

COMMENT ON COLUMN UC_USER_PARAMS.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_USER_PARAMS.VERSION_ IS
'版本号';

CREATE TABLE UC_ONE_TIME_CODE(
ID_               NVARCHAR2(64)   NOT NULL  PRIMARY KEY ,
CODE_             NVARCHAR2(50)   NOT NULL ,
USER_ID_          NVARCHAR2(64)   NOT NULL,
IS_USED_          NUMBER(1)       DEFAULT 0,
TENANT_ID_        NVARCHAR2(64),
CREATE_TIME_      DATE NOT NULL ,
CREATOR_          NVARCHAR2(32)   NOT NULL,
CREATE_BY_        NVARCHAR2(64)   NOT NULL,
IS_DELE_          NUMBER(1)       default 0 not null
);
comment on table UC_ONE_TIME_CODE is '双因素验证一次性码表';
comment on column UC_ONE_TIME_CODE.ID_ is '主键';
comment on column UC_ONE_TIME_CODE.CODE_ is '一次性验证码';
comment on column UC_ONE_TIME_CODE.USER_ID_ is '所属用户ID';
comment on column UC_ONE_TIME_CODE.IS_USED_ is '是否已使用;0:未使用 1:已使用';
comment on column UC_ONE_TIME_CODE.TENANT_ID_ is '租户id';
comment on column UC_ONE_TIME_CODE.CREATE_TIME_ is '创建时间';
comment on column UC_ONE_TIME_CODE.CREATOR_ is '创建人';
comment on column UC_ONE_TIME_CODE.CREATE_BY_ is '创建人ID';
comment on column UC_ONE_TIME_CODE.IS_DELE_ is '是否删除;0否 1是';

CREATE TABLE UC_USER_REL 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(255)        DEFAULT NULL,
   LEVEL_               NVARCHAR2(64)         DEFAULT NULL,
   PARENT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   TYPE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   GROUP_TYPE_          NVARCHAR2(64)         DEFAULT NULL,
   PATH_                NVARCHAR2(512)        DEFAULT NULL,
   VALUE_               NVARCHAR2(64)         DEFAULT NULL,
   STATUS_              INTEGER              DEFAULT NULL,
   ALIAS_               NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_USER_REL PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_USER_REL IS
'用户关系表';

COMMENT ON COLUMN UC_USER_REL.NAME_ IS
'名称';

COMMENT ON COLUMN UC_USER_REL.LEVEL_ IS
'级别(用于区分有多个上级的情况)';

COMMENT ON COLUMN UC_USER_REL.PARENT_ID_ IS
'父id';

COMMENT ON COLUMN UC_USER_REL.TYPE_ID_ IS
'用户关系分类下的id';

COMMENT ON COLUMN UC_USER_REL.GROUP_TYPE_ IS
'群组id';

COMMENT ON COLUMN UC_USER_REL.PATH_ IS
'组织id路径，包含层级关系';

COMMENT ON COLUMN UC_USER_REL.VALUE_ IS
'值';

COMMENT ON COLUMN UC_USER_REL.STATUS_ IS
'状态（1：正常，0：失效）';

COMMENT ON COLUMN UC_USER_REL.ALIAS_ IS
'用户组别名';

COMMENT ON COLUMN UC_USER_REL.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_USER_REL.VERSION_ IS
'版本号';

CREATE TABLE UC_USER_ROLE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   ROLE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_USER_ROLE PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_USER_ROLE IS
'用户角色管理';

COMMENT ON COLUMN UC_USER_ROLE.ROLE_ID_ IS
'角色id';

COMMENT ON COLUMN UC_USER_ROLE.USER_ID_ IS
'用户id';

COMMENT ON COLUMN UC_USER_ROLE.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_USER_ROLE.VERSION_ IS
'版本号';

CREATE TABLE UC_USER_UNDER 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   UNDER_USER_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UNDER_USER_NAME_     NVARCHAR2(64)         DEFAULT NULL,
   ORG_ID_              NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_DELE_             CHAR(1)              DEFAULT '0',
   VERSION_             INTEGER              DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   DIMEN_ID_            NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_UC_USER_UNDER PRIMARY KEY (ID_)
);

COMMENT ON TABLE UC_USER_UNDER IS
'下属管理';

COMMENT ON COLUMN UC_USER_UNDER.USER_ID_ IS
'用户id';

COMMENT ON COLUMN UC_USER_UNDER.UNDER_USER_ID_ IS
'下属用户id';

COMMENT ON COLUMN UC_USER_UNDER.UNDER_USER_NAME_ IS
'下属用户名';

COMMENT ON COLUMN UC_USER_UNDER.ORG_ID_ IS
'组织id';

COMMENT ON COLUMN UC_USER_UNDER.IS_DELE_ IS
'是否已删，1已删除，0未删除';

COMMENT ON COLUMN UC_USER_UNDER.VERSION_ IS
'版本号';

CREATE TABLE UC_USER_UNITE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   OPEN_ID_             NVARCHAR2(1000)       DEFAULT NULL,
   WX_WORK_ID_          NVARCHAR2(1000)       DEFAULT NULL,
   DINGTALK_ID_         NVARCHAR2(1000)       DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   MP_OPEN_ID_          NVARCHAR2(255)        DEFAULT NULL, 
   FLYBOOK_ID_          NVARCHAR2(100)        DEFAULT NULL, 
   CONSTRAINT PK_UC_USER_UNITE PRIMARY KEY (ID_)
);
COMMENT ON TABLE UC_USER_UNITE IS '用户与外部通讯录关系表';
COMMENT ON COLUMN UC_USER_UNITE.ID_ IS '主键';
COMMENT ON COLUMN UC_USER_UNITE.USER_ID_ IS '用户id';
COMMENT ON COLUMN UC_USER_UNITE.OPEN_ID_ IS '公众号openid';
COMMENT ON COLUMN UC_USER_UNITE.WX_WORK_ID_ IS '企业微信userid';
COMMENT ON COLUMN UC_USER_UNITE.DINGTALK_ID_ IS '阿里钉钉userid';
COMMENT ON COLUMN UC_USER_UNITE.TENANT_ID_ IS '租户id';
COMMENT ON COLUMN UC_USER_UNITE.MP_OPEN_ID_ IS '微信小程序openid';
COMMENT ON COLUMN UC_USER_UNITE.FLYBOOK_ID_ IS '飞书用户ID';


CREATE TABLE UC_MATRIX_PROC_RELATION (
  ID_ NVARCHAR2(64),
  MATRIX_CODE_ NVARCHAR2(255),
  PROC_DEF_KEY_ NVARCHAR2(64),
  PROC_DEF_NAME_ NVARCHAR2(64),
  TENANT_ID_ NVARCHAR2(64),
  PRIMARY KEY (ID_)
);
COMMENT ON COLUMN UC_MATRIX_PROC_RELATION.ID_ IS 'id';
COMMENT ON COLUMN UC_MATRIX_PROC_RELATION.MATRIX_CODE_ IS '矩阵编码';
COMMENT ON COLUMN UC_MATRIX_PROC_RELATION.PROC_DEF_KEY_ IS '流程定义KEY';
COMMENT ON COLUMN UC_MATRIX_PROC_RELATION.PROC_DEF_NAME_ IS '流程定义名称';
COMMENT ON COLUMN UC_MATRIX_PROC_RELATION.TENANT_ID_ IS '租户id';

CREATE TABLE UC_GROUP
(
    ID_            NVARCHAR2(64) not null   cONstraint UC_GROUP_PK   primary KEY,
    GROUP_NAME     NVARCHAR2(255),
    CODE_          NVARCHAR2(64),
    CREATE_BY_     NVARCHAR2(64),
    CREATOR_NAME_  NVARCHAR2(255),
    CREATE_ORG_ID_ NVARCHAR2(64),
    UPDATE_BY_     NVARCHAR2(64),
    CREATE_TIME_   DATE,
    UPDATE_TIME_   DATE,
    TENANT_ID_     NVARCHAR2(64)
);  

comment ON TABLE UC_GROUP is '群组管理';
comment ON column UC_GROUP.ID_ is '主键';
comment ON column UC_GROUP.GROUP_NAME is '群组名称';
comment ON column UC_GROUP.CODE_ is '群组编码';
comment ON column UC_GROUP.CREATE_BY_ is '创建人Id';
comment ON column UC_GROUP.CREATOR_NAME_ is '创建人名称';
comment ON column UC_GROUP.CREATE_ORG_ID_ is '创建人组织ID';
comment ON column UC_GROUP.UPDATE_BY_ is '更新人ID';
comment ON column UC_GROUP.CREATE_TIME_ is '创建时间';
comment ON column UC_GROUP.UPDATE_TIME_ is '更新时间';
comment ON column UC_GROUP.TENANT_ID_ is '租户Id';

CREATE TABLE UC_GROUP_USER
(
    ID_           NVARCHAR2(64) not null cONstraint UC_GROUP_USER_PK  primary KEY,
    GROUP_ID_     NVARCHAR2(64),
    USER_ID       NVARCHAR2(64),
    SN_           INT,
    TENANT_ID_    NVARCHAR2(64)
); 
comment ON TABLE UC_GROUP_USER is '群组和用户关系表';
comment ON column UC_GROUP_USER.ID_ is '主键';
comment ON column UC_GROUP_USER.GROUP_ID_ is '外键';
comment ON column UC_GROUP_USER.USER_ID is '用户Id';
comment ON column UC_GROUP_USER.TENANT_ID_ is '租户Id';
comment ON column UC_GROUP_USER.SN_ is '排序值';

CREATE TABLE "UC_ORG_UNITE" (
  "ID_"             NVARCHAR2(64)     NOT NULL,
  "ORG_ID_"         NVARCHAR2(64)     DEFAULT NULL,
  "WX_WORK_ID_"     NVARCHAR2(100)    DEFAULT NULL,
  "DINGTALK_ID_"    NVARCHAR2(100)    DEFAULT NULL,
  "FLYBOOK_ID_"     NVARCHAR2(100)    DEFAULT NULL,
  "DELETE_FLAG_"    NUMBER(1,0)       DEFAULT 0  NOT NULL,
  "UPDATE_TIME_"    DATE,
  "CREATE_TIME_"    DATE,
  "TENANT_ID_"      NVARCHAR2(64)     DEFAULT NULL
);
COMMENT ON COLUMN "UC_ORG_UNITE"."ID_" IS '主键';
COMMENT ON COLUMN "UC_ORG_UNITE"."ORG_ID_" IS '平台组织id';
COMMENT ON COLUMN "UC_ORG_UNITE"."WX_WORK_ID_" IS '企业微信组织id';
COMMENT ON COLUMN "UC_ORG_UNITE"."DINGTALK_ID_" IS '阿里钉钉组织id';
COMMENT ON COLUMN "UC_ORG_UNITE"."FLYBOOK_ID_" IS '飞书组织id';
COMMENT ON COLUMN "UC_ORG_UNITE"."DELETE_FLAG_" IS '是否删除';
COMMENT ON COLUMN "UC_ORG_UNITE"."UPDATE_TIME_" IS '更新时间';
COMMENT ON COLUMN "UC_ORG_UNITE"."CREATE_TIME_" IS '创建时间';
COMMENT ON COLUMN "UC_ORG_UNITE"."TENANT_ID_" IS '租户ID';
COMMENT ON TABLE "UC_ORG_UNITE" IS '组织与外部通讯录关系表';
ALTER TABLE "UC_ORG_UNITE" ADD CONSTRAINT "SYS_C00143854" PRIMARY KEY ("ID_");


CREATE TABLE UC_BATCH_SYNC (
  ID_                    NVARCHAR2(64) NOT 	NULL,
  EXECUTE_TIME_ 			 DATE,
  DATA_IDS_ 				 CLOB,
  STATUS_ 					 INT 	DEFAULT 0,
  CREATE_TIME_			    DATE,
  UPDATE_TIME_				 DATE,
  CREATE_BY_				 NVARCHAR2(64),
  CREATE_ORG_ID_			 NVARCHAR2(64),
  UPDATE_BY_ 				 NVARCHAR2(64),
  PRIMARY KEY (ID_)
);
COMMENT ON COLUMN UC_BATCH_SYNC.EXECUTE_TIME_ IS '当前时间';
COMMENT ON COLUMN UC_BATCH_SYNC.DATA_IDS_ IS '同步数据ID，json格式；调用函数名和入参。';
COMMENT ON COLUMN UC_BATCH_SYNC.STATUS_ IS '状态，0-正在同步；1-已提交；2-已回滚';
COMMENT ON TABLE UC_BATCH_SYNC IS 'UDS同步记录表';

CREATE TABLE UC_MATRIX_AUTH (
  ID_           NVARCHAR2(64)   NOT NULL,
  MATRIX_ID_    NVARCHAR2(64),
  USER_ID_      NVARCHAR2(64),
  CREATE_TIME_  DATE,
  CREATE_BY_    NVARCHAR2(64),
  UPDATE_TIME_  DATE,
  UPDATE_BY_    NVARCHAR2(64),
  ACCOUNT_      NVARCHAR2(64) DEFAULT '' NOT NULL,
  PRIMARY KEY (ID_)
);

COMMENT ON COLUMN UC_MATRIX_AUTH.MATRIX_ID_ IS '关系矩阵ID';
COMMENT ON COLUMN UC_MATRIX_AUTH.USER_ID_ IS '管理员ID';
COMMENT ON TABLE UC_MATRIX_AUTH IS '关系矩阵管理员';
COMMENT ON COLUMN UC_MATRIX_AUTH.ACCOUNT_ IS '用户账号';


CREATE UNIQUE INDEX IDX_DEM_CODE_UNQ ON UC_DEMENSION (CODE_, TENANT_ID_);
CREATE UNIQUE INDEX IDX_ORG_CODE_UNQ ON UC_ORG (CODE_,TENANT_ID_,IS_DELE_);
CREATE UNIQUE INDEX IDX_ORGAN_CODE_UNQ ON UC_ORGAN (CODE_);
CREATE UNIQUE INDEX IDX_JOB_CODE_UNQ ON UC_ORG_JOB (CODE_,TENANT_ID_,IS_DELE_);
CREATE UNIQUE INDEX IDX_POST_CODE_UNQ ON UC_ORG_POST (CODE_,TENANT_ID_,IS_DELE_);
CREATE UNIQUE INDEX IDX_PARAM_CODE ON UC_PARAMS (CODE_,TENANT_ID_,TENANT_TYPE_ID_);
CREATE UNIQUE INDEX IDX_ROLE_CODE ON UC_ROLE (CODE_,TENANT_ID_,IS_DELE_);
CREATE UNIQUE INDEX IDX_ACCOUNT_UNQ ON UC_USER (ACCOUNT_, TENANT_ID_);
CREATE UNIQUE INDEX IDX_TENANT_CODE_UNQ ON UC_TENANT_MANAGE (CODE_);
CREATE INDEX IDX_USER_ROLE_USERID ON UC_USER_ROLE (USER_ID_);
CREATE INDEX IDX_USER_ROLE_ROLEID ON UC_USER_ROLE (ROLE_ID_);
CREATE INDEX IDX_ORG_PARENTID ON UC_ORG (PARENT_ID_);
CREATE INDEX IDX_USER_UNITE_USERID ON UC_USER_UNITE (USER_ID_);
CREATE INDEX IDX_USER_UNDER_USERID ON UC_USER_UNDER (USER_ID_);
CREATE INDEX IDX_USER_REL_PARENTID ON UC_USER_REL (PARENT_ID_);
CREATE INDEX IDX_USER_PARAMS_USERID ON UC_USER_PARAMS (USER_ID_);
CREATE INDEX IDX_USER_PARAMS_CODE ON UC_USER_PARAMS (CODE_);   
CREATE UNIQUE INDEX IDX_GROUP_CODE_UNQ ON UC_USER_GROUP (CODE_,TENANT_ID_);
CREATE INDEX IDX_TENANT_TYPE_CODE ON UC_TENANT_TYPE (CODE_); 
CREATE INDEX IDX_TENANT_PARAMS_TENANTID ON UC_TENANT_PARAMS (TENANT_ID_);
CREATE INDEX IDX_TENANT_PARAMS_CODE ON UC_TENANT_PARAMS (CODE_);
CREATE INDEX IDX_TENANT_MANAGE_TYPEID ON UC_TENANT_MANAGE (TYPE_ID_);
CREATE INDEX IDX_TENANT_MAIL_TENANTID ON UC_TENANT_MAIL_SERVER (TENANT_ID_);
CREATE INDEX IDX_TENANT_LOGS_TENANTID ON UC_TENANT_LOGS (TENANT_ID_);
CREATE INDEX IDX_TENANT_IGNOREMENU_TENANTID ON UC_TENANT_IGNORE_MENU (TENANT_ID_);
CREATE INDEX IDX_TENANT_AUTH_USERID ON UC_TENANT_AUTH (USER_ID_);   
CREATE INDEX IDX_SHIFT_USER_SHIFTID ON UC_SHIFT_USER (SHIFT_ID_);
CREATE INDEX IDX_SHIFT_USER_USERID ON UC_SHIFT_USER (USER_ID_);
CREATE INDEX IDX_SHIFT_RULE_ISDELE ON UC_SHIFT_RULE (IS_DELE_);
CREATE INDEX IDX_REL_TYPE_CODE ON UC_REL_TYPE (CODE_); 
CREATE INDEX IDX_REL_AUTH_USERID ON UC_REL_AUTH (USER_ID_);
CREATE INDEX IDX_REL_AUTH_RELID ON UC_REL_AUTH (REL_ID_);
CREATE INDEX IDX_PWD_STRATEGY_TENANTID ON UC_PWD_STRATEGY (TENANT_ID_);
CREATE INDEX IDX_ORG_USER_USERID ON UC_ORG_USER (USER_ID_);
CREATE INDEX IDX_ORG_USER_ORGID ON UC_ORG_USER (ORG_ID_);
CREATE INDEX IDX_ORG_ROLE_ROLEID ON UC_ORG_ROLE (ROLE_ID_);
CREATE INDEX IDX_ORG_ROLE_ORGID ON UC_ORG_ROLE (ORG_ID_);
CREATE INDEX IDX_ORG_POST_JOBID ON UC_ORG_POST (JOB_ID_);
CREATE INDEX IDX_PRG_POST_ORGID ON UC_ORG_POST (ORG_ID_);
CREATE INDEX IDX_ORG_PARAMS_ORGID ON UC_ORG_PARAMS (ORG_ID_);  
CREATE INDEX IDX_ORG_AUTH_ORGID ON UC_ORG_AUTH (ORG_ID_);
CREATE INDEX IDX_ORG_AUTH_USERID ON UC_ORG_AUTH (USER_ID_);
CREATE INDEX IDX_ORG_AUTH_DEMID ON UC_ORG_AUTH (DEM_ID_);
CREATE INDEX IDX_OPERATE_LOG_TENANTID ON UC_OPERATE_LOG (TENANT_ID_);
CREATE INDEX IDX_OPERATE_LOG_CREATETIME ON UC_OPERATE_LOG (CREATE_TIME_);
CREATE INDEX IDX_MATRIX_COL_DEF_MATRIXID ON UC_MATRIX_COL_DEF (MATRIX_ID_);
CREATE INDEX IDX_MATRIX_COL_DEF_COLTYPE ON UC_MATRIX_COL_DEF (COL_TYPE_);
CREATE INDEX IDX_UC_MATRIX_CODE ON UC_MATRIX (CODE_);
CREATE INDEX IDX_LOGIN_LOG_ACCOUNT ON UC_LOGIN_LOG (ACCOUNT_);
CREATE INDEX IDX_ELECTRONIC_SEAL_USERID ON UC_ELECTRONIC_SEAL (USER_ID_);
CREATE INDEX IDX_MATRIX_AUTH_USERID ON UC_MATRIX_AUTH (USER_ID_);



INSERT INTO "UC_DEMENSION" VALUES ('1258608622670319616', '行政维度', 'xzwd', '1', NULL, '0', '0', NULL, NULL, '1', NULL, NULL, '1', '-1');

INSERT INTO "UC_LOGIN_LOG" VALUES ('1', '超级管理员', 'admin', '127.0.0.1', 'mobile', '3', '1', '4', NULL, TO_DATE('2022-11-04 18:17:12', 'SYYYY-MM-DD HH24:MI:SS'), TO_DATE('2022-11-04 18:33:25', 'SYYYY-MM-DD HH24:MI:SS'), NULL, NULL, NULL, '0', NULL);

INSERT INTO "UC_ORG" VALUES ('1678244051813433344', '系统默认组织', '0', '863', 'gsmc', NULL, '1258608622670319616.1678244051813433344.', '/系统默认组织', '1258608622670319616', NULL, '0', NULL, '0', NULL, '0', '1', NULL, TO_DATE('2023-07-10 11:25:36', 'SYYYY-MM-DD HH24:MI:SS'), NULL, '-1');

INSERT INTO "UC_ORG_JOB" VALUES ('1258608888039739392', '职员', 'zy', NULL, NULL, NULL, '0', NULL, '1', NULL, NULL, NULL, '-1');

INSERT INTO "UC_ORG_POST" VALUES ('1678244144050372608', '1678244051813433344', '1258608888039739392', '默认岗位', 'mrgw', '0', NULL, '0', NULL, '1', NULL, TO_DATE('2023-07-10 11:25:58', 'SYYYY-MM-DD HH24:MI:SS'), NULL, '-1', NULL);

INSERT INTO "UC_ORG_USER" VALUES ('1678244073351184384', '1678244051813433344', '1', '1', '1678244144050372608', '0', NULL, NULL, '1', TO_DATE('2023-07-10 11:26:04', 'SYYYY-MM-DD HH24:MI:SS'), '0', '2', '1', NULL, TO_DATE('2023-07-10 11:25:42', 'SYYYY-MM-DD HH24:MI:SS'), '1', '-1', '1258608622670319616');
INSERT INTO "UC_ORG_USER" VALUES ('1678244073820946432', '1678244051813433344', '-1', '1', '1678244144050372608', '0', NULL, NULL, '1', TO_DATE('2023-07-10 11:26:04', 'SYYYY-MM-DD HH24:MI:SS'), '0', '2', '1', NULL, TO_DATE('2023-07-10 11:25:42', 'SYYYY-MM-DD HH24:MI:SS'), '1', '-1', '1258608622670319616');

INSERT INTO "UC_PWD_STRATEGY" VALUES ('1', '123456', '1', '6', '7', '0', '-1');

INSERT INTO "UC_ROLE" VALUES ('61120', '系统管理员', 'xtgly', '1', NULL, NULL, '0', '1', '1', NULL, NULL, NULL, '-1');
INSERT INTO "UC_ROLE" VALUES ('1258644408874700800', '人事管理员', 'rsgly', '1', NULL, NULL, '0', NULL, '1', NULL, NULL, NULL, '-1');
INSERT INTO "UC_ROLE" VALUES ('1258644453707616256', '流程管理员', 'lcgly', '1', NULL, NULL, '0', NULL, '1', NULL, NULL, NULL, '-1');
INSERT INTO "UC_ROLE" VALUES ('1258644481708789760', '一般用户', 'ybyh', '1', NULL, NULL, '0', NULL, '1', NULL, NULL, NULL, '-1');

INSERT INTO "UC_TENANT_MANAGE" VALUES ('-1', '1', '宏天企业信息平台', 'platform', 'enable', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', NULL, '1', NULL);

INSERT INTO "UC_TENANT_TYPE" VALUES ('1', '平台租户', 'platform', 'enable', '1', '平台租户', NULL, NULL, NULL, NULL, NULL);

INSERT INTO "UC_USER" VALUES ('1', '超级管理员', 'admin', 'jZae727K08KaOmKSgOaGzww/XVqGr/PKEgIMkjrcbJI=', NULL, '18888888888', NULL, NULL, NULL, NULL, '-1', NULL, NULL, NULL, 'system', '1', '1', NULL, '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', '30', NULL, NULL, NULL, NULL);
INSERT INTO "UC_USER" VALUES ('-1', '游客账号', 'guest', 'jZae727K08KaOmKSgOaGzww/XVqGr/PKEgIMkjrcbJI=', NULL, '18888888889', NULL, NULL, NULL, NULL, '-1', NULL, NULL, NULL, 'system', '1', '1', NULL, '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', '30', NULL, NULL, NULL, NULL);
