CREATE TABLE ACT_HI_PROCINST (
    ID_ NVARCHAR2(64) NOT NULL,
    PROC_INST_ID_ NVARCHAR2(64) NOT NULL,
    BUSINESS_KEY_ NVARCHAR2(255),
    PROC_DEF_ID_ NVARCHAR2(64) NOT NULL,
    START_TIME_ TIMESTAMP(6) NOT NULL,
    END_TIME_ TIMESTAMP(6),
    DURATION_ NUMBER(19,0),
    START_USER_ID_ NVARCHAR2(255),
    START_ACT_ID_ NVARCHAR2(255),
    END_ACT_ID_ NVARCHAR2(255),
    SUPER_PROCESS_INSTANCE_ID_ NVARCHAR2(64),
    DELETE_REASON_ NVARCHAR2(2000),
    TENANT_ID_ NVARCHAR2(255) DEFAULT '',
    NAME_ NVARCHAR2(255),
    PRIMARY KEY (ID_),
    UNIQUE (PROC_INST_ID_)
);

CREATE TABLE ACT_HI_ACTINST (
    ID_ NVARCHAR2(64) NOT NULL,
    PROC_DEF_ID_ NVARCHAR2(64) NOT NULL,
    PROC_INST_ID_ NVARCHAR2(64) NOT NULL,
    EXECUTION_ID_ NVARCHAR2(64) NOT NULL,
    ACT_ID_ NVARCHAR2(255) NOT NULL,
    TASK_ID_ NVARCHAR2(64),
    CALL_PROC_INST_ID_ NVARCHAR2(64),
    ACT_NAME_ NVARCHAR2(255),
    ACT_TYPE_ NVARCHAR2(255) NOT NULL,
    ASSIGNEE_ NVARCHAR2(255),
    START_TIME_ TIMESTAMP(6) NOT NULL,
    END_TIME_ TIMESTAMP(6),
    DURATION_ NUMBER(19,0),
    TENANT_ID_ NVARCHAR2(255) DEFAULT '',
    PRIMARY KEY (ID_)
);

CREATE TABLE ACT_HI_TASKINST (
    ID_ NVARCHAR2(64) NOT NULL,
    PROC_DEF_ID_ NVARCHAR2(64),
    TASK_DEF_KEY_ NVARCHAR2(255),
    PROC_INST_ID_ NVARCHAR2(64),
    EXECUTION_ID_ NVARCHAR2(64),
    PARENT_TASK_ID_ NVARCHAR2(64),
    NAME_ NVARCHAR2(255),
    DESCRIPTION_ NVARCHAR2(2000),
    OWNER_ NVARCHAR2(255),
    ASSIGNEE_ NVARCHAR2(255),
    START_TIME_ TIMESTAMP(6) NOT NULL,
    CLAIM_TIME_ TIMESTAMP(6),
    END_TIME_ TIMESTAMP(6),
    DURATION_ NUMBER(19,0),
    DELETE_REASON_ NVARCHAR2(2000),
    PRIORITY_ INTEGER,
    DUE_DATE_ TIMESTAMP(6),
    FORM_KEY_ NVARCHAR2(255),
    CATEGORY_ NVARCHAR2(255),
    TENANT_ID_ NVARCHAR2(255) DEFAULT '',
    PRIMARY KEY (ID_)
);

CREATE TABLE ACT_HI_VARINST (
    ID_ NVARCHAR2(64) NOT NULL,
    PROC_INST_ID_ NVARCHAR2(64),
    EXECUTION_ID_ NVARCHAR2(64),
    TASK_ID_ NVARCHAR2(64),
    NAME_ NVARCHAR2(255) NOT NULL,
    VAR_TYPE_ NVARCHAR2(100),
    REV_ INTEGER,
    BYTEARRAY_ID_ NVARCHAR2(64),
    DOUBLE_ NUMBER(*,10),
    LONG_ NUMBER(19,0),
    TEXT_ NVARCHAR2(2000),
    TEXT2_ NVARCHAR2(2000),
    CREATE_TIME_ TIMESTAMP(6),
    LAST_UPDATED_TIME_ TIMESTAMP(6),
    PRIMARY KEY (ID_)
);

CREATE TABLE ACT_HI_DETAIL (
    ID_ NVARCHAR2(64) NOT NULL,
    TYPE_ NVARCHAR2(255) NOT NULL,
    PROC_INST_ID_ NVARCHAR2(64),
    EXECUTION_ID_ NVARCHAR2(64),
    TASK_ID_ NVARCHAR2(64),
    ACT_INST_ID_ NVARCHAR2(64),
    NAME_ NVARCHAR2(255) NOT NULL,
    VAR_TYPE_ NVARCHAR2(64),
    REV_ INTEGER,
    TIME_ TIMESTAMP(6) NOT NULL,
    BYTEARRAY_ID_ NVARCHAR2(64),
    DOUBLE_ NUMBER(*,10),
    LONG_ NUMBER(19,0),
    TEXT_ NVARCHAR2(2000),
    TEXT2_ NVARCHAR2(2000),
    PRIMARY KEY (ID_)
);

CREATE TABLE ACT_HI_COMMENT (
    ID_ NVARCHAR2(64) NOT NULL,
    TYPE_ NVARCHAR2(255),
    TIME_ TIMESTAMP(6) NOT NULL,
    USER_ID_ NVARCHAR2(255),
    TASK_ID_ NVARCHAR2(64),
    PROC_INST_ID_ NVARCHAR2(64),
    ACTION_ NVARCHAR2(255),
    MESSAGE_ NVARCHAR2(2000),
    FULL_MSG_ BLOB,
    PRIMARY KEY (ID_)
);

CREATE TABLE ACT_HI_ATTACHMENT (
    ID_ NVARCHAR2(64) NOT NULL,
    REV_ INTEGER,
    USER_ID_ NVARCHAR2(255),
    NAME_ NVARCHAR2(255),
    DESCRIPTION_ NVARCHAR2(2000),
    TYPE_ NVARCHAR2(255),
    TASK_ID_ NVARCHAR2(64),
    PROC_INST_ID_ NVARCHAR2(64),
    URL_ NVARCHAR2(2000),
    CONTENT_ID_ NVARCHAR2(64),
    TIME_ TIMESTAMP(6),
    PRIMARY KEY (ID_)
);

CREATE TABLE ACT_HI_IDENTITYLINK (
    ID_ NVARCHAR2(64),
    GROUP_ID_ NVARCHAR2(255),
    TYPE_ NVARCHAR2(255),
    USER_ID_ NVARCHAR2(255),
    TASK_ID_ NVARCHAR2(64),
    PROC_INST_ID_ NVARCHAR2(64),
    PRIMARY KEY (ID_)
);


CREATE TABLE ACT_GE_PROPERTY (
    NAME_ NVARCHAR2(64),
    VALUE_ NVARCHAR2(300),
    REV_ INTEGER,
    PRIMARY KEY (NAME_)
);

CREATE TABLE ACT_GE_BYTEARRAY (
    ID_ NVARCHAR2(64),
    REV_ INTEGER,
    NAME_ NVARCHAR2(255),
    DEPLOYMENT_ID_ NVARCHAR2(64),
    BYTES_ BLOB,
    GENERATED_ NUMBER(1,0) CHECK (GENERATED_ IN (1,0)),
    PRIMARY KEY (ID_)
);

CREATE TABLE ACT_RE_DEPLOYMENT (
    ID_ NVARCHAR2(64),
    NAME_ NVARCHAR2(255),
    CATEGORY_ NVARCHAR2(255),
    TENANT_ID_ NVARCHAR2(255) DEFAULT '',
    DEPLOY_TIME_ TIMESTAMP(6),
    PRIMARY KEY (ID_)
);

CREATE TABLE ACT_RE_MODEL (
    ID_ NVARCHAR2(64) NOT NULL,
    REV_ INTEGER,
    NAME_ NVARCHAR2(255),
    KEY_ NVARCHAR2(255),
    CATEGORY_ NVARCHAR2(255),
    CREATE_TIME_ TIMESTAMP(6),
    LAST_UPDATE_TIME_ TIMESTAMP(6),
    VERSION_ INTEGER,
    META_INFO_ NVARCHAR2(2000),
    DEPLOYMENT_ID_ NVARCHAR2(64),
    EDITOR_SOURCE_VALUE_ID_ NVARCHAR2(64),
    EDITOR_SOURCE_EXTRA_VALUE_ID_ NVARCHAR2(64),
    TENANT_ID_ NVARCHAR2(255) DEFAULT '',
    PRIMARY KEY (ID_)
);

CREATE TABLE ACT_RU_EXECUTION (
    ID_ NVARCHAR2(64),
    REV_ INTEGER,
    PROC_INST_ID_ NVARCHAR2(64),
    BUSINESS_KEY_ NVARCHAR2(255),
    PARENT_ID_ NVARCHAR2(64),
    PROC_DEF_ID_ NVARCHAR2(64),
    SUPER_EXEC_ NVARCHAR2(64),
    ACT_ID_ NVARCHAR2(255),
    IS_ACTIVE_ NUMBER(1,0) CHECK (IS_ACTIVE_ IN (1,0)),
    IS_CONCURRENT_ NUMBER(1,0) CHECK (IS_CONCURRENT_ IN (1,0)),
    IS_SCOPE_ NUMBER(1,0) CHECK (IS_SCOPE_ IN (1,0)),
    IS_EVENT_SCOPE_ NUMBER(1,0) CHECK (IS_EVENT_SCOPE_ IN (1,0)),
    SUSPENSION_STATE_ INTEGER,
    CACHED_ENT_STATE_ INTEGER,
    TENANT_ID_ NVARCHAR2(255) DEFAULT '',
    NAME_ NVARCHAR2(255),
    LOCK_TIME_ TIMESTAMP(6),
    PRIMARY KEY (ID_)
);

CREATE TABLE ACT_RU_JOB (
    ID_ NVARCHAR2(64) NOT NULL,
    REV_ INTEGER,
    TYPE_ NVARCHAR2(255) NOT NULL,
    LOCK_EXP_TIME_ TIMESTAMP(6),
    LOCK_OWNER_ NVARCHAR2(255),
    EXCLUSIVE_ NUMBER(1,0) CHECK (EXCLUSIVE_ IN (1,0)),
    EXECUTION_ID_ NVARCHAR2(64),
    PROCESS_INSTANCE_ID_ NVARCHAR2(64),
    PROC_DEF_ID_ NVARCHAR2(64),
    RETRIES_ INTEGER,
    EXCEPTION_STACK_ID_ NVARCHAR2(64),
    EXCEPTION_MSG_ NVARCHAR2(2000),
    DUEDATE_ TIMESTAMP(6),
    REPEAT_ NVARCHAR2(255),
    HANDLER_TYPE_ NVARCHAR2(255),
    HANDLER_CFG_ NVARCHAR2(2000),
    TENANT_ID_ NVARCHAR2(255) DEFAULT '',
    PRIMARY KEY (ID_)
);

CREATE TABLE ACT_RE_PROCDEF (
    ID_ NVARCHAR2(64) NOT NULL,
    REV_ INTEGER,
    CATEGORY_ NVARCHAR2(255),
    NAME_ NVARCHAR2(255),
    KEY_ NVARCHAR2(255) NOT NULL,
    VERSION_ INTEGER NOT NULL,
    DEPLOYMENT_ID_ NVARCHAR2(64),
    RESOURCE_NAME_ NVARCHAR2(2000),
    DGRM_RESOURCE_NAME_ NVARCHAR2(2000),
    DESCRIPTION_ NVARCHAR2(2000),
    HAS_START_FORM_KEY_ NUMBER(1,0) CHECK (HAS_START_FORM_KEY_ IN (1,0)),
    HAS_GRAPHICAL_NOTATION_ NUMBER(1,0) CHECK (HAS_GRAPHICAL_NOTATION_ IN (1,0)),
    SUSPENSION_STATE_ INTEGER,
    TENANT_ID_ NVARCHAR2(255) DEFAULT '',
    PRIMARY KEY (ID_)
);

CREATE TABLE ACT_RU_TASK (
    ID_ NVARCHAR2(64),
    REV_ INTEGER,
    EXECUTION_ID_ NVARCHAR2(64),
    PROC_INST_ID_ NVARCHAR2(64),
    PROC_DEF_ID_ NVARCHAR2(64),
    NAME_ NVARCHAR2(255),
    PARENT_TASK_ID_ NVARCHAR2(64),
    DESCRIPTION_ NVARCHAR2(2000),
    TASK_DEF_KEY_ NVARCHAR2(255),
    OWNER_ NVARCHAR2(255),
    ASSIGNEE_ NVARCHAR2(255),
    DELEGATION_ NVARCHAR2(64),
    PRIORITY_ INTEGER,
    CREATE_TIME_ TIMESTAMP(6),
    DUE_DATE_ TIMESTAMP(6),
    CATEGORY_ NVARCHAR2(255),
    SUSPENSION_STATE_ INTEGER,
    TENANT_ID_ NVARCHAR2(255) DEFAULT '',
    FORM_KEY_ NVARCHAR2(255),
    PRIMARY KEY (ID_)
);


CREATE TABLE ACT_RU_IDENTITYLINK (
    ID_ NVARCHAR2(64),
    REV_ INTEGER,
    GROUP_ID_ NVARCHAR2(255),
    TYPE_ NVARCHAR2(255),
    USER_ID_ NVARCHAR2(255),
    TASK_ID_ NVARCHAR2(64),
    PROC_INST_ID_ NVARCHAR2(64),
    PROC_DEF_ID_ NVARCHAR2(64),
    PRIMARY KEY (ID_)
);

CREATE TABLE ACT_RU_VARIABLE (
    ID_ NVARCHAR2(64) NOT NULL,
    REV_ INTEGER,
    TYPE_ NVARCHAR2(255) NOT NULL,
    NAME_ NVARCHAR2(255) NOT NULL,
    EXECUTION_ID_ NVARCHAR2(64),
    PROC_INST_ID_ NVARCHAR2(64),
    TASK_ID_ NVARCHAR2(64),
    BYTEARRAY_ID_ NVARCHAR2(64),
    DOUBLE_ NUMBER(*,10),
    LONG_ NUMBER(19,0),
    TEXT_ NVARCHAR2(2000),
    TEXT2_ NVARCHAR2(2000),
    PRIMARY KEY (ID_)
);

CREATE TABLE ACT_RU_EVENT_SUBSCR (
    ID_ NVARCHAR2(64) NOT NULL,
    REV_ INTEGER,
    EVENT_TYPE_ NVARCHAR2(255) NOT NULL,
    EVENT_NAME_ NVARCHAR2(255),
    EXECUTION_ID_ NVARCHAR2(64),
    PROC_INST_ID_ NVARCHAR2(64),
    ACTIVITY_ID_ NVARCHAR2(64),
    CONFIGURATION_ NVARCHAR2(255),
    CREATED_ TIMESTAMP(6) NOT NULL,
    PROC_DEF_ID_ NVARCHAR2(64),
    TENANT_ID_ NVARCHAR2(255) DEFAULT '',
    PRIMARY KEY (ID_)
);

CREATE TABLE ACT_EVT_LOG (
    LOG_NR_ NUMBER(19),
    TYPE_ NVARCHAR2(64),
    PROC_DEF_ID_ NVARCHAR2(64),
    PROC_INST_ID_ NVARCHAR2(64),
    EXECUTION_ID_ NVARCHAR2(64),
    TASK_ID_ NVARCHAR2(64),
    TIME_STAMP_ TIMESTAMP(6) NOT NULL,
    USER_ID_ NVARCHAR2(255),
    DATA_ BLOB,
    LOCK_OWNER_ NVARCHAR2(255),
    LOCK_TIME_ TIMESTAMP(6) NULL,
    IS_PROCESSED_ NUMBER(3) DEFAULT 0,
    PRIMARY KEY (LOG_NR_)
);


CREATE TABLE ACT_PROCDEF_INFO (
	ID_ NVARCHAR2(64) NOT NULL,
    PROC_DEF_ID_ NVARCHAR2(64) NOT NULL,
    REV_ INTEGER,
    INFO_JSON_ID_ NVARCHAR2(64),
    PRIMARY KEY (ID_)
);

CREATE TABLE BPM_AGENT_CONDITION 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   SETTING_ID_          NVARCHAR2(64)         DEFAULT NULL,
   CONDITION_DESC_      NVARCHAR2(128)        DEFAULT NULL,
   CONDITION_           NVARCHAR2(2000)       DEFAULT NULL,
   AGENT_ID_            NVARCHAR2(64)         DEFAULT NULL,
   AGENT_NAME_          NVARCHAR2(128)        DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_AGENT_CONDITION PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_AGENT_CONDITION IS
'流程代理条件';

COMMENT ON COLUMN BPM_AGENT_CONDITION.SETTING_ID_ IS
'设定ID';

COMMENT ON COLUMN BPM_AGENT_CONDITION.CONDITION_DESC_ IS
'条件描述';

COMMENT ON COLUMN BPM_AGENT_CONDITION.CONDITION_ IS
'条件';

COMMENT ON COLUMN BPM_AGENT_CONDITION.AGENT_ID_ IS
'代理人ID';

COMMENT ON COLUMN BPM_AGENT_CONDITION.AGENT_NAME_ IS
'代理人';

CREATE TABLE BPM_AGENT_DEF 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   SETTING_ID_          NVARCHAR2(64)         NOT NULL,
   FLOW_KEY_            NVARCHAR2(64)         DEFAULT NULL,
   FLOW_NAME_           NVARCHAR2(255)        DEFAULT NULL,
   NODE_ID_             NVARCHAR2(512)        DEFAULT NULL,
   NODE_NAME_           NVARCHAR2(128)        DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_AGENT_DEF PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_AGENT_DEF IS
'代理指定流程';

COMMENT ON COLUMN BPM_AGENT_DEF.SETTING_ID_ IS
'设定ID';

COMMENT ON COLUMN BPM_AGENT_DEF.FLOW_KEY_ IS
'流程定义KEY';

COMMENT ON COLUMN BPM_AGENT_DEF.FLOW_NAME_ IS
'流程定义名称';

COMMENT ON COLUMN BPM_AGENT_DEF.NODE_ID_ IS
'节点定义ID(为空的情况,如果指定ID,那么代理只在这些ID的任务生效)';

COMMENT ON COLUMN BPM_AGENT_DEF.NODE_NAME_ IS
'节点名称';

CREATE TABLE BPM_AGENT_SETTING 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   SUBJECT_             NVARCHAR2(150)        NOT NULL,
   AUTH_ID_             NVARCHAR2(64)         NOT NULL,
   AUTH_NAME_           NVARCHAR2(64)         NOT NULL,
   START_DATE_          DATE,
   END_DATE_            DATE,
   IS_ENABLED_          CHAR(1)              NOT NULL,
   AGENT_ID_            NVARCHAR2(64)         DEFAULT NULL,
   AGENT_               NVARCHAR2(128)        DEFAULT NULL,
   FLOW_KEY_            NVARCHAR2(64)         DEFAULT NULL,
   TYPE_                SMALLINT             DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_AGENT_SETTING PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_AGENT_SETTING IS
'流程代理设置';

COMMENT ON COLUMN BPM_AGENT_SETTING.SUBJECT_ IS
'标题';

COMMENT ON COLUMN BPM_AGENT_SETTING.AUTH_ID_ IS
'授权人ID';

COMMENT ON COLUMN BPM_AGENT_SETTING.AUTH_NAME_ IS
'授权人姓名';

COMMENT ON COLUMN BPM_AGENT_SETTING.IS_ENABLED_ IS
'是否有效';

COMMENT ON COLUMN BPM_AGENT_SETTING.AGENT_ID_ IS
'代理人ID';

COMMENT ON COLUMN BPM_AGENT_SETTING.AGENT_ IS
'代理人';

COMMENT ON COLUMN BPM_AGENT_SETTING.FLOW_KEY_ IS
'流程定义KEY';

COMMENT ON COLUMN BPM_AGENT_SETTING.TYPE_ IS
'代理类型(1,全权代理,2,部分代理,3.条件代理)';

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

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

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

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

CREATE TABLE BPM_APPROVAL_ITEM 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   DEF_KEY_             NVARCHAR2(128)        DEFAULT NULL,
   DEF_NAME_            CHAR(10)             DEFAULT NULL,
   TYPE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   TYPE_                SMALLINT             DEFAULT NULL,
   EXPRESSION_          NVARCHAR2(2000)       DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_APPROVAL_ITEM PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_APPROVAL_ITEM IS
'常用语管理';

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

COMMENT ON COLUMN BPM_APPROVAL_ITEM.DEF_KEY_ IS
'流程定义KEY';

COMMENT ON COLUMN BPM_APPROVAL_ITEM.DEF_NAME_ IS
'流程定义名称';

COMMENT ON COLUMN BPM_APPROVAL_ITEM.TYPE_ID_ IS
'流程分类ID';

COMMENT ON COLUMN BPM_APPROVAL_ITEM.TYPE_ IS
'常用语类型\r\n默认为1=全局\r\n2=流程分类\r\n3=流程\r\n4=个人的常用语';

COMMENT ON COLUMN BPM_APPROVAL_ITEM.EXPRESSION_ IS
'常用语        多个项用回车分开';

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

COMMENT ON COLUMN BPM_APPROVAL_ITEM.CREATE_ORG_ID_ IS
'创建人所属组织ID';

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

CREATE TABLE BPM_APPROVAL_ORG 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   APPROVAL_ID_         NVARCHAR2(64)         DEFAULT NULL,
   POST_ID_             NVARCHAR2(64)         DEFAULT NULL,
   ROLE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   DEPARTMENT_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_BY_           NVARCHAR2(255)        DEFAULT NULL,
   UPDATE_TIME_         DATE,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_APPROVAL_ORG PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_APPROVAL_ORG IS
'常用语组织';

COMMENT ON COLUMN BPM_APPROVAL_ORG.APPROVAL_ID_ IS
'常用语';

COMMENT ON COLUMN BPM_APPROVAL_ORG.POST_ID_ IS
'岗位';

COMMENT ON COLUMN BPM_APPROVAL_ORG.ROLE_ID_ IS
'角色';

COMMENT ON COLUMN BPM_APPROVAL_ORG.DEPARTMENT_ID_ IS
'部门';

CREATE TABLE BPM_BUS_LINK 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   DEF_ID_              NVARCHAR2(64)         DEFAULT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         DEFAULT NULL,
   BUSINESSKEY_         INTEGER              DEFAULT NULL,
   BUSINESSKEY_STR_     NVARCHAR2(64)         DEFAULT NULL,
   SYS_CODE_            NVARCHAR2(64)         DEFAULT NULL,
   FORM_IDENTIFY_       NVARCHAR2(64)         NOT NULL,
   START_ID_            NVARCHAR2(64)         DEFAULT NULL,
   STARTOR_             NVARCHAR2(128)        DEFAULT NULL,
   CREATE_DATE_         DATE,
   START_GROUP_ID_      NVARCHAR2(64)         DEFAULT NULL,
   START_GROUP_         NVARCHAR2(128)        DEFAULT NULL,
   IS_MAIN_             SMALLINT             DEFAULT NULL,
   BO_DEF_CODE_         NVARCHAR2(64)         DEFAULT NULL,
   SAVE_MODE_           NVARCHAR2(50)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_BUS_LINK PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_BUS_LINK IS
'流程实例与业务数据关系表，每一条记录对应业务的物理表，属于物理表的额外属性';

COMMENT ON COLUMN BPM_BUS_LINK.DEF_ID_ IS
'流程定义ID';

COMMENT ON COLUMN BPM_BUS_LINK.PROC_INST_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_BUS_LINK.BUSINESSKEY_ IS
'业务键';

COMMENT ON COLUMN BPM_BUS_LINK.BUSINESSKEY_STR_ IS
'业务键字符型';

COMMENT ON COLUMN BPM_BUS_LINK.SYS_CODE_ IS
'业务系统编码';

COMMENT ON COLUMN BPM_BUS_LINK.FORM_IDENTIFY_ IS
'表单标识';

COMMENT ON COLUMN BPM_BUS_LINK.START_ID_ IS
'发起人';

COMMENT ON COLUMN BPM_BUS_LINK.STARTOR_ IS
'发起人';

COMMENT ON COLUMN BPM_BUS_LINK.START_GROUP_ID_ IS
'发起组织ID';

COMMENT ON COLUMN BPM_BUS_LINK.START_GROUP_ IS
'发起组织';

COMMENT ON COLUMN BPM_BUS_LINK.IS_MAIN_ IS
'主记录';

COMMENT ON COLUMN BPM_BUS_LINK.BO_DEF_CODE_ IS
'bodefcode数据';

COMMENT ON COLUMN BPM_BUS_LINK.SAVE_MODE_ IS
'保存模式 (boObject,database)';

CREATE TABLE BPM_CALL_LOG 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   SUBJECT_             NVARCHAR2(600)        DEFAULT NULL,
   PROC_DEF_ID_         NVARCHAR2(64)         DEFAULT NULL,
   PROC_DEF_KEY_        NVARCHAR2(128)        DEFAULT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   SUP_INST_ID_         NVARCHAR2(64)         DEFAULT '0',
   PROC_INST_ID_        NVARCHAR2(64)         DEFAULT NULL,
   TASK_KEY_            NVARCHAR2(64)         DEFAULT NULL,
   TASK_NAME_           NVARCHAR2(255)        DEFAULT NULL,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   EVENT_TYPE_          NVARCHAR2(64)         DEFAULT NULL,
   URL_                 NVARCHAR2(255)        DEFAULT NULL,
   DESC_                NVARCHAR2(255)        DEFAULT NULL,
   INVOKE_MODE_         INTEGER              DEFAULT NULL,
   IS_SUCCESS_          SMALLINT             DEFAULT 0,
   RESPONSE_            NVARCHAR2(2000)       DEFAULT NULL,
   CALL_TIME_           DATE,
   PARAMS_              CLOB,
   HEADER_              NVARCHAR2(2000)       DEFAULT NULL,
   RETRY_COUNT_         INTEGER              DEFAULT NULL,
   ELAPSED_TIME_        NUMBER(10,3),
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_CALL_LOG PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_CALL_LOG IS 'restful接口调用日志';
COMMENT ON COLUMN BPM_CALL_LOG.SUBJECT_ IS ' 流程标题';
COMMENT ON COLUMN BPM_CALL_LOG.PROC_DEF_ID_ IS ' 流程定义ID';
COMMENT ON COLUMN BPM_CALL_LOG.PROC_DEF_KEY_ IS '流程定义KEY';
COMMENT ON COLUMN BPM_CALL_LOG.TASK_ID_ IS '任务ID';
COMMENT ON COLUMN BPM_CALL_LOG.SUP_INST_ID_ IS '父流程实例ID';
COMMENT ON COLUMN BPM_CALL_LOG.PROC_INST_ID_ IS '流程实例ID';
COMMENT ON COLUMN BPM_CALL_LOG.TASK_KEY_ IS '任务定义KEY';
COMMENT ON COLUMN BPM_CALL_LOG.TASK_NAME_ IS '任务名称';
COMMENT ON COLUMN BPM_CALL_LOG.USER_ID_ IS '调用人员ID';
COMMENT ON COLUMN BPM_CALL_LOG.EVENT_TYPE_ IS '事件类型';
COMMENT ON COLUMN BPM_CALL_LOG.URL_ IS '调用地址';
COMMENT ON COLUMN BPM_CALL_LOG.DESC_ IS '接口描述';
COMMENT ON COLUMN BPM_CALL_LOG.INVOKE_MODE_ IS '接口调用模式:0:同步，1:异步';
COMMENT ON COLUMN BPM_CALL_LOG.IS_SUCCESS_ IS '是否调用成功';
COMMENT ON COLUMN BPM_CALL_LOG.RESPONSE_ IS '调用结果';
COMMENT ON COLUMN BPM_CALL_LOG.PARAMS_ IS '请求参数';
COMMENT ON COLUMN BPM_CALL_LOG.HEADER_ IS '请求头';
COMMENT ON COLUMN BPM_CALL_LOG.RETRY_COUNT_ IS '重试次数';
COMMENT ON COLUMN BPM_CALL_LOG.ELAPSED_TIME_ is '接口耗时（单位：秒）';

CREATE TABLE BPM_CHECK_OPINION 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   PROC_DEF_ID_         NVARCHAR2(64)         NOT NULL,
   SUP_INST_ID_         NVARCHAR2(64)         DEFAULT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         NOT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   TASK_KEY_            NVARCHAR2(64)         DEFAULT NULL,
   TASK_NAME_           NVARCHAR2(255)        DEFAULT NULL,
   TOKEN_               NVARCHAR2(64)         DEFAULT NULL,
   QUALFIEDS_           CLOB                 DEFAULT NULL,
   QUALFIED_NAMES_      CLOB                 DEFAULT NULL,
   AUDITOR_             NVARCHAR2(64)         DEFAULT NULL,
   AUDITOR_NAME_        NVARCHAR2(64)         DEFAULT NULL,
   ORG_ID_              NVARCHAR2(64)         DEFAULT NULL,
   ORG_PATH_            NVARCHAR2(600)        DEFAULT NULL,
   OPINION_             NVARCHAR2(2000)       DEFAULT NULL,
   STATUS_              NVARCHAR2(40)         NOT NULL,
   FORM_DEF_ID_         NVARCHAR2(64)         DEFAULT NULL,
   FORM_NAME_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   ASSIGN_TIME_         DATE,
   COMPLETE_TIME_       DATE,
   DUR_MS_              INTEGER              DEFAULT NULL,
   FILES_               CLOB                 DEFAULT NULL,
   INTERPOSE_           SMALLINT             DEFAULT NULL,
   IS_DELE_             INTEGER              DEFAULT 0 NOT NULL,
   IS_READ_             INTEGER              DEFAULT 0 NOT NULL,
   AGENT_LEADER_ID_     NVARCHAR2(64)         DEFAULT NULL,
   PROP1_               NVARCHAR2(200)        DEFAULT NULL,
   PROP2_               NVARCHAR2(200)        DEFAULT NULL,
   PROP3_               NVARCHAR2(200)        DEFAULT NULL,
   PROP4_               NVARCHAR2(200)        DEFAULT NULL,
   PROP5_               NVARCHAR2(200)        DEFAULT NULL,
   PROP6_               CLOB,
   Z_FILES_             NVARCHAR2(1000)       DEFAULT NULL,
   FORM_DATA_           CLOB,
   PARENT_TASK_ID_      NVARCHAR2(64)         DEFAULT NULL,
   SIGN_TYPE_           NVARCHAR2(64)         DEFAULT NULL,
   SKIP_TYPE_           NVARCHAR2(64)         DEFAULT NULL,
   VARS_                CLOB,
   QUALFIEDS_ACCOUNT_   CLOB,
   AUDITOR_ACCOUNT_     NVARCHAR2(255),
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_CHECK_OPINION PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_CHECK_OPINION IS '流程审批意见';
COMMENT ON COLUMN BPM_CHECK_OPINION.PROC_DEF_ID_ IS '流程定义ID';
COMMENT ON COLUMN BPM_CHECK_OPINION.SUP_INST_ID_ IS '父流程实例ID';
COMMENT ON COLUMN BPM_CHECK_OPINION.PROC_INST_ID_ IS '流程实例ID';
COMMENT ON COLUMN BPM_CHECK_OPINION.TASK_ID_ IS '任务ID';
COMMENT ON COLUMN BPM_CHECK_OPINION.TASK_KEY_ IS '任务定义KEY';
COMMENT ON COLUMN BPM_CHECK_OPINION.TASK_NAME_ IS '任务名称';
COMMENT ON COLUMN BPM_CHECK_OPINION.TOKEN_ IS '任务令牌';
COMMENT ON COLUMN BPM_CHECK_OPINION.QUALFIEDS_ IS '有审批资格用户ID串';
COMMENT ON COLUMN BPM_CHECK_OPINION.QUALFIED_NAMES_ IS '有审批资格用户名称串';
COMMENT ON COLUMN BPM_CHECK_OPINION.AUDITOR_ IS '执行人ID';
COMMENT ON COLUMN BPM_CHECK_OPINION.AUDITOR_NAME_ IS '执行人名';
COMMENT ON COLUMN BPM_CHECK_OPINION.ORG_ID_ IS '组织ID';
COMMENT ON COLUMN BPM_CHECK_OPINION.ORG_PATH_ IS '组织全路径';
COMMENT ON COLUMN BPM_CHECK_OPINION.OPINION_ IS '审批意见';
COMMENT ON COLUMN BPM_CHECK_OPINION.STATUS_ IS '审批状态。start=发起流程；awaiting_check=待审批；agree=同意；against=反对；return=驳回；abandON=弃权；retrieve=追回';
COMMENT ON COLUMN BPM_CHECK_OPINION.FORM_DEF_ID_ IS '表单定义ID';
COMMENT ON COLUMN BPM_CHECK_OPINION.FORM_NAME_ IS '表单名';
COMMENT ON COLUMN BPM_CHECK_OPINION.FILES_ IS '附件';
COMMENT ON COLUMN BPM_CHECK_OPINION.INTERPOSE_ IS '是否干预';
COMMENT ON COLUMN BPM_CHECK_OPINION.IS_DELE_ IS '是否已删，1已删除，0未删除';
COMMENT ON COLUMN BPM_CHECK_OPINION.IS_READ_ IS '0：待阅，1：已阅';
COMMENT ON COLUMN BPM_CHECK_OPINION.AGENT_LEADER_ID_ IS '被代理的领导人id';
COMMENT ON COLUMN BPM_CHECK_OPINION.PROP1_ IS '扩展属性1';
COMMENT ON COLUMN BPM_CHECK_OPINION.PROP2_ IS '扩展属性2';
COMMENT ON COLUMN BPM_CHECK_OPINION.PROP3_ IS '扩展属性3';
COMMENT ON COLUMN BPM_CHECK_OPINION.PROP4_ IS '扩展属性4';
COMMENT ON COLUMN BPM_CHECK_OPINION.PROP5_ IS '扩展属性5';
COMMENT ON COLUMN BPM_CHECK_OPINION.PROP6_ IS '扩展属性6';
COMMENT ON COLUMN BPM_CHECK_OPINION.Z_FILES_ IS '正文附件';
COMMENT ON COLUMN BPM_CHECK_OPINION.PARENT_TASK_ID_ IS '父任务id';
COMMENT ON COLUMN BPM_CHECK_OPINION.SIGN_TYPE_ IS '任务类型';
COMMENT ON COLUMN BPM_CHECK_OPINION.SKIP_TYPE_ IS '跳过类型 启动跳过 审批跳过 执行人为空跳过 相同执行人跳过';
COMMENT ON COLUMN BPM_CHECK_OPINION.QUALFIEDS_ACCOUNT_ IS '有审批资格用户帐号串';
COMMENT ON COLUMN BPM_CHECK_OPINION.VARS_ IS '流程变量';
COMMENT ON COLUMN BPM_CHECK_OPINION.AUDITOR_ACCOUNT_ IS '实际审判人';


CREATE TABLE BPM_FLOW_MQ_LOG
(
    ID_              NVARCHAR2(64)  NOT NULL    PRIMARY KEY,
    TYPE_            NVARCHAR2(40)  NOT NULL,
    TITLE_           NVARCHAR2(300),
    CONTENT_         CLOB,
    STATUS_          INT            NOT NULL,
    TRY_TIME_        INT,
    EXCEPTION_       NVARCHAR2(2000),
    LOG_TIME_        DATE,
    TARGET_          NVARCHAR2(64),
    PROC_INST_ID_    NVARCHAR2(64),
    TASK_ID_         NVARCHAR2(64),
    OWNER_ID_        NVARCHAR2(64),
    OWNER_NAME_      NVARCHAR2(64),
    TENANT_ID_       NVARCHAR2(64),
    YEARS_PARTITION_ INT
);
COMMENT ON COLUMN BPM_FLOW_MQ_LOG.ID_ IS '主键';
COMMENT ON COLUMN BPM_FLOW_MQ_LOG.TYPE_ IS '类型';
COMMENT ON COLUMN BPM_FLOW_MQ_LOG.TITLE_ IS '标题';
COMMENT ON COLUMN BPM_FLOW_MQ_LOG.CONTENT_ IS '内容';
COMMENT ON COLUMN BPM_FLOW_MQ_LOG.STATUS_ IS '状态';
COMMENT ON COLUMN BPM_FLOW_MQ_LOG.TRY_TIME_ IS '重试次数';
COMMENT ON COLUMN BPM_FLOW_MQ_LOG.EXCEPTION_ IS '异常信息';
COMMENT ON COLUMN BPM_FLOW_MQ_LOG.LOG_TIME_ IS '日志记录时间';
COMMENT ON COLUMN BPM_FLOW_MQ_LOG.TARGET_ IS '日志目标类型';
COMMENT ON COLUMN BPM_FLOW_MQ_LOG.PROC_INST_ID_ IS '实例ID';
COMMENT ON COLUMN BPM_FLOW_MQ_LOG.TASK_ID_ IS '任务ID';
COMMENT ON COLUMN BPM_FLOW_MQ_LOG.OWNER_ID_ IS '任务所属人ID';
COMMENT ON COLUMN BPM_FLOW_MQ_LOG.OWNER_NAME_ IS '任务所属人姓名';
COMMENT ON COLUMN BPM_FLOW_MQ_LOG.TENANT_ID_ IS '租户ID';

CREATE TABLE BPM_CHECK_OPINION_HI 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   PROC_DEF_ID_         NVARCHAR2(64)         NOT NULL,
   SUP_INST_ID_         NVARCHAR2(64)         DEFAULT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         NOT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   TASK_KEY_            NVARCHAR2(64)         DEFAULT NULL,
   TASK_NAME_           NVARCHAR2(255)        DEFAULT NULL,
   TOKEN_               NVARCHAR2(64)         DEFAULT NULL,
   QUALFIEDS_           CLOB                 DEFAULT NULL,
   QUALFIED_NAMES_      CLOB                 DEFAULT NULL,
   AUDITOR_             NVARCHAR2(64)         DEFAULT NULL,
   AUDITOR_NAME_        NVARCHAR2(64)         DEFAULT NULL,
   ORG_ID_              NVARCHAR2(64)         DEFAULT NULL,
   ORG_PATH_            NVARCHAR2(600)        DEFAULT NULL,
   OPINION_             NVARCHAR2(2000)       DEFAULT NULL,
   STATUS_              NVARCHAR2(40)         NOT NULL,
   FORM_DEF_ID_         NVARCHAR2(64)         DEFAULT NULL,
   FORM_NAME_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   ASSIGN_TIME_         DATE,
   COMPLETE_TIME_       DATE,
   DUR_MS_              INTEGER              DEFAULT NULL,
   FILES_               NVARCHAR2(2000)       DEFAULT NULL,
   INTERPOSE_           SMALLINT             DEFAULT NULL,
   PROP1_               NVARCHAR2(200)        DEFAULT NULL,
   PROP2_               NVARCHAR2(200)        DEFAULT NULL,
   PROP3_               NVARCHAR2(200)        DEFAULT NULL,
   PROP4_               NVARCHAR2(200)        DEFAULT NULL,
   PROP5_               NVARCHAR2(200)        DEFAULT NULL,
   PROP6_               CLOB,
   Z_FILES_             NVARCHAR2(1000)       DEFAULT NULL,
   FORM_DATA_           CLOB,
   PARENT_TASK_ID_      NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_CHECK_OPINION_HI PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_CHECK_OPINION_HI IS
'流程审批意见历史';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.PROC_DEF_ID_ IS
'流程定义ID';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.SUP_INST_ID_ IS
'父流程实例ID';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.TASK_ID_ IS
'任务ID';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.TASK_KEY_ IS
'任务定义KEY';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.TASK_NAME_ IS
'任务名称';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.TOKEN_ IS
'任务令牌';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.QUALFIEDS_ IS
'有审批资格用户ID串';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.QUALFIED_NAMES_ IS
'有审批资格用户名称串';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.AUDITOR_ IS
'执行人ID';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.AUDITOR_NAME_ IS
'执行人名';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.ORG_ID_ IS
'组织ID';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.ORG_PATH_ IS
'组织全路径';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.OPINION_ IS
'审批意见';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.STATUS_ IS
'审批状态。start=发起流程；create=任务创建；agree=同意；against=反对；return=驳回；abandON=弃权；retrieve=追回';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.FORM_DEF_ID_ IS
'表单定义ID';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.FORM_NAME_ IS
'表单名';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.DUR_MS_ IS
'持续时间(ms)';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.PROP1_ IS
'扩展属性1';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.PROP2_ IS
'扩展属性2';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.PROP3_ IS
'扩展属性3';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.PROP4_ IS
'扩展属性4';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.PROP5_ IS
'扩展属性5';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.PROP6_ IS
'扩展属性6';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.Z_FILES_ IS
'正文附件';

COMMENT ON COLUMN BPM_CHECK_OPINION_HI.PARENT_TASK_ID_ IS
'父任务id';

CREATE TABLE BPM_COMMU_RECEIVER 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   COMMU_ID_            NVARCHAR2(64)         DEFAULT NULL,
   RECEIVER_ID_         NVARCHAR2(64)         DEFAULT NULL,
   RECEIVER             NVARCHAR2(128)        DEFAULT NULL,
   STATUS_              NVARCHAR2(20)         DEFAULT NULL,
   OPINION_             NVARCHAR2(512)        DEFAULT NULL,
   RECEIVE_TIME_        DATE,
   FEEDBACK_TIME_       DATE,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_COMMU_RECEIVER PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_COMMU_RECEIVER IS
'任务通知接收人';

COMMENT ON COLUMN BPM_COMMU_RECEIVER.COMMU_ID_ IS
'通知ID';

COMMENT ON COLUMN BPM_COMMU_RECEIVER.RECEIVER_ID_ IS
'接收人ID';

COMMENT ON COLUMN BPM_COMMU_RECEIVER.RECEIVER IS
'接收人';

COMMENT ON COLUMN BPM_COMMU_RECEIVER.STATUS_ IS
'状态';

COMMENT ON COLUMN BPM_COMMU_RECEIVER.OPINION_ IS
'反馈意见';

CREATE TABLE BPM_CPTO_RECEIVER 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   CPTO_ID_             NVARCHAR2(64)         DEFAULT NULL,
   RECEIVER_ID_         NVARCHAR2(64)         DEFAULT NULL,
   RECEIVER_            NVARCHAR2(64)         DEFAULT NULL,
   IS_READ_             SMALLINT             DEFAULT NULL,
   READ_TIME_           DATE,
   CREATE_TIME_         DATE,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_CPTO_RECEIVER PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_CPTO_RECEIVER IS
'抄送接收人';

COMMENT ON COLUMN BPM_CPTO_RECEIVER.CPTO_ID_ IS
'关联ID';

COMMENT ON COLUMN BPM_CPTO_RECEIVER.RECEIVER_ID_ IS
'接收人ID';

COMMENT ON COLUMN BPM_CPTO_RECEIVER.RECEIVER_ IS
'接收人';

COMMENT ON COLUMN BPM_CPTO_RECEIVER.IS_READ_ IS
'已读';

CREATE TABLE BPM_CUSTOM_SIGNDATA 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   TYPE_                NVARCHAR2(64)         DEFAULT NULL,
   STATUS_              NVARCHAR2(64)         DEFAULT NULL,
   PARENT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   PATH_                NVARCHAR2(2000)       DEFAULT NULL,
   INST_ID_             NVARCHAR2(64)         DEFAULT NULL,
   NODE_ID_             NVARCHAR2(128)        DEFAULT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_CUSTOM_SIGNDATA PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_CUSTOM_SIGNDATA IS
'并行签署';

COMMENT ON COLUMN BPM_CUSTOM_SIGNDATA.TYPE_ IS
'任务类型（并签，顺签，并批）';

COMMENT ON COLUMN BPM_CUSTOM_SIGNDATA.STATUS_ IS
'审批中，完成，二次并签，被撤回，撤回审批中，撤回无待办';

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

COMMENT ON COLUMN BPM_CUSTOM_SIGNDATA.PATH_ IS
'路径';

COMMENT ON COLUMN BPM_CUSTOM_SIGNDATA.INST_ID_ IS
'实例id';

COMMENT ON COLUMN BPM_CUSTOM_SIGNDATA.NODE_ID_ IS
'节点id';

COMMENT ON COLUMN BPM_CUSTOM_SIGNDATA.TASK_ID_ IS
'任务id';

CREATE TABLE BPM_DEFINITION 
(
   DEF_ID_              NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(64)         NOT NULL,
   DEF_KEY_             NVARCHAR2(64)         NOT NULL,
   DESC_                NVARCHAR2(1024)       DEFAULT NULL,
   TYPE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   STATUS_              NVARCHAR2(40)         NOT NULL,
   TEST_STATUS_         NVARCHAR2(40)         NOT NULL,
   BPMN_DEF_ID_         NVARCHAR2(64)         DEFAULT NULL,
   BPMN_DEPLOY_ID_      NVARCHAR2(64)         DEFAULT NULL,
   VERSION_             INTEGER              DEFAULT NULL,
   MAIN_DEF_ID_         NVARCHAR2(64)         DEFAULT NULL,
   IS_MAIN_             CHAR(1)              NOT NULL,
   REASON_              NVARCHAR2(1024)       DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   DESIGNER_            NVARCHAR2(20)         DEFAULT NULL,
   SUPPORT_MOBILE_      INTEGER              DEFAULT 0,
   REV_                 INTEGER              DEFAULT 1 NOT NULL,
   SHOW_URGENT_STATE_   INTEGER              DEFAULT NULL,
   IS_READ_REVOKE       NVARCHAR2(64)         DEFAULT NULL,
   URGENT_MAIL_TEL      CLOB,
   URGENT_SMS_TEL       CLOB,
   TYPE_NAME_           NVARCHAR2(64)         DEFAULT NULL,
   SHOW_MODIFY_RECORD_  INTEGER              DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   PC_START_URL_        NVARCHAR2(200)         DEFAULT NULL,
   MOBILE_START_URL_    NVARCHAR2(200)         DEFAULT NULL,
   TAGS_                NVARCHAR2(400)         DEFAULT NULL,
   DESIGN_PATTERN_      NVARCHAR2(20)         DEFAULT NULL,
   FLOW_TYPE_           INT,
   DEPLOY_DESC_         NVARCHAR2(500),
   CONSTRAINT PK_BPM_DEFINITION PRIMARY KEY (DEF_ID_)
);
COMMENT ON TABLE BPM_DEFINITION IS '流程定义';
COMMENT ON COLUMN BPM_DEFINITION.DEF_ID_ IS '流程定义ID';
COMMENT ON COLUMN BPM_DEFINITION.NAME_ IS '流程名称';
COMMENT ON COLUMN BPM_DEFINITION.DEF_KEY_ IS '流程定义KEY';
COMMENT ON COLUMN BPM_DEFINITION.DESC_ IS '流程描述';
COMMENT ON COLUMN BPM_DEFINITION.TYPE_ID_ IS '所属分类ID';
COMMENT ON COLUMN BPM_DEFINITION.STATUS_ IS '状态。草稿、发布、禁用';
COMMENT ON COLUMN BPM_DEFINITION.TEST_STATUS_ IS '测试状态';
COMMENT ON COLUMN BPM_DEFINITION.BPMN_DEF_ID_ IS 'BPMN - 流程定义ID';
COMMENT ON COLUMN BPM_DEFINITION.BPMN_DEPLOY_ID_ IS 'BPMN - 流程发布ID';
COMMENT ON COLUMN BPM_DEFINITION.VERSION_ IS '版本 - 当前版本号';
COMMENT ON COLUMN BPM_DEFINITION.MAIN_DEF_ID_ IS '版本 - 主版本流程ID';
COMMENT ON COLUMN BPM_DEFINITION.IS_MAIN_ IS '版本 - 是否主版本';
COMMENT ON COLUMN BPM_DEFINITION.REASON_ IS '版本 - 变更理由';
COMMENT ON COLUMN BPM_DEFINITION.CREATE_BY_ IS '创建人ID';
COMMENT ON COLUMN BPM_DEFINITION.CREATE_ORG_ID_ IS '创建者所属组织ID';
COMMENT ON COLUMN BPM_DEFINITION.UPDATE_BY_ IS '更新人ID';
COMMENT ON COLUMN BPM_DEFINITION.DESIGNER_ IS '设计器类型';
COMMENT ON COLUMN BPM_DEFINITION.SUPPORT_MOBILE_ IS '支持手机表单';
COMMENT ON COLUMN BPM_DEFINITION.REV_ IS '关联锁';
COMMENT ON COLUMN BPM_DEFINITION.SHOW_URGENT_STATE_ IS '是否显示紧急状态';
COMMENT ON COLUMN BPM_DEFINITION.IS_READ_REVOKE IS '传阅已阅是否允许撤回'; 
COMMENT ON COLUMN BPM_DEFINITION.URGENT_MAIL_TEL IS '人工催办内容邮件模板';
COMMENT ON COLUMN BPM_DEFINITION.URGENT_SMS_TEL IS '人工催办内容短信模板';
COMMENT ON COLUMN BPM_DEFINITION.SHOW_MODIFY_RECORD_ IS '是否显示表单留痕';
COMMENT ON COLUMN BPM_DEFINITION.PC_START_URL_ IS 'PC端启动地址';
COMMENT ON COLUMN BPM_DEFINITION.MOBILE_START_URL_ IS '手机端启动地址';
COMMENT ON COLUMN BPM_DEFINITION.TAGS_ IS '流程标签';
COMMENT ON COLUMN BPM_DEFINITION.DESIGN_PATTERN_ IS '设计模式';
COMMENT ON COLUMN BPM_DEFINITION.FLOW_TYPE_ IS '流程类型';
comment on column BPM_DEFINITION.DEPLOY_DESC_ is '发布说明';

CREATE TABLE BPM_DEF_ACT 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   AUTHORIZE_ID_        NVARCHAR2(64)         DEFAULT NULL,
   DEF_KEY_             NVARCHAR2(64)         DEFAULT NULL,
   DEF_NAME_            NVARCHAR2(128)        DEFAULT NULL,
   RIGHT_CONTENT_       NVARCHAR2(128)        DEFAULT NULL,
   TYPE_                NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_DEF_ACT PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_DEF_ACT IS
'流程授权流程定义';

COMMENT ON COLUMN BPM_DEF_ACT.AUTHORIZE_ID_ IS
'流程授权主表ID';

COMMENT ON COLUMN BPM_DEF_ACT.DEF_KEY_ IS
'授权流程KEY';

COMMENT ON COLUMN BPM_DEF_ACT.DEF_NAME_ IS
'授权流程名称';

COMMENT ON COLUMN BPM_DEF_ACT.RIGHT_CONTENT_ IS
'授权内容';

CREATE TABLE BPM_DEF_AUTHORIZE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   AUTHORIZE_DESC_      NVARCHAR2(255)        DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATOR_             NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   MULTI_PLE            NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_DEF_AUTHORIZE PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_DEF_AUTHORIZE IS
'流程授权主表';

COMMENT ON COLUMN BPM_DEF_AUTHORIZE.AUTHORIZE_DESC_ IS
'流程授权说明';

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

COMMENT ON COLUMN BPM_DEF_AUTHORIZE.CREATOR_ IS
'创建人';

CREATE TABLE BPM_DEF_AUTH_TYPE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   AUTHORIZE_ID_        NVARCHAR2(64)         DEFAULT NULL,
   AUTHORIZE_TYPE_      NVARCHAR2(20)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_DEF_AUTH_TYPE PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_DEF_AUTH_TYPE IS
'流程授权类型';

COMMENT ON COLUMN BPM_DEF_AUTH_TYPE.AUTHORIZE_ID_ IS
'流程授权主表ID';

COMMENT ON COLUMN BPM_DEF_AUTH_TYPE.AUTHORIZE_TYPE_ IS
'流程授权类型定义（management）、启动（start）、实例（instance）和任务（task）';

CREATE TABLE BPM_DEF_DATA 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   DEF_XML_             CLOB,
   BPMN_XML_            CLOB,
   DEF_JSON_            CLOB,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_DEF_DATA PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_DEF_DATA IS
'流程定义XML数据';

COMMENT ON COLUMN BPM_DEF_DATA.BPMN_XML_ IS
'流程定义XML';

CREATE TABLE BPM_DEF_USER 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   AUTHORIZE_ID_        NVARCHAR2(64)         DEFAULT NULL,
   OWNER_ID_            NVARCHAR2(64)         DEFAULT NULL,
   OWNER_NAME_          NVARCHAR2(128)        DEFAULT NULL,
   RIGHT_TYPE_          NVARCHAR2(20)         DEFAULT NULL,
   OBJ_TYPE_            NVARCHAR2(64)         DEFAULT NULL,
   AUTH_ORG_            NVARCHAR2(255)        DEFAULT NULL,
   AUTH_ORG_NAME_       NVARCHAR2(255)        DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_DEF_USER PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_DEF_USER IS
'流程授权中用户';

COMMENT ON COLUMN BPM_DEF_USER.AUTHORIZE_ID_ IS
'流程授权主表ID';

COMMENT ON COLUMN BPM_DEF_USER.OWNER_ID_ IS
'授权对象ID';

COMMENT ON COLUMN BPM_DEF_USER.OWNER_NAME_ IS
'授权对象名称';

COMMENT ON COLUMN BPM_DEF_USER.RIGHT_TYPE_ IS
'授权对象类型(角色,用户,岗位等)';

CREATE TABLE BPM_DEPUTY 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   USER_ID_             NVARCHAR2(64)         NOT NULL,
   USER_NAME_           NVARCHAR2(64)         DEFAULT NULL,
   AGENT_ID_            NVARCHAR2(64)         NOT NULL,
   AGENT_NAME_          NVARCHAR2(64)         DEFAULT NULL,
   IS_MAIL_             INTEGER              DEFAULT 1,
   IS_USABLE_           INTEGER              DEFAULT 1,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_DEPUTY PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_DEPUTY IS
'流程代理表';

COMMENT ON COLUMN BPM_DEPUTY.USER_ID_ IS
'被代理人id';

COMMENT ON COLUMN BPM_DEPUTY.USER_NAME_ IS
'被代理人姓名';

COMMENT ON COLUMN BPM_DEPUTY.AGENT_ID_ IS
'代理人id';

COMMENT ON COLUMN BPM_DEPUTY.AGENT_NAME_ IS
'代理人姓名';

COMMENT ON COLUMN BPM_DEPUTY.IS_MAIL_ IS
'是否接收邮件(1:接收，0：不接收)';

COMMENT ON COLUMN BPM_DEPUTY.IS_USABLE_ IS
'是否可用（1：启用，0：禁用）';

CREATE TABLE BPM_EXE_STACK 
(
   ID_                  NVARCHAR2(64)          NOT NULL,
   PRCO_DEF_ID_         NVARCHAR2(64)          DEFAULT NULL,
   NODE_ID_             NVARCHAR2(64)          NOT NULL,
   NODE_NAME_           NVARCHAR2(128)         DEFAULT NULL,
   START_TIME_          DATE,
   END_TIME             DATE,
   IS_MULITI_TASK_      SMALLINT               NOT NULL,
   PARENT_ID_           NVARCHAR2(64)          DEFAULT NULL,
   PROC_INST_ID_        NVARCHAR2(64)          DEFAULT NULL,
   NODE_PATH_           NVARCHAR2(1024)        DEFAULT NULL,
   DEPTH_               SMALLINT               DEFAULT NULL,
   TASK_TOKEN_          NVARCHAR2(255)         DEFAULT NULL,
   NODE_TYPE_           NVARCHAR2(255)         DEFAULT NULL,
   TARGET_NODE_         NVARCHAR2(200)         DEFAULT NULL,
   TARGET_TOKEN_        NVARCHAR2(255)         DEFAULT NULL,
   INTERPOSE_           SMALLINT               DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)          DEFAULT NULL,
   CONSTRAINT PK_BPM_EXE_STACK PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_EXE_STACK IS
'流程执行堆栈树';

COMMENT ON COLUMN BPM_EXE_STACK.PRCO_DEF_ID_ IS
'流程定义ID';

COMMENT ON COLUMN BPM_EXE_STACK.NODE_ID_ IS
'节点ID';

COMMENT ON COLUMN BPM_EXE_STACK.NODE_NAME_ IS
'节点名';

COMMENT ON COLUMN BPM_EXE_STACK.IS_MULITI_TASK_ IS
'多实例任务\r\n1=是\r\n0=否';

COMMENT ON COLUMN BPM_EXE_STACK.PARENT_ID_ IS
'父ID';

COMMENT ON COLUMN BPM_EXE_STACK.PROC_INST_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_EXE_STACK.NODE_PATH_ IS
'节点路径\r\n格式如：\r\n0.1.2.\r\n其中2则为本行记录的主键值';

COMMENT ON COLUMN BPM_EXE_STACK.DEPTH_ IS
'节点层';

COMMENT ON COLUMN BPM_EXE_STACK.TASK_TOKEN_ IS
'是针对分发任务时，携带的令牌，方便查找其父任务堆栈';

COMMENT ON COLUMN BPM_EXE_STACK.NODE_TYPE_ IS
'节点类型';

COMMENT ON COLUMN BPM_EXE_STACK.TARGET_NODE_ IS
'驳回时返回节点';

COMMENT ON COLUMN BPM_EXE_STACK.INTERPOSE_ IS
'是否干预执行';

CREATE TABLE BPM_EXE_STACK_EXECUTOR 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   STACK_ID_            NVARCHAR2(64)         DEFAULT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   ASSIGNEE_ID_         NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   END_TIME_            DATE,
   STATUS_              SMALLINT             DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   TARGET_NODE_         NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_EXE_STACK_EXECUTOR PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_EXE_STACK_EXECUTOR IS '堆栈执行人';
COMMENT ON COLUMN BPM_EXE_STACK_EXECUTOR.STACK_ID_ IS '堆栈ID';
COMMENT ON COLUMN BPM_EXE_STACK_EXECUTOR.TASK_ID_ IS '任务ID';
COMMENT ON COLUMN BPM_EXE_STACK_EXECUTOR.ASSIGNEE_ID_ IS '执行人';
COMMENT ON COLUMN BPM_EXE_STACK_EXECUTOR.STATUS_ IS '状态(0,初始,1,完成,2,取消)';
COMMENT ON COLUMN BPM_EXE_STACK_EXECUTOR.TARGET_NODE_ IS '目标节点';

CREATE TABLE BPM_EXE_STACK_HIS 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   PRCO_DEF_ID_         NVARCHAR2(64)         DEFAULT NULL,
   NODE_ID_             NVARCHAR2(64)         NOT NULL,
   NODE_NAME_           NVARCHAR2(128)        DEFAULT NULL,
   START_TIME_          DATE,
   END_TIME             DATE,
   IS_MULITI_TASK_      SMALLINT             NOT NULL,
   PARENT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         DEFAULT NULL,
   NODE_PATH_           NVARCHAR2(1024)       DEFAULT NULL,
   DEPTH_               SMALLINT             DEFAULT NULL,
   TASK_TOKEN_          NVARCHAR2(255)        DEFAULT NULL,
   NODE_TYPE_           NVARCHAR2(255)        DEFAULT NULL,
   TARGET_NODE_         NVARCHAR2(20)         DEFAULT NULL,
   TARGET_TOKEN_        NVARCHAR2(255)        DEFAULT NULL,
   INTERPOSE_           SMALLINT             DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_EXE_STACK_HIS PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_EXE_STACK_HIS IS
'流程执行堆栈树';

COMMENT ON COLUMN BPM_EXE_STACK_HIS.PRCO_DEF_ID_ IS
'流程定义ID';

COMMENT ON COLUMN BPM_EXE_STACK_HIS.NODE_ID_ IS
'节点ID';

COMMENT ON COLUMN BPM_EXE_STACK_HIS.NODE_NAME_ IS
'节点名';

COMMENT ON COLUMN BPM_EXE_STACK_HIS.IS_MULITI_TASK_ IS
'多实例任务\r\n1=是\r\n0=否';

COMMENT ON COLUMN BPM_EXE_STACK_HIS.PARENT_ID_ IS
'父ID';

COMMENT ON COLUMN BPM_EXE_STACK_HIS.PROC_INST_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_EXE_STACK_HIS.NODE_PATH_ IS
'节点路径\r\n格式如：\r\n0.1.2.\r\n其中2则为本行记录的主键值';

COMMENT ON COLUMN BPM_EXE_STACK_HIS.DEPTH_ IS
'节点层';

COMMENT ON COLUMN BPM_EXE_STACK_HIS.TASK_TOKEN_ IS
'是针对分发任务时，携带的令牌，方便查找其父任务堆栈';

COMMENT ON COLUMN BPM_EXE_STACK_HIS.NODE_TYPE_ IS
'节点类型';

COMMENT ON COLUMN BPM_EXE_STACK_HIS.TARGET_NODE_ IS
'驳回时返回节点';

COMMENT ON COLUMN BPM_EXE_STACK_HIS.INTERPOSE_ IS
'是否干预执行';

CREATE TABLE BPM_EXE_STACK_RELATION 
(
   RELATION_ID_         NVARCHAR2(64)         NOT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         NOT NULL,
   FROM_STACK_ID_       NVARCHAR2(64)         NOT NULL,
   TO_STACK_ID_         NVARCHAR2(64)         NOT NULL,
   FROM_NODE_ID_        NVARCHAR2(64)         NOT NULL,
   TO_NODE_ID_          NVARCHAR2(64)         NOT NULL,
   RELATION_STATE_      SMALLINT             DEFAULT 1 NOT NULL,
   FROM_NODE_TYPE_      NVARCHAR2(64)         NOT NULL,
   TO_NODE_TYPE_        NVARCHAR2(64)         NOT NULL,
   CREATED_TIME_        DATE,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_EXE_STACK_RELATION PRIMARY KEY (RELATION_ID_)
);

COMMENT ON TABLE BPM_EXE_STACK_RELATION IS
'堆栈关系表';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION.RELATION_ID_ IS
'关系ID';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION.PROC_INST_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION.FROM_STACK_ID_ IS
'来自堆栈ID';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION.TO_STACK_ID_ IS
'到达堆栈ID';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION.FROM_NODE_ID_ IS
'来自节点';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION.TO_NODE_ID_ IS
'到达节点';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION.RELATION_STATE_ IS
'关系状态：1正常，0回收作废';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION.FROM_NODE_TYPE_ IS
'来自的节点类型';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION.TO_NODE_TYPE_ IS
'到达的节点类型';

CREATE TABLE BPM_EXE_STACK_RELATION_HIS 
(
   RELATION_ID_         NVARCHAR2(64)         NOT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         NOT NULL,
   FROM_STACK_ID_       NVARCHAR2(64)         NOT NULL,
   TO_STACK_ID_         NVARCHAR2(64)         NOT NULL,
   FROM_NODE_ID_        NVARCHAR2(64)         NOT NULL,
   TO_NODE_ID_          NVARCHAR2(64)         NOT NULL,
   RELATION_STATE_      SMALLINT             DEFAULT 1 NOT NULL,
   FROM_NODE_TYPE_      NVARCHAR2(64)         NOT NULL,
   TO_NODE_TYPE_        NVARCHAR2(64)         NOT NULL,
   CREATED_TIME_        DATE,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_EXE_STACK_RELATION_HIS PRIMARY KEY (RELATION_ID_)
);

COMMENT ON TABLE BPM_EXE_STACK_RELATION_HIS IS
'堆栈关系历史表';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION_HIS.RELATION_ID_ IS
'关系ID';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION_HIS.PROC_INST_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION_HIS.FROM_STACK_ID_ IS
'来自堆栈ID';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION_HIS.TO_STACK_ID_ IS
'到达堆栈ID';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION_HIS.FROM_NODE_ID_ IS
'来自节点';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION_HIS.TO_NODE_ID_ IS
'到达节点';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION_HIS.RELATION_STATE_ IS
'关系状态：1正常，0回收作废';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION_HIS.FROM_NODE_TYPE_ IS
'来自的节点类型';

COMMENT ON COLUMN BPM_EXE_STACK_RELATION_HIS.TO_NODE_TYPE_ IS
'到达的节点类型';

CREATE TABLE BPM_FORM_MODIFY_RECORD 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   USER_NAME_           NVARCHAR2(128)        DEFAULT NULL,
   INST_ID_             NVARCHAR2(64)         DEFAULT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   TASK_NAME_           NVARCHAR2(128)        DEFAULT NULL,
   NODE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   MODIFY_TIME_         DATE,
   IP_                  NVARCHAR2(64)         DEFAULT NULL,
   DETAIL_              CLOB,
   REASON_              CLOB                 DEFAULT NULL,
   REF_ID_              NVARCHAR2(64)         DEFAULT NULL,
   DATA_                CLOB,
   BO_ALIAS_            NVARCHAR2(64),
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_FORM_MODIFY_RECORD PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_FORM_MODIFY_RECORD IS '表单修改记录表';
COMMENT ON COLUMN BPM_FORM_MODIFY_RECORD.BO_ALIAS_ IS 'bo别名';
COMMENT ON COLUMN bpm_form_modify_record.USER_ID_ IS '修改人id';
COMMENT ON COLUMN bpm_form_modify_record.USER_NAME_ IS '修改人姓名';
COMMENT ON COLUMN bpm_form_modify_record.INST_ID_ IS '流程实例id';
COMMENT ON COLUMN bpm_form_modify_record.TASK_ID_ IS '任务id';
COMMENT ON COLUMN bpm_form_modify_record.TASK_NAME_ IS '任务名称';
COMMENT ON COLUMN bpm_form_modify_record.NODE_ID_ IS '节点id';
COMMENT ON COLUMN bpm_form_modify_record.MODIFY_TIME_ IS '修改时间';
COMMENT ON COLUMN bpm_form_modify_record.IP_ IS '修改人ip';
COMMENT ON COLUMN bpm_form_modify_record.DETAIL_ IS '修改详情';
COMMENT ON COLUMN bpm_form_modify_record.REASON_ IS '修改原因';
COMMENT ON COLUMN bpm_form_modify_record.REF_ID_ IS '外键（表单记录主键）';
COMMENT ON COLUMN bpm_form_modify_record.DATA_ IS '表单数据';
COMMENT ON TABLE bpm_form_modify_record IS '表单修改记录表';

CREATE TABLE BPM_HR_SCRIPT 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   ALIAS_NAME_          NVARCHAR2(128)        DEFAULT NULL,
   ALIAS_DESC_          NVARCHAR2(512)        DEFAULT NULL,
   CLASS_NAME_          NVARCHAR2(128)        DEFAULT NULL,
   CLASS_INS_NAME_      NVARCHAR2(128)        DEFAULT NULL,
   METHOD_NAME_         NVARCHAR2(40)         DEFAULT NULL,
   METHOD_DESC_         NVARCHAR2(255)        DEFAULT NULL,
   RETURN_TYPE_         NVARCHAR2(40)         DEFAULT NULL,
   ARGUMENT_            NVARCHAR2(2000)       DEFAULT NULL,
   ENABLE_              SMALLINT             NOT NULL,
   TYPE_                SMALLINT             DEFAULT NULL,
   CONSTRAINT PK_BPM_HR_SCRIPT PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_HR_SCRIPT IS
'系统脚本';

COMMENT ON COLUMN BPM_HR_SCRIPT.ALIAS_NAME_ IS
'脚本的别名';

COMMENT ON COLUMN BPM_HR_SCRIPT.ALIAS_DESC_ IS
'脚本的描叙';

COMMENT ON COLUMN BPM_HR_SCRIPT.CLASS_NAME_ IS
'调用类的路径';

COMMENT ON COLUMN BPM_HR_SCRIPT.CLASS_INS_NAME_ IS
'调用类的对象名';

COMMENT ON COLUMN BPM_HR_SCRIPT.METHOD_NAME_ IS
'调用的方法名';

COMMENT ON COLUMN BPM_HR_SCRIPT.METHOD_DESC_ IS
'调用的方法的描叙';

COMMENT ON COLUMN BPM_HR_SCRIPT.RETURN_TYPE_ IS
'方法返回类型';

COMMENT ON COLUMN BPM_HR_SCRIPT.ARGUMENT_ IS
'方法相关设置';

COMMENT ON COLUMN BPM_HR_SCRIPT.ENABLE_ IS
'是否有效，有效 1，无效 0';

COMMENT ON COLUMN BPM_HR_SCRIPT.TYPE_ IS
'脚本类型，条件脚本 1，别名脚本 2，人员脚本 3';

CREATE TABLE BPM_INST_FORM 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   DEF_ID_              NVARCHAR2(64)         DEFAULT NULL,
   INST_ID_             NVARCHAR2(64)         DEFAULT NULL,
   FORM_VALUE_          NVARCHAR2(255)        DEFAULT NULL,
   NODE_ID_             NVARCHAR2(255)        DEFAULT NULL,
   FORM_TYPE_           NVARCHAR2(64)         DEFAULT NULL,
   FORM_CATEGORY_       NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_INST_FORM PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_INST_FORM IS
'记录流程启动时，节点使用的表单';

COMMENT ON COLUMN BPM_INST_FORM.DEF_ID_ IS
'流程定义id';

COMMENT ON COLUMN BPM_INST_FORM.INST_ID_ IS
'流程实例id';

COMMENT ON COLUMN BPM_INST_FORM.FORM_VALUE_ IS
'表单 inner 记录id  frame 记录formValue';

COMMENT ON COLUMN BPM_INST_FORM.NODE_ID_ IS
'节点id';

COMMENT ON COLUMN BPM_INST_FORM.FORM_TYPE_ IS
'表单类型 pc mobile';

COMMENT ON COLUMN BPM_INST_FORM.FORM_CATEGORY_ IS
'url表单 frame  在线表单 inner';

CREATE TABLE BPM_INTERPOSE_RECORED 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   PROC_DEF_ID_         NVARCHAR2(64)         DEFAULT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         NOT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   TASK_NAME_           NVARCHAR2(255)        DEFAULT NULL,
   AUDITOR_             NVARCHAR2(64)         DEFAULT NULL,
   AUDITOR_NAME_        NVARCHAR2(64)         DEFAULT NULL,
   OPINION_             NVARCHAR2(2000)       DEFAULT NULL,
   STATUS_              NVARCHAR2(40)         NOT NULL,
   CREATE_TIME_         DATE,
   COMPLETE_TIME_       DATE,
   DUR_MS_              INTEGER              DEFAULT NULL,
   FILES_               NVARCHAR2(2000)       DEFAULT NULL,
   IS_DONE_             NVARCHAR2(2000)       DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_INTERPOSE_RECORED PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_INTERPOSE_RECORED IS
'流程干预记录表';

COMMENT ON COLUMN BPM_INTERPOSE_RECORED.PROC_DEF_ID_ IS
'流程定义ID';

COMMENT ON COLUMN BPM_INTERPOSE_RECORED.PROC_INST_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_INTERPOSE_RECORED.TASK_ID_ IS
'任务ID';

COMMENT ON COLUMN BPM_INTERPOSE_RECORED.TASK_NAME_ IS
'任务名称';

COMMENT ON COLUMN BPM_INTERPOSE_RECORED.AUDITOR_ IS
'执行人ID';

COMMENT ON COLUMN BPM_INTERPOSE_RECORED.AUDITOR_NAME_ IS
'执行人名';

COMMENT ON COLUMN BPM_INTERPOSE_RECORED.STATUS_ IS
'干预动作';

COMMENT ON COLUMN BPM_INTERPOSE_RECORED.DUR_MS_ IS
'持续时间(ms)';

CREATE TABLE BPM_MEETINGROOM 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(100)        DEFAULT NULL,
   NEED_PENDING_        SMALLINT             DEFAULT NULL,
   PENDING_USER_ID_     NVARCHAR2(64)         DEFAULT NULL,
   PENDING_USER_NAME_   NVARCHAR2(100)        DEFAULT NULL,
   SUPPORT_SERVICE_     NVARCHAR2(500)        DEFAULT NULL,
   LOCATION_            NVARCHAR2(300)        DEFAULT NULL,
   CAPACITY_            INTEGER              DEFAULT NULL,
   MEMO_                NVARCHAR2(600)        DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_MEETINGROOM PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_MEETINGROOM IS
'会议室';

COMMENT ON COLUMN BPM_MEETINGROOM.NAME_ IS
'会议室名称';

COMMENT ON COLUMN BPM_MEETINGROOM.NEED_PENDING_ IS
'是否需要审批';

COMMENT ON COLUMN BPM_MEETINGROOM.PENDING_USER_ID_ IS
'审批人ID';

COMMENT ON COLUMN BPM_MEETINGROOM.PENDING_USER_NAME_ IS
'审批人';

COMMENT ON COLUMN BPM_MEETINGROOM.SUPPORT_SERVICE_ IS
'支持的服务';

COMMENT ON COLUMN BPM_MEETINGROOM.LOCATION_ IS
'会议室地址';

COMMENT ON COLUMN BPM_MEETINGROOM.CAPACITY_ IS
'会议室容量';

COMMENT ON COLUMN BPM_MEETINGROOM.MEMO_ IS
'会议室备注';

CREATE TABLE BPM_MEETINGROOM_APPOINTMENT 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   MEETINGROOM_ID_      NVARCHAR2(64)         DEFAULT NULL,
   MEETING_ID_          NVARCHAR2(64)         DEFAULT NULL,
   MEETING_NAME_        NVARCHAR2(64)         DEFAULT NULL,
   HOSTESS_NAME_        NVARCHAR2(64)         DEFAULT NULL,
   APPOINTMENT_BEG_TIME_ DATE,
   APPOINTMENT_END_TIME_ DATE,
   APPOINTMENT_STATUS_  INTEGER              DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_MEETINGROOM_APPOINTMENT PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_MEETINGROOM_APPOINTMENT IS
'会议室预约';

COMMENT ON COLUMN BPM_MEETINGROOM_APPOINTMENT.MEETING_ID_ IS
'会议id';

COMMENT ON COLUMN BPM_MEETINGROOM_APPOINTMENT.MEETING_NAME_ IS
'会议名称';

COMMENT ON COLUMN BPM_MEETINGROOM_APPOINTMENT.HOSTESS_NAME_ IS
'主持人姓名';

COMMENT ON COLUMN BPM_MEETINGROOM_APPOINTMENT.APPOINTMENT_STATUS_ IS
'预约状态';

CREATE TABLE BPM_MESSAGE_TYPE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   CLASSIFICATION_CODE_ NVARCHAR2(100)        DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_PENDING_          SMALLINT             DEFAULT NULL,
   PENDING_USER_ID_     NVARCHAR2(100)        DEFAULT NULL,
   PENDING_USER_NAME_   NVARCHAR2(200)        DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_MESSAGE_TYPE PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_MESSAGE_TYPE IS
'分类管理';

COMMENT ON COLUMN BPM_MESSAGE_TYPE.CLASSIFICATION_CODE_ IS
'分类名称';

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

COMMENT ON COLUMN BPM_MESSAGE_TYPE.IS_PENDING_ IS
'是否需要审批';

COMMENT ON COLUMN BPM_MESSAGE_TYPE.PENDING_USER_ID_ IS
'审批人id';

COMMENT ON COLUMN BPM_MESSAGE_TYPE.PENDING_USER_NAME_ IS
'审批人姓名';

CREATE TABLE BPM_MULTI_SCRIPT 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   ALIAS_NAME_          NVARCHAR2(128)        DEFAULT NULL,
   ALIAS_DESC_          NVARCHAR2(512)        DEFAULT NULL,
   CLASS_NAME_          NVARCHAR2(128)        DEFAULT NULL,
   CLASS_INS_NAME_      NVARCHAR2(128)        DEFAULT NULL,
   METHOD_NAME_         NVARCHAR2(40)         DEFAULT NULL,
   METHOD_DESC_         NVARCHAR2(2000)       DEFAULT NULL,
   RETURN_TYPE_         NVARCHAR2(40)         DEFAULT NULL,
   ARGUMENT_            NVARCHAR2(2000)       DEFAULT NULL,
   ENABLE_              SMALLINT             NOT NULL,
   TYPE_                SMALLINT             DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_MULTI_SCRIPT PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_MULTI_SCRIPT IS
'系统脚本';

COMMENT ON COLUMN BPM_MULTI_SCRIPT.ALIAS_NAME_ IS
'脚本的别名';

COMMENT ON COLUMN BPM_MULTI_SCRIPT.ALIAS_DESC_ IS
'脚本的描叙';

COMMENT ON COLUMN BPM_MULTI_SCRIPT.CLASS_NAME_ IS
'调用类的路径';

COMMENT ON COLUMN BPM_MULTI_SCRIPT.CLASS_INS_NAME_ IS
'调用类的对象名';

COMMENT ON COLUMN BPM_MULTI_SCRIPT.METHOD_NAME_ IS
'调用的方法名';

COMMENT ON COLUMN BPM_MULTI_SCRIPT.METHOD_DESC_ IS
'调用的方法的描叙';

COMMENT ON COLUMN BPM_MULTI_SCRIPT.RETURN_TYPE_ IS
'方法返回类型';

COMMENT ON COLUMN BPM_MULTI_SCRIPT.ARGUMENT_ IS
'方法相关设置';

COMMENT ON COLUMN BPM_MULTI_SCRIPT.ENABLE_ IS
'是否有效，有效 1，无效 0';

COMMENT ON COLUMN BPM_MULTI_SCRIPT.TYPE_ IS
'脚本类型，条件脚本 1，别名脚本 2，人员脚本 3';

CREATE TABLE BPM_OFTEN_FLOW 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   DEF_KEY_             NVARCHAR2(64)         NOT NULL,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   USER_NAME_           NVARCHAR2(128)        DEFAULT NULL,
   ORDER_               SMALLINT             DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_OFTEN_FLOW PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_OFTEN_FLOW IS
'通用流程';

COMMENT ON COLUMN BPM_OFTEN_FLOW.DEF_KEY_ IS
'流程定义KEY';

COMMENT ON COLUMN BPM_OFTEN_FLOW.USER_ID_ IS
'所属人id。-1为所有人都有权限';

COMMENT ON COLUMN BPM_OFTEN_FLOW.ORDER_ IS
'排序号';

CREATE TABLE BPM_OFTEN_FLOW_USER 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   OFTEN_FLOW_ID_       NVARCHAR2(64)         DEFAULT NULL,
   OWNER_ID_            NVARCHAR2(64)         DEFAULT NULL,
   OWNER_NAME_          NVARCHAR2(128)        DEFAULT NULL,
   RIGHT_TYPE_          NVARCHAR2(20)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_OFTEN_FLOW_USER PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_OFTEN_FLOW_USER IS
'常用流程授权对象表';

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

COMMENT ON COLUMN BPM_OFTEN_FLOW_USER.OFTEN_FLOW_ID_ IS
'常用流程表主键ID';

COMMENT ON COLUMN BPM_OFTEN_FLOW_USER.OWNER_ID_ IS
'授权对象ID';

COMMENT ON COLUMN BPM_OFTEN_FLOW_USER.OWNER_NAME_ IS
'授权对象名称';

COMMENT ON COLUMN BPM_OFTEN_FLOW_USER.RIGHT_TYPE_ IS
'授权对象类型(角色,用户,岗位等)';

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

CREATE TABLE BPM_PRINT_RECORD 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   PROC_DEF_KEY_        NVARCHAR2(64)         DEFAULT NULL,
   PROC_DEF_NAME_       NVARCHAR2(64)         DEFAULT NULL,
   PROC_DEF_ID_         NVARCHAR2(64)         DEFAULT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         DEFAULT NULL,
   NODE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   FORM_KEY_            NVARCHAR2(64)         DEFAULT NULL,
   TEMPLATE_ID_         NVARCHAR2(64)         DEFAULT NULL,
   TEMPLATE_NAME_       NVARCHAR2(64)         DEFAULT NULL,
   FILE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   LAST_VERSION_        INTEGER              DEFAULT 0,
   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,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_PRINT_RECORD PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_PRINT_RECORD IS
'流程打印文件管理表';

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

COMMENT ON COLUMN BPM_PRINT_RECORD.PROC_DEF_KEY_ IS
'流程定义KEY';

COMMENT ON COLUMN BPM_PRINT_RECORD.PROC_DEF_NAME_ IS
'流程定义名称';

COMMENT ON COLUMN BPM_PRINT_RECORD.PROC_DEF_ID_ IS
'流程定义ID';

COMMENT ON COLUMN BPM_PRINT_RECORD.PROC_INST_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_PRINT_RECORD.NODE_ID_ IS
'流程节点ID';

COMMENT ON COLUMN BPM_PRINT_RECORD.FORM_KEY_ IS
'表单KEY';

COMMENT ON COLUMN BPM_PRINT_RECORD.TEMPLATE_ID_ IS
'打印模板ID';

COMMENT ON COLUMN BPM_PRINT_RECORD.TEMPLATE_NAME_ IS
'打印模板名称';

COMMENT ON COLUMN BPM_PRINT_RECORD.FILE_ID_ IS
'打印文件id';

COMMENT ON COLUMN BPM_PRINT_RECORD.LAST_VERSION_ IS
'是否最后的版本（1：是，0：否）';

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

CREATE TABLE BPM_PRO_BO 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   PROCESS_ID_          NVARCHAR2(64)         DEFAULT NULL,
   PROCESS_KEY_         NVARCHAR2(128)        DEFAULT NULL,
   BO_CODE_             NVARCHAR2(128)        DEFAULT NULL,
   BO_NAME_             NVARCHAR2(128)        DEFAULT NULL,
   CREATOR_ID_          NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_PRO_BO PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_PRO_BO IS
'流程业务对象设置表';

COMMENT ON COLUMN BPM_PRO_BO.PROCESS_ID_ IS
'流程ID';

COMMENT ON COLUMN BPM_PRO_BO.PROCESS_KEY_ IS
'流程KEY';

COMMENT ON COLUMN BPM_PRO_BO.BO_CODE_ IS
'业务对象CODE';

COMMENT ON COLUMN BPM_PRO_BO.BO_NAME_ IS
'业务对象名称';

COMMENT ON COLUMN BPM_PRO_BO.CREATOR_ID_ IS
'创建人';

CREATE TABLE BPM_PRO_CPTO 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   INST_ID_             NVARCHAR2(64)         DEFAULT NULL,
   BPMN_INST_ID_        NVARCHAR2(64)         DEFAULT NULL,
   NODE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   OPINION_             NVARCHAR2(1500)       DEFAULT NULL,
   SUBJECT_             NVARCHAR2(128)        DEFAULT NULL,
   TYPE_                NVARCHAR2(20)         DEFAULT NULL,
   STARTOR_ID_          NVARCHAR2(64)         DEFAULT NULL,
   TYPE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   STARTOR_             NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_PRO_CPTO PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_PRO_CPTO IS
'流程实例抄送';

COMMENT ON COLUMN BPM_PRO_CPTO.INST_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_PRO_CPTO.BPMN_INST_ID_ IS
'ACT实例ID';

COMMENT ON COLUMN BPM_PRO_CPTO.NODE_ID_ IS
'节点ID';

COMMENT ON COLUMN BPM_PRO_CPTO.OPINION_ IS
'意见';

COMMENT ON COLUMN BPM_PRO_CPTO.SUBJECT_ IS
'流程实例标题';

COMMENT ON COLUMN BPM_PRO_CPTO.TYPE_ IS
'抄送类型(copyto抄送,trans转发)';

COMMENT ON COLUMN BPM_PRO_CPTO.STARTOR_ID_ IS
'流程发起人';

COMMENT ON COLUMN BPM_PRO_CPTO.TYPE_ID_ IS
'流程分类';

COMMENT ON COLUMN BPM_PRO_CPTO.STARTOR_ IS
'创建人';

CREATE TABLE BPM_PRO_INST 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   SUBJECT_             NVARCHAR2(256)        NOT NULL,
   PROC_DEF_ID_         NVARCHAR2(64)         NOT NULL,
   BPMN_DEF_ID_         NVARCHAR2(64)         DEFAULT NULL,
   PROC_DEF_KEY_        NVARCHAR2(128)        DEFAULT NULL,
   PROC_DEF_NAME_       NVARCHAR2(128)        NOT NULL,
   BIZ_KEY_             NVARCHAR2(64)         DEFAULT NULL,
   SYS_CODE_            NVARCHAR2(64)         DEFAULT NULL,
   FORM_KEY_            NVARCHAR2(64)         DEFAULT NULL,
   STATUS_              NVARCHAR2(40)         DEFAULT NULL,
   END_TIME_            DATE,
   DURATION_            INTEGER              DEFAULT NULL,
   TYPE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   RESULT_TYPE_         NVARCHAR2(40)         DEFAULT NULL,
   BPMN_INST_ID_        NVARCHAR2(64)         DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_FORMMAL_          CHAR(1)              NOT NULL,
   PARENT_INST_ID_      NVARCHAR2(64)         DEFAULT NULL,
   IS_FORBIDDEN_        SMALLINT             DEFAULT NULL,
   DATA_MODE_           NVARCHAR2(20)         DEFAULT NULL,
   CREATOR_             NVARCHAR2(64)         DEFAULT NULL,
   SUPPORT_MOBILE_      INTEGER              DEFAULT 0,
   SUPER_NODE_ID_       NVARCHAR2(64)         DEFAULT NULL,
   IS_DELE_             INTEGER              DEFAULT 0 NOT NULL,
   URGENT_STATE_        NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_PATH_     CLOB,
   MOBILE_INST_URL_     NVARCHAR2(200)         DEFAULT NULL,
   CREATE_ACCOUNT_      NVARCHAR2(64)         DEFAULT NULL,
   PC_INST_URL_         NVARCHAR2(200)         DEFAULT NULL,
   CONSTRAINT PK_BPM_PRO_INST PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_PRO_INST IS '流程实例';
COMMENT ON COLUMN BPM_PRO_INST.SUBJECT_ IS '流程实例标题';
COMMENT ON COLUMN BPM_PRO_INST.PROC_DEF_ID_ IS '流程定义ID';
COMMENT ON COLUMN BPM_PRO_INST.BPMN_DEF_ID_ IS 'BPMN流程定义ID';
COMMENT ON COLUMN BPM_PRO_INST.PROC_DEF_KEY_ IS '流程定义KEY';
COMMENT ON COLUMN BPM_PRO_INST.PROC_DEF_NAME_ IS '流程名称';
COMMENT ON COLUMN BPM_PRO_INST.BIZ_KEY_ IS '业务主键';
COMMENT ON COLUMN BPM_PRO_INST.SYS_CODE_ IS '业务系统编码';
COMMENT ON COLUMN BPM_PRO_INST.FORM_KEY_ IS '绑定的表单主键';
COMMENT ON COLUMN BPM_PRO_INST.STATUS_ IS '实例状态';
COMMENT ON COLUMN BPM_PRO_INST.DURATION_ IS '持续时间(ms)';
COMMENT ON COLUMN BPM_PRO_INST.TYPE_ID_ IS '所属分类ID';
COMMENT ON COLUMN BPM_PRO_INST.RESULT_TYPE_ IS '流程结束后的最终审批结果，agree=同意；refuse=拒绝';
COMMENT ON COLUMN BPM_PRO_INST.BPMN_INST_ID_ IS 'BPMN流程实例ID';
COMMENT ON COLUMN BPM_PRO_INST.CREATE_BY_ IS '创建人ID';
COMMENT ON COLUMN BPM_PRO_INST.CREATE_ORG_ID_ IS '创建者所属组织ID';
COMMENT ON COLUMN BPM_PRO_INST.UPDATE_BY_ IS '更新人ID';
COMMENT ON COLUMN BPM_PRO_INST.IS_FORMMAL_ IS '是否正式数据';
COMMENT ON COLUMN BPM_PRO_INST.PARENT_INST_ID_ IS '父实例Id';
COMMENT ON COLUMN BPM_PRO_INST.IS_FORBIDDEN_ IS '禁止';
COMMENT ON COLUMN BPM_PRO_INST.DATA_MODE_ IS '业务数据存储模式。\r\npk:主键\r\nbo:业务对象';
COMMENT ON COLUMN BPM_PRO_INST.CREATOR_ IS '创建人';
COMMENT ON COLUMN BPM_PRO_INST.SUPPORT_MOBILE_ IS '支持手机端';
COMMENT ON COLUMN BPM_PRO_INST.SUPER_NODE_ID_ IS '子流程节点的ID';
COMMENT ON COLUMN BPM_PRO_INST.IS_DELE_ IS '是否已删，1已删除，0未删除';
COMMENT ON COLUMN BPM_PRO_INST.URGENT_STATE_ IS '紧急状态';
COMMENT ON COLUMN BPM_PRO_INST.MOBILE_INST_URL_ IS '手机端实例地址';
COMMENT ON COLUMN BPM_PRO_INST.CREATE_ACCOUNT_ IS '流程发起人账号';
COMMENT ON COLUMN BPM_PRO_INST.PC_INST_URL_ IS 'PC实例地址';

CREATE TABLE BPM_PRO_INST_HI 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   SUBJECT_             NVARCHAR2(128)        NOT NULL,
   PROC_DEF_ID_         NVARCHAR2(64)         NOT NULL,
   BPMN_DEF_ID_         NVARCHAR2(64)         DEFAULT NULL,
   PROC_DEF_KEY_        NVARCHAR2(128)        DEFAULT NULL,
   PROC_DEF_NAME_       NVARCHAR2(128)        NOT NULL,
   BIZ_KEY_             NVARCHAR2(64)         DEFAULT NULL,
   SYS_CODE_            NVARCHAR2(64)         DEFAULT NULL,
   FORM_KEY_            NVARCHAR2(64)         DEFAULT NULL,
   STATUS_              NVARCHAR2(40)         DEFAULT NULL,
   END_TIME_            DATE,
   DURATION_            INTEGER              DEFAULT NULL,
   TYPE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   RESULT_TYPE_         NVARCHAR2(40)         DEFAULT NULL,
   BPMN_INST_ID_        NVARCHAR2(64)         NOT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   IS_FORMMAL_          CHAR(1)              NOT NULL,
   PARENT_INST_ID_      NVARCHAR2(64)         DEFAULT NULL,
   IS_FORBIDDEN_        SMALLINT             DEFAULT NULL,
   DATA_MODE_           NVARCHAR2(20)         DEFAULT NULL,
   CREATOR_             NVARCHAR2(64)         DEFAULT NULL,
   SUPPORT_MOBILE_      INTEGER              DEFAULT 0,
   SUPER_NODE_ID_       NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   PC_INST_URL_         NVARCHAR2(200)         DEFAULT NULL,
   MOBILE_INST_URL_     NVARCHAR2(200)         DEFAULT NULL,
   CONSTRAINT PK_BPM_PRO_INST_HI PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_PRO_INST_HI IS '流程实例历史';
COMMENT ON COLUMN BPM_PRO_INST_HI.SUBJECT_ IS '流程实例标题';
COMMENT ON COLUMN BPM_PRO_INST_HI.PROC_DEF_ID_ IS '流程定义ID';
COMMENT ON COLUMN BPM_PRO_INST_HI.BPMN_DEF_ID_ IS 'BPMN流程定义ID';
COMMENT ON COLUMN BPM_PRO_INST_HI.PROC_DEF_KEY_ IS '流程定义KEY';
COMMENT ON COLUMN BPM_PRO_INST_HI.PROC_DEF_NAME_ IS '流程名称';
COMMENT ON COLUMN BPM_PRO_INST_HI.BIZ_KEY_ IS '关联数据业务主键';
COMMENT ON COLUMN BPM_PRO_INST_HI.SYS_CODE_ IS '业务系统编码';
COMMENT ON COLUMN BPM_PRO_INST_HI.FORM_KEY_ IS '绑定的表单主键';
COMMENT ON COLUMN BPM_PRO_INST_HI.STATUS_ IS '实例状态';
COMMENT ON COLUMN BPM_PRO_INST_HI.DURATION_ IS '持续时间';
COMMENT ON COLUMN BPM_PRO_INST_HI.TYPE_ID_ IS '所属分类ID';
COMMENT ON COLUMN BPM_PRO_INST_HI.RESULT_TYPE_ IS '流程结束后的最终审批结果，agree=同意；refuse=拒绝';
COMMENT ON COLUMN BPM_PRO_INST_HI.BPMN_INST_ID_ IS 'BPMN流程实例ID';
COMMENT ON COLUMN BPM_PRO_INST_HI.CREATE_BY_ IS '创建人ID';
COMMENT ON COLUMN BPM_PRO_INST_HI.CREATE_ORG_ID_ IS '创建者所属组织ID';
COMMENT ON COLUMN BPM_PRO_INST_HI.UPDATE_BY_ IS '更新人ID';
COMMENT ON COLUMN BPM_PRO_INST_HI.IS_FORMMAL_ IS '是否正式数据 0非正式,1正式';
COMMENT ON COLUMN BPM_PRO_INST_HI.PARENT_INST_ID_ IS '父实例Id';
COMMENT ON COLUMN BPM_PRO_INST_HI.CREATOR_ IS '创建人';
COMMENT ON COLUMN BPM_PRO_INST_HI.SUPPORT_MOBILE_ IS '支持手机端';
COMMENT ON COLUMN BPM_PRO_INST_HI.SUPER_NODE_ID_ IS '子流程节点ID';
COMMENT ON COLUMN BPM_PRO_INST_HI.PC_INST_URL_ IS 'PC实例地址';
COMMENT ON COLUMN BPM_PRO_INST_HI.MOBILE_INST_URL_ IS '手机端实例地址';

CREATE TABLE BPM_PRO_INST_STATUS 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   KEY_                 NVARCHAR2(255)        DEFAULT NULL,
   VALUE_               NVARCHAR2(255)        DEFAULT NULL,
   CONSTRAINT PK_BPM_PRO_INST_STATUS PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_PRO_INST_STATUS IS
'流程实例状态排序表';

COMMENT ON COLUMN BPM_PRO_INST_STATUS.KEY_ IS
'流程实例状态';

COMMENT ON COLUMN BPM_PRO_INST_STATUS.VALUE_ IS
'流程实例状态对应的排序号';

CREATE TABLE BPM_PRO_STATUS 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         NOT NULL,
   PROC_DEF_ID_         NVARCHAR2(64)         NOT NULL,
   NODE_ID_             NVARCHAR2(255)        NOT NULL,
   NODE_NAME_           NVARCHAR2(255)        DEFAULT NULL,
   STATUS_              NVARCHAR2(50)         NOT NULL,
   LAST_UPDATE_         DATE,
   LAST_USERID_         NVARCHAR2(64)         DEFAULT NULL,
   RECYCLE_NODE_        NVARCHAR2(2)          DEFAULT 0,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_PRO_STATUS PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_PRO_STATUS IS '流程节点审批状态';
COMMENT ON COLUMN BPM_PRO_STATUS.PROC_INST_ID_ IS '流程实例ID';
COMMENT ON COLUMN BPM_PRO_STATUS.PROC_DEF_ID_ IS 'ACT流程定义ID';
COMMENT ON COLUMN BPM_PRO_STATUS.NODE_ID_ IS '节点ID';
COMMENT ON COLUMN BPM_PRO_STATUS.NODE_NAME_ IS '节点名称';
COMMENT ON COLUMN BPM_PRO_STATUS.STATUS_ IS '状态';
COMMENT ON COLUMN BPM_PRO_STATUS.LAST_USERID_ IS '最后更新人';
COMMENT ON COLUMN BPM_PRO_STATUS.RECYCLE_NODE_ IS '驳回按流程图执行回收的节点 0默认值  1因为驳回按照流程图执行目标节点之后的节点为1，如果重新运行到该节点变为0';

CREATE TABLE BPM_PRO_STATUS_HI 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         NOT NULL,
   PROC_DEF_ID_         NVARCHAR2(64)         NOT NULL,
   NODE_ID_             NVARCHAR2(255)        NOT NULL,
   NODE_NAME_           NVARCHAR2(255)        DEFAULT NULL,
   STATUS_              NVARCHAR2(50)         NOT NULL,
   LAST_UPDATE_         DATE,
   LAST_USERID_         NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_PRO_STATUS_HI PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_PRO_STATUS_HI IS
'流程节点审批历史状态';

COMMENT ON COLUMN BPM_PRO_STATUS_HI.PROC_INST_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_PRO_STATUS_HI.PROC_DEF_ID_ IS
'ACT流程定义ID';

COMMENT ON COLUMN BPM_PRO_STATUS_HI.NODE_ID_ IS
'节点ID';

COMMENT ON COLUMN BPM_PRO_STATUS_HI.NODE_NAME_ IS
'节点名称';

COMMENT ON COLUMN BPM_PRO_STATUS_HI.STATUS_ IS
'状态';

COMMENT ON COLUMN BPM_PRO_STATUS_HI.LAST_USERID_ IS
'最后更新人';

CREATE TABLE BPM_READ_RECORD 
(
   ID_                  NVARCHAR2(255)        NOT NULL,
   PROC_DEF_ID_         NVARCHAR2(255)        DEFAULT NULL,
   SUP_INST_ID_         NVARCHAR2(255)        DEFAULT NULL,
   PROC_INST_ID_        NVARCHAR2(255)        DEFAULT NULL,
   TASK_ID_             NVARCHAR2(255)        DEFAULT NULL,
   TASK_KEY_            NVARCHAR2(255)        DEFAULT NULL,
   TASK_NAME_           NVARCHAR2(255)        DEFAULT NULL,
   READER_              NVARCHAR2(255)        DEFAULT NULL,
   READER_NAME_         NVARCHAR2(255)        DEFAULT NULL,
   READ_TIME_           DATE,
   ORG_ID_              NVARCHAR2(255)        DEFAULT NULL,
   ORG_PATH_            NVARCHAR2(255)        DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_READ_RECORD PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_READ_RECORD IS
'任务阅读记录表';

COMMENT ON COLUMN BPM_READ_RECORD.PROC_DEF_ID_ IS
'流程定义ID';

COMMENT ON COLUMN BPM_READ_RECORD.SUP_INST_ID_ IS
'父流程实例ID';

COMMENT ON COLUMN BPM_READ_RECORD.PROC_INST_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_READ_RECORD.TASK_ID_ IS
'任务ID';

COMMENT ON COLUMN BPM_READ_RECORD.TASK_KEY_ IS
'任务定义KEY';

COMMENT ON COLUMN BPM_READ_RECORD.TASK_NAME_ IS
'任务名称';

COMMENT ON COLUMN BPM_READ_RECORD.READER_ IS
'阅读人ID';

COMMENT ON COLUMN BPM_READ_RECORD.READER_NAME_ IS
'阅读人名';

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

COMMENT ON COLUMN BPM_READ_RECORD.ORG_PATH_ IS
'组织名称';

CREATE TABLE BPM_REMINDER_HISTORY 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   INST_ID_             NVARCHAR2(255)        DEFAULT NULL,
   ISNT_NAME_           NVARCHAR2(255)        DEFAULT NULL,
   NODE_NAME_           NVARCHAR2(255)        DEFAULT NULL,
   NODE_ID_             NVARCHAR2(255)        DEFAULT NULL,
   EXECUTE_DATE_        DATE                 DEFAULT NULL,
   REMIND_TYPE_         NVARCHAR2(255)        DEFAULT NULL,
   USER_ID_             NVARCHAR2(255)        DEFAULT NULL,
   NOTE_                NVARCHAR2(255)        DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_REMINDER_HISTORY PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_REMINDER_HISTORY IS
'催办历史';

COMMENT ON COLUMN BPM_REMINDER_HISTORY.INST_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_REMINDER_HISTORY.ISNT_NAME_ IS
'流程实例标题';

COMMENT ON COLUMN BPM_REMINDER_HISTORY.NODE_NAME_ IS
'节点名称';

COMMENT ON COLUMN BPM_REMINDER_HISTORY.NODE_ID_ IS
'节点ID';

COMMENT ON COLUMN BPM_REMINDER_HISTORY.EXECUTE_DATE_ IS
'执行时间';

COMMENT ON COLUMN BPM_REMINDER_HISTORY.REMIND_TYPE_ IS
'执行类型';

COMMENT ON COLUMN BPM_REMINDER_HISTORY.USER_ID_ IS
'说明';

CREATE TABLE BPM_REPORT_ACT 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   REPORT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   BPM_DEF_ID_          NVARCHAR2(64)         DEFAULT NULL,
   REPORT_NAME_         NVARCHAR2(255)        DEFAULT NULL,
   DIMENSION_ID_        NVARCHAR2(255)        DEFAULT NULL,
   GRADE_               NVARCHAR2(255)        DEFAULT NULL,
   PARAMS_              NVARCHAR2(255)        DEFAULT NULL,
   RIGHT_CONTENT_       NVARCHAR2(255)        DEFAULT NULL,
   IS_DEFAULT_          NVARCHAR2(64)         DEFAULT NULL,
   X_AXIS_              NVARCHAR2(255)        DEFAULT NULL,
   Y_AXIS_              NVARCHAR2(255)        DEFAULT NULL,
   PORP_                CLOB,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_REPORT_ACT PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_REPORT_ACT IS
'报表子表';

COMMENT ON COLUMN BPM_REPORT_ACT.REPORT_ID_ IS
'报表主表ID';

COMMENT ON COLUMN BPM_REPORT_ACT.BPM_DEF_ID_ IS
'流程定义ID';

COMMENT ON COLUMN BPM_REPORT_ACT.REPORT_NAME_ IS
'报表名称';

COMMENT ON COLUMN BPM_REPORT_ACT.DIMENSION_ID_ IS
'组织维度id';

COMMENT ON COLUMN BPM_REPORT_ACT.GRADE_ IS
'统计级别';

COMMENT ON COLUMN BPM_REPORT_ACT.PARAMS_ IS
'统计参数';

COMMENT ON COLUMN BPM_REPORT_ACT.RIGHT_CONTENT_ IS
'授权内容(报表类型显示)';

COMMENT ON COLUMN BPM_REPORT_ACT.IS_DEFAULT_ IS
'默认显示视图(1：柱状图，2：饼图)';

COMMENT ON COLUMN BPM_REPORT_ACT.X_AXIS_ IS
'x轴数据';

COMMENT ON COLUMN BPM_REPORT_ACT.Y_AXIS_ IS
'y轴数据';

COMMENT ON COLUMN BPM_REPORT_ACT.PORP_ IS
'统计参数';

CREATE TABLE BPM_REPORT_LIST 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(255)        DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_NAME_         NVARCHAR2(255)        DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_NAME_     NVARCHAR2(255)        DEFAULT NULL,
   TYPE_                NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   ALIAS_               NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_REPORT_LIST PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_REPORT_LIST IS '报表主表';
COMMENT ON COLUMN BPM_REPORT_LIST.NAME_ IS '报表主表名称';
COMMENT ON COLUMN BPM_REPORT_LIST.CREATE_BY_ IS '创建人ID';
COMMENT ON COLUMN BPM_REPORT_LIST.CREATE_NAME_ IS '创建人名称';
COMMENT ON COLUMN BPM_REPORT_LIST.CREATE_ORG_ID_ IS '创建者所属组织ID';
COMMENT ON COLUMN BPM_REPORT_LIST.CREATE_ORG_NAME_ IS '组织名称';
COMMENT ON COLUMN BPM_REPORT_LIST.TYPE_ IS '是否发布(1:是，2否)';
COMMENT ON COLUMN BPM_REPORT_LIST.ALIAS_ IS '别名';

CREATE TABLE BPM_REPORT_USER 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   REPORT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   OWNER_ID_            NVARCHAR2(64)         DEFAULT NULL,
   OWNER_NAME_          NVARCHAR2(255)        DEFAULT NULL,
   RIGHT_TYPE_          NVARCHAR2(20)         DEFAULT NULL,
   AUTH_ORG_            NVARCHAR2(255)        DEFAULT NULL,
   AUTH_ORG_NAME_       NVARCHAR2(255)        DEFAULT NULL,
   CONSTRAINT PK_BPM_REPORT_USER PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_REPORT_USER IS
'报表授权表';

COMMENT ON COLUMN BPM_REPORT_USER.REPORT_ID_ IS
'报表授权主表ID';

COMMENT ON COLUMN BPM_REPORT_USER.OWNER_ID_ IS
'授权对象ID';

COMMENT ON COLUMN BPM_REPORT_USER.OWNER_NAME_ IS
'授权对象名称';

COMMENT ON COLUMN BPM_REPORT_USER.RIGHT_TYPE_ IS
'授权对象类型(角色,用户,岗位等)';

COMMENT ON COLUMN BPM_REPORT_USER.AUTH_ORG_ IS
'主组织ID';

COMMENT ON COLUMN BPM_REPORT_USER.AUTH_ORG_NAME_ IS
'主组织名称';

CREATE TABLE BPM_SAVE_OPINION 
(
   ID_                  NVARCHAR2(255)        NOT NULL,
   PROC_INST_ID_        NVARCHAR2(255)        NOT NULL,
   TASK_ID_             NVARCHAR2(255)        NOT NULL,
   OPINION_             NVARCHAR2(2000)       NOT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE                 DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE                 DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_SAVE_OPINION PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_SAVE_OPINION IS
'审批意见暂存表';

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

COMMENT ON COLUMN BPM_SAVE_OPINION.PROC_INST_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_SAVE_OPINION.TASK_ID_ IS
'任务ID';

COMMENT ON COLUMN BPM_SAVE_OPINION.OPINION_ IS
'暂存的审批意见';

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

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

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

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

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

CREATE TABLE BPM_SCRIPT 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(150)        DEFAULT NULL,
   SCRIPT_              CLOB,
   CATEGORY_            NVARCHAR2(128)        DEFAULT NULL,
   MEMO_                NVARCHAR2(1000)       DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   DS_NAME_             NVARCHAR2(50)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_SCRIPT PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_SCRIPT IS '常用脚本';
COMMENT ON COLUMN BPM_SCRIPT.NAME_ IS '脚本名称';
COMMENT ON COLUMN BPM_SCRIPT.SCRIPT_ IS '脚本';
COMMENT ON COLUMN BPM_SCRIPT.CATEGORY_ IS '脚本分类';
COMMENT ON COLUMN BPM_SCRIPT.MEMO_ IS '备注';
COMMENT ON COLUMN BPM_SCRIPT.CREATE_BY_ IS '创建人ID';
COMMENT ON COLUMN BPM_SCRIPT.CREATE_ORG_ID_ IS '创建人所属组织ID';
COMMENT ON COLUMN BPM_SCRIPT.UPDATE_BY_ IS '更新人ID';
COMMENT ON COLUMN BPM_SCRIPT.DS_NAME_ IS '数据源名称';

CREATE TABLE BPM_SECRETARY_MANAGE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   LEADER_ID_           NVARCHAR2(64)         DEFAULT NULL,
   LEADER_NAME_         NVARCHAR2(255)        DEFAULT NULL,
   SECRETARY_ID_        NVARCHAR2(255)        DEFAULT NULL,
   SECRETARY_NAME_      NVARCHAR2(1024)       DEFAULT NULL,
   SHARE_TYPE_          NVARCHAR2(2)          DEFAULT NULL,
   SHARE_KEY_           NVARCHAR2(2000)        DEFAULT NULL,
   SHARE_NAME_          NVARCHAR2(1024)       DEFAULT NULL,
   ENABLED_             NVARCHAR2(2)          DEFAULT '1',
   SHARE_RIGHT_         NVARCHAR2(10)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_SECRETARY_MANAGE PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_SECRETARY_MANAGE IS
'秘书管理表';

COMMENT ON COLUMN BPM_SECRETARY_MANAGE.LEADER_ID_ IS
'领导id';

COMMENT ON COLUMN BPM_SECRETARY_MANAGE.LEADER_NAME_ IS
'领导姓名';

COMMENT ON COLUMN BPM_SECRETARY_MANAGE.SECRETARY_ID_ IS
'秘书id';

COMMENT ON COLUMN BPM_SECRETARY_MANAGE.SECRETARY_NAME_ IS
'秘书姓名';

COMMENT ON COLUMN BPM_SECRETARY_MANAGE.SHARE_TYPE_ IS
'共享类型，1流程分类。2，流程定义';

COMMENT ON COLUMN BPM_SECRETARY_MANAGE.SHARE_KEY_ IS
'共享的KEY';

COMMENT ON COLUMN BPM_SECRETARY_MANAGE.SHARE_NAME_ IS
'共享对象的名称';

COMMENT ON COLUMN BPM_SECRETARY_MANAGE.ENABLED_ IS
'是否有效';

COMMENT ON COLUMN BPM_SECRETARY_MANAGE.SHARE_RIGHT_ IS
'共享权限类型';

CREATE TABLE BPM_SELECTOR_DEF 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(40)         DEFAULT NULL,
   ALIAS_               NVARCHAR2(64)         DEFAULT NULL,
   GROUP_FIELD_         NVARCHAR2(512)        DEFAULT NULL,
   BUTTONS_             NVARCHAR2(512)        DEFAULT NULL,
   IS_CUSTOM_           SMALLINT             DEFAULT NULL,
   FLAG_                SMALLINT             DEFAULT 0,
   METHOD_              NVARCHAR2(64)         DEFAULT NULL,
   CONF_KEY_            NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_SELECTOR_DEF PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_SELECTOR_DEF IS
'控件组合定义';

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

COMMENT ON COLUMN BPM_SELECTOR_DEF.ALIAS_ IS
'别名';

COMMENT ON COLUMN BPM_SELECTOR_DEF.GROUP_FIELD_ IS
'组合字段';

COMMENT ON COLUMN BPM_SELECTOR_DEF.BUTTONS_ IS
'按钮定义';

COMMENT ON COLUMN BPM_SELECTOR_DEF.IS_CUSTOM_ IS
'系统预定义';

COMMENT ON COLUMN BPM_SELECTOR_DEF.FLAG_ IS
'标记是否系统默认';

COMMENT ON COLUMN BPM_SELECTOR_DEF.METHOD_ IS
'选择器对应的js方法名称';

COMMENT ON COLUMN BPM_SELECTOR_DEF.CONF_KEY_ IS
'已选数据参数的传递KEY';

CREATE TABLE BPM_TASK 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(100)         NOT NULL,
   SUBJECT_             NVARCHAR2(256)        NOT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         NOT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   EXEC_ID_             NVARCHAR2(64)         DEFAULT NULL,
   NODE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   PROC_DEF_ID_         NVARCHAR2(64)         NOT NULL,
   PROC_DEF_KEY_        NVARCHAR2(64)         DEFAULT NULL,
   PROC_DEF_NAME_       NVARCHAR2(64)         DEFAULT NULL,
   OWNER_ID_            NVARCHAR2(64)         DEFAULT NULL,
   OWNER_NAME_          NVARCHAR2(128)        DEFAULT NULL,
   ASSIGNEE_ID_         NVARCHAR2(64)         DEFAULT NULL,
   ASSIGNEE_NAME_       NVARCHAR2(128)        DEFAULT NULL,
   STATUS_              NVARCHAR2(40)         NOT NULL,
   PRIORITY_            INTEGER              DEFAULT NULL,
   CREATE_TIME_         DATE,
   DUE_TIME_            DATE,
   SUSPEND_STATE_       SMALLINT             DEFAULT 0,
   PARENT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   BPMN_INST_ID_        NVARCHAR2(64)         DEFAULT NULL,
   BPMN_DEF_ID_         NVARCHAR2(64)         DEFAULT NULL,
   TYPE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   SUPPORT_MOBILE_      INTEGER              DEFAULT 0,
   IS_DELE_             INTEGER              DEFAULT 0 NOT NULL,
   IS_READ_             INTEGER              DEFAULT NULL,
   IS_REVOKE_           INTEGER              DEFAULT NULL,
   PROP1_               NVARCHAR2(200)        DEFAULT NULL,
   PROP2_               NVARCHAR2(200)        DEFAULT NULL,
   PROP3_               NVARCHAR2(200)        DEFAULT NULL,
   PROP4_               NVARCHAR2(200)        DEFAULT NULL,
   PROP5_               NVARCHAR2(200)        DEFAULT NULL,
   PROP6_               CLOB,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   PC_TASK_URL_         NVARCHAR2(200)         DEFAULT NULL,
   MOBILE_TASK_URL_     NVARCHAR2(200)         DEFAULT NULL,
   TARGET_NODE_         NVARCHAR2(255),
   CONSTRAINT PK_BPM_TASK PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_TASK IS '流程任务';
COMMENT ON COLUMN BPM_TASK.NAME_ IS '任务名称';
COMMENT ON COLUMN BPM_TASK.SUBJECT_ IS '待办事项标题';
COMMENT ON COLUMN BPM_TASK.PROC_INST_ID_ IS '关联 - 流程实例ID';
COMMENT ON COLUMN BPM_TASK.TASK_ID_ IS '关联的任务ID';
COMMENT ON COLUMN BPM_TASK.EXEC_ID_ IS '关联 - 节点执行ID';
COMMENT ON COLUMN BPM_TASK.NODE_ID_ IS '关联 - 任务节点ID';
COMMENT ON COLUMN BPM_TASK.PROC_DEF_ID_ IS '关联 - 流程定义ID';
COMMENT ON COLUMN BPM_TASK.PROC_DEF_KEY_ IS '关联 - 流程业务主键';
COMMENT ON COLUMN BPM_TASK.PROC_DEF_NAME_ IS '关联 - 流程名称';
COMMENT ON COLUMN BPM_TASK.OWNER_ID_ IS '任务所属人ID';
COMMENT ON COLUMN BPM_TASK.ASSIGNEE_ID_ IS '任务执行人ID';
COMMENT ON COLUMN BPM_TASK.STATUS_ IS '任务状态';
COMMENT ON COLUMN BPM_TASK.PRIORITY_ IS '任务优先级';
COMMENT ON COLUMN BPM_TASK.SUSPEND_STATE_ IS '是否挂起(0正常,1挂起)';
COMMENT ON COLUMN BPM_TASK.PARENT_ID_ IS '父任务ID';
COMMENT ON COLUMN BPM_TASK.BPMN_INST_ID_ IS 'bpmn实例ID';
COMMENT ON COLUMN BPM_TASK.BPMN_DEF_ID_ IS 'BPMN定义ID'; 
COMMENT ON COLUMN BPM_TASK.TYPE_ID_ IS '分类ID';
COMMENT ON COLUMN BPM_TASK.SUPPORT_MOBILE_ IS '支持手机';
COMMENT ON COLUMN BPM_TASK.IS_DELE_ IS '是否已删，1已删除，0未删除';
COMMENT ON COLUMN BPM_TASK.PROP1_ IS '扩展属性1';
COMMENT ON COLUMN BPM_TASK.PROP2_ IS '扩展属性2';
COMMENT ON COLUMN BPM_TASK.PROP3_ IS '扩展属性3';
COMMENT ON COLUMN BPM_TASK.PROP4_ IS '扩展属性4';
COMMENT ON COLUMN BPM_TASK.PROP5_ IS '扩展属性5';
COMMENT ON COLUMN BPM_TASK.PROP6_ IS '扩展属性6';
COMMENT ON COLUMN BPM_TASK.PC_TASK_URL_ IS 'PC端实例地址';
COMMENT ON COLUMN BPM_TASK.MOBILE_TASK_URL_ IS '手机端实例地址';
COMMENT ON COLUMN BPM_TASK.TARGET_NODE_ IS '回到本节点';

CREATE TABLE BPM_NODE_SETTING
(
    ID_             NVARCHAR2(255)  NOT NULL    PRIMARY KEY,
    CREATE_BY_      NVARCHAR2(64)   DEFAULT NULL,
    CREATE_TIME_    DATE,
    CREATE_ORG_ID_  NVARCHAR2(64)  DEFAULT NULL,
    UPDATE_BY_      NVARCHAR2(64)  DEFAULT NULL,
    UPDATE_TIME_    DATE           DEFAULT NULL,
    TENANT_ID_      NVARCHAR2(64)  DEFAULT NULL,
    NODE_ID_        NVARCHAR2(64)  DEFAULT NULL,
    DEF_ID          NVARCHAR2(64)  DEFAULT NULL,
    FORECAST_       NUMBER         DEFAULT NULL
);
COMMENT ON TABLE BPM_NODE_SETTING IS '流程定义节点设置表';
COMMENT ON COLUMN BPM_NODE_SETTING.ID_ IS '主键';
COMMENT ON COLUMN BPM_NODE_SETTING.CREATE_BY_ IS '创建人ID';
COMMENT ON COLUMN BPM_NODE_SETTING.CREATE_TIME_ IS '创建时间';
COMMENT ON COLUMN BPM_NODE_SETTING.CREATE_ORG_ID_ IS '创建者所属组织ID';
COMMENT ON COLUMN BPM_NODE_SETTING.UPDATE_BY_ IS '更新人ID';
COMMENT ON COLUMN BPM_NODE_SETTING.UPDATE_TIME_ IS '更新时间';
COMMENT ON COLUMN BPM_NODE_SETTING.TENANT_ID_ IS '租户ID';
COMMENT ON COLUMN BPM_NODE_SETTING.NODE_ID_ IS '节点ID';
COMMENT ON COLUMN BPM_NODE_SETTING.DEF_ID IS '流程定义ID';
COMMENT ON COLUMN BPM_NODE_SETTING.FORECAST_ IS '审批预测值(1为同意,2为反对,默认为1)';

CREATE TABLE BPM_TASK_CANDIDATE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   TYPE_                NVARCHAR2(20)         DEFAULT NULL,
   EXECUTOR_            NVARCHAR2(64)         DEFAULT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TASK_CANDIDATE PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_TASK_CANDIDATE IS
'任务候选人';

COMMENT ON COLUMN BPM_TASK_CANDIDATE.TASK_ID_ IS
'任务ID';

COMMENT ON COLUMN BPM_TASK_CANDIDATE.TYPE_ IS
'候选人类型';

COMMENT ON COLUMN BPM_TASK_CANDIDATE.EXECUTOR_ IS
'执行人ID';

COMMENT ON COLUMN BPM_TASK_CANDIDATE.PROC_INST_ID_ IS
'流程实例';

CREATE TABLE BPM_TASK_COMMU 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   INSTANCE_ID_         NVARCHAR2(64)         DEFAULT NULL,
   NODE_NAME_           NVARCHAR2(128)        DEFAULT NULL,
   NODE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   SENDER_ID_           NVARCHAR2(64)         DEFAULT NULL,
   SENDER               NVARCHAR2(128)        DEFAULT NULL,
   CREATETIME_          DATE,
   OPINION_             NVARCHAR2(1500)       DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TASK_COMMU PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_TASK_COMMU IS
'任务通知';

COMMENT ON COLUMN BPM_TASK_COMMU.INSTANCE_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_TASK_COMMU.NODE_NAME_ IS
'节点名称';

COMMENT ON COLUMN BPM_TASK_COMMU.NODE_ID_ IS
'节点ID';

COMMENT ON COLUMN BPM_TASK_COMMU.TASK_ID_ IS
'任务ID';

COMMENT ON COLUMN BPM_TASK_COMMU.SENDER_ID_ IS
'发送沟通人ID';

COMMENT ON COLUMN BPM_TASK_COMMU.SENDER IS
'发送沟通人';

COMMENT ON COLUMN BPM_TASK_COMMU.OPINION_ IS
'意见';

CREATE TABLE BPM_TASK_DUE_TIME 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   PARENT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   INST_ID_             NVARCHAR2(64)         DEFAULT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   DATE_TYPE_           NVARCHAR2(32)         DEFAULT NULL,
   DUE_TIME_            INTEGER              DEFAULT NULL,
   ADD_DUE_TIME_        INTEGER              DEFAULT NULL,
   START_TIME_          DATE,
   EXPIRATION_DATE_     DATE,
   REMAINING_TIME_      INTEGER              DEFAULT NULL,
   CREATE_TIME_         DATE,
   STATUS_              INTEGER              DEFAULT NULL,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   USER_NAME_           NVARCHAR2(128)        DEFAULT NULL,
   REMARK_              NVARCHAR2(512)        DEFAULT NULL,
   FILE_ID_             NVARCHAR2(512)        DEFAULT NULL,
   IS_NEW_              INTEGER              DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TASK_DUE_TIME PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_TASK_DUE_TIME IS
'任务期限记录表';

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

COMMENT ON COLUMN BPM_TASK_DUE_TIME.INST_ID_ IS
'流程实例id';

COMMENT ON COLUMN BPM_TASK_DUE_TIME.TASK_ID_ IS
'任务id';

COMMENT ON COLUMN BPM_TASK_DUE_TIME.DATE_TYPE_ IS
'时间类型  工作日 worktime  日历日 caltime';

COMMENT ON COLUMN BPM_TASK_DUE_TIME.DUE_TIME_ IS
'任务时间 (分钟)';

COMMENT ON COLUMN BPM_TASK_DUE_TIME.ADD_DUE_TIME_ IS
'延迟时间';

COMMENT ON COLUMN BPM_TASK_DUE_TIME.REMAINING_TIME_ IS
'任务剩余时间（分钟）';

COMMENT ON COLUMN BPM_TASK_DUE_TIME.STATUS_ IS
'状态 是否延期申请过 1申请过  0没延迟过';

COMMENT ON COLUMN BPM_TASK_DUE_TIME.USER_ID_ IS
'审批人ID';

COMMENT ON COLUMN BPM_TASK_DUE_TIME.USER_NAME_ IS
'审批人姓名';

COMMENT ON COLUMN BPM_TASK_DUE_TIME.REMARK_ IS
'说明';

COMMENT ON COLUMN BPM_TASK_DUE_TIME.FILE_ID_ IS
'附件';

COMMENT ON COLUMN BPM_TASK_DUE_TIME.IS_NEW_ IS
'是否新的延迟 1 是  0 否 ';

CREATE TABLE BPM_TASK_FOLLOW 
(
   ID                   NVARCHAR2(255)        NOT NULL,
   TASK_ID              NVARCHAR2(255)        DEFAULT NULL,
   CREATOR_ID_          NVARCHAR2(255)        DEFAULT NULL,
   PRO_INST_            NVARCHAR2(255)        DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TASK_FOLLOW PRIMARY KEY (ID)
);

COMMENT ON TABLE BPM_TASK_FOLLOW IS
'任务跟踪表';

COMMENT ON COLUMN BPM_TASK_FOLLOW.ID IS
'主键';

COMMENT ON COLUMN BPM_TASK_FOLLOW.TASK_ID IS
'任务id';

COMMENT ON COLUMN BPM_TASK_FOLLOW.CREATOR_ID_ IS
'创建者ID';

COMMENT ON COLUMN BPM_TASK_FOLLOW.PRO_INST_ IS
'流程实例id';

CREATE TABLE BPM_TASK_NOTICE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(64)         NOT NULL,
   SUBJECT_             NVARCHAR2(128)        NOT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         NOT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   EXEC_ID_             NVARCHAR2(64)         DEFAULT NULL,
   NODE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   PROC_DEF_ID_         NVARCHAR2(64)         NOT NULL,
   PROC_DEF_KEY_        NVARCHAR2(64)         DEFAULT NULL,
   PROC_DEF_NAME_       NVARCHAR2(64)         DEFAULT NULL,
   OWNER_ID_            NVARCHAR2(64)         DEFAULT NULL,
   OWNER_NAME_          NVARCHAR2(128)        DEFAULT NULL,
   ASSIGNEE_ID_         NVARCHAR2(64)         DEFAULT NULL,
   ASSIGNEE_NAME_       NVARCHAR2(128)        DEFAULT NULL,
   STATUS_              NVARCHAR2(40)         NOT NULL,
   PRIORITY_            INTEGER              DEFAULT NULL,
   CREATE_TIME_         DATE,
   DUE_TIME_            DATE,
   SUSPEND_STATE_       SMALLINT             DEFAULT 0,
   PARENT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   BPMN_INST_ID_        NVARCHAR2(64)         DEFAULT NULL,
   BPMN_DEF_ID_         NVARCHAR2(64)         DEFAULT NULL,
   TYPE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   SUPPORT_MOBILE_      INTEGER              DEFAULT 0,
   IS_DELE_             INTEGER              DEFAULT 0 NOT NULL,
   IS_READ_             INTEGER              DEFAULT 0 NOT NULL,
   IS_REVOKE_           INTEGER              DEFAULT 0 NOT NULL,
   PROP1_               NVARCHAR2(200)        DEFAULT NULL,
   PROP2_               NVARCHAR2(200)        DEFAULT NULL,
   PROP3_               NVARCHAR2(200)        DEFAULT NULL,
   PROP4_               NVARCHAR2(200)        DEFAULT NULL,
   PROP5_               NVARCHAR2(200)        DEFAULT NULL,
   PROP6_               CLOB,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   OPINION_ID_          NVARCHAR2(64)         DEFAULT NULL,
   PC_TASK_URL_         NVARCHAR2(200)         DEFAULT NULL,
   MOBILE_TASK_URL_     NVARCHAR2(200)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TASK_NOTICE PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_TASK_NOTICE IS '知会任务表';
COMMENT ON COLUMN BPM_TASK_NOTICE.NAME_ IS '任务名称';
COMMENT ON COLUMN BPM_TASK_NOTICE.SUBJECT_ IS '待办事项标题';
COMMENT ON COLUMN BPM_TASK_NOTICE.PROC_INST_ID_ IS '关联 - 流程实例ID';
COMMENT ON COLUMN BPM_TASK_NOTICE.TASK_ID_ IS '关联的任务ID';
COMMENT ON COLUMN BPM_TASK_NOTICE.EXEC_ID_ IS '关联 - 节点执行ID';
COMMENT ON COLUMN BPM_TASK_NOTICE.NODE_ID_ IS '关联 - 任务节点ID';
COMMENT ON COLUMN BPM_TASK_NOTICE.PROC_DEF_ID_ IS '关联 - 流程定义ID';
COMMENT ON COLUMN BPM_TASK_NOTICE.PROC_DEF_KEY_ IS '关联 - 流程业务主键';
COMMENT ON COLUMN BPM_TASK_NOTICE.PROC_DEF_NAME_ IS '关联 - 流程名称'; 
COMMENT ON COLUMN BPM_TASK_NOTICE.OWNER_ID_ IS '任务所属人ID';
COMMENT ON COLUMN BPM_TASK_NOTICE.ASSIGNEE_ID_ IS '任务执行人ID';
COMMENT ON COLUMN BPM_TASK_NOTICE.STATUS_ IS '任务状态';
COMMENT ON COLUMN BPM_TASK_NOTICE.PRIORITY_ IS '任务优先级';
COMMENT ON COLUMN BPM_TASK_NOTICE.SUSPEND_STATE_ IS '是否挂起(0正常,1挂起)'; 
COMMENT ON COLUMN BPM_TASK_NOTICE.PARENT_ID_ IS '父任务ID';
COMMENT ON COLUMN BPM_TASK_NOTICE.BPMN_INST_ID_ IS 'bpmn实例ID';
COMMENT ON COLUMN BPM_TASK_NOTICE.BPMN_DEF_ID_ IS 'BPMN定义ID';
COMMENT ON COLUMN BPM_TASK_NOTICE.TYPE_ID_ IS '分类ID';
COMMENT ON COLUMN BPM_TASK_NOTICE.SUPPORT_MOBILE_ IS '支持手机';
COMMENT ON COLUMN BPM_TASK_NOTICE.IS_DELE_ IS '是否已删，1已删除，0未删除';
COMMENT ON COLUMN BPM_TASK_NOTICE.IS_READ_ IS '传阅的任务是否已阅 0:待阅，1：已阅';
COMMENT ON COLUMN BPM_TASK_NOTICE.IS_REVOKE_ IS '传阅的任务是否撤回 0:否，1：是';
COMMENT ON COLUMN BPM_TASK_NOTICE.PROP1_ IS '扩展属性1';
COMMENT ON COLUMN BPM_TASK_NOTICE.PROP2_ IS '扩展属性2';
COMMENT ON COLUMN BPM_TASK_NOTICE.PROP3_ IS '扩展属性3';
COMMENT ON COLUMN BPM_TASK_NOTICE.PROP4_ IS '扩展属性4';
COMMENT ON COLUMN BPM_TASK_NOTICE.PROP5_ IS '扩展属性5';
COMMENT ON COLUMN BPM_TASK_NOTICE.PROP6_ IS '扩展属性6';
COMMENT ON COLUMN BPM_TASK_NOTICE.PC_TASK_URL_ IS 'PC端启动地址';
COMMENT ON COLUMN BPM_TASK_NOTICE.MOBILE_TASK_URL_ IS '手机端启动地址';

CREATE TABLE BPM_TASK_NOTICE_DONE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   PROC_DEF_ID_         NVARCHAR2(64)         NOT NULL,
   SUP_INST_ID_         NVARCHAR2(64)         DEFAULT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         NOT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   TASK_KEY_            NVARCHAR2(64)         DEFAULT NULL,
   TASK_NAME_           NVARCHAR2(255)        DEFAULT NULL,
   TOKEN_               NVARCHAR2(64)         DEFAULT NULL,
   QUALFIEDS_           CLOB                 DEFAULT NULL,
   QUALFIED_NAMES_      CLOB                 DEFAULT NULL,
   AUDITOR_             NVARCHAR2(64)         DEFAULT NULL,
   AUDITOR_NAME_        NVARCHAR2(64)         DEFAULT NULL,
   ORG_ID_              NVARCHAR2(64)         DEFAULT NULL,
   ORG_PATH_            NVARCHAR2(600)        DEFAULT NULL,
   OPINION_             NVARCHAR2(2000)       DEFAULT NULL,
   STATUS_              NVARCHAR2(40)         NOT NULL,
   FORM_DEF_ID_         NVARCHAR2(64)         DEFAULT NULL,
   FORM_NAME_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   ASSIGN_TIME_         DATE,
   COMPLETE_TIME_       DATE,
   DUR_MS_              INTEGER              DEFAULT NULL,
   FILES_               NVARCHAR2(2000)       DEFAULT NULL,
   INTERPOSE_           SMALLINT             DEFAULT NULL,
   SUBJECT_             NVARCHAR2(255)        DEFAULT NULL,
   PROC_DEF_NAME_       NVARCHAR2(255)        DEFAULT NULL,
   BPM_TASK_NOTICE_ID_  NVARCHAR2(255)        DEFAULT NULL,
   SUPPORT_MOBILE_      INTEGER              DEFAULT 0,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TASK_NOTICE_DONE PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_TASK_NOTICE_DONE IS
'知会任务已办';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.PROC_DEF_ID_ IS
'流程定义ID';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.SUP_INST_ID_ IS
'父流程实例ID';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.PROC_INST_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.TASK_ID_ IS
'任务ID';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.TASK_KEY_ IS
'任务定义KEY';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.TASK_NAME_ IS
'任务名称';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.TOKEN_ IS
'任务令牌';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.QUALFIEDS_ IS
'有审批资格用户ID串';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.QUALFIED_NAMES_ IS
'有审批资格用户名称串';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.AUDITOR_ IS
'执行人ID';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.AUDITOR_NAME_ IS
'执行人名';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.ORG_ID_ IS
'组织ID';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.ORG_PATH_ IS
'组织全路径';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.OPINION_ IS
'审批意见';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.STATUS_ IS
'知会任务已办状态';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.FORM_DEF_ID_ IS
'表单定义ID';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.FORM_NAME_ IS
'表单名';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.DUR_MS_ IS
'持续时间(ms)';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.FILES_ IS
'附件';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.INTERPOSE_ IS
'是否干预';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.SUBJECT_ IS
'流程标题';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.PROC_DEF_NAME_ IS
'任务名称';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.BPM_TASK_NOTICE_ID_ IS
'知会待办主键ID';

COMMENT ON COLUMN BPM_TASK_NOTICE_DONE.SUPPORT_MOBILE_ IS
'是否支持手机0：不支持，1：支持';

CREATE TABLE BPM_TASK_READ 
(
   READ_ID_             NVARCHAR2(64)         NOT NULL,
   PROC_DEF_ID          NVARCHAR2(64)         DEFAULT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         DEFAULT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   NODE_ID_             NVARCHAR2(255)        DEFAULT NULL,
   READ_TIME_           DATE,
   USER_ID_             NVARCHAR2(64)         DEFAULT NULL,
   USER_NAME_           NVARCHAR2(32)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TASK_READ PRIMARY KEY (READ_ID_)
);

COMMENT ON TABLE BPM_TASK_READ IS
'流程任务查看';

COMMENT ON COLUMN BPM_TASK_READ.READ_ID_ IS
'主键';

COMMENT ON COLUMN BPM_TASK_READ.PROC_DEF_ID IS
'流程定义ID';

COMMENT ON COLUMN BPM_TASK_READ.PROC_INST_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_TASK_READ.TASK_ID_ IS
'任务ID';

COMMENT ON COLUMN BPM_TASK_READ.NODE_ID_ IS
'节点ID';

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

COMMENT ON COLUMN BPM_TASK_READ.USER_NAME_ IS
'用户名';

CREATE TABLE BPM_TASK_REMINDER 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   NAME_                NVARCHAR2(64)         DEFAULT NULL,
   REL_DATE_            DATE,
   DUE_ACTION_          NVARCHAR2(64)         DEFAULT NULL,
   DUE_SCRIPT_          NVARCHAR2(255)        DEFAULT NULL,
   DUE_DATE_            DATE,
   IS_SEND_MSG_         INTEGER              DEFAULT NULL,
   MSG_SEND_DATE_       DATE,
   MSG_INTERVAL_        INTEGER              DEFAULT NULL,
   MSG_COUNT_           INTEGER              DEFAULT NULL,
   MSG_TYPE_            NVARCHAR2(64)         DEFAULT NULL,
   HTML_MSG_            NVARCHAR2(255)        DEFAULT NULL,
   PLAIN_MSG_           NVARCHAR2(255)        DEFAULT NULL,
   WARNINGSET_          NVARCHAR2(255)        DEFAULT NULL,
   TRIGGER_DATE_        DATE,
   SEND_PERSON_         NVARCHAR2(64)         DEFAULT NULL,
   SEND_USER_ID_        NVARCHAR2(64),
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   DURATION_SCRIPT_     CLOB,
   DURATION_            INTEGER,
   SEND_DURATION_       INTEGER,
   DATE_TYPE_           NVARCHAR2(20),
   TYPE_SCRIPT_         CLOB,
   REL_TIME_SCRIPT_     CLOB,
   TRANSFER_ID_         NVARCHAR2(64),
   TRANSFER_NAME_       NVARCHAR2(255),
   DIRECT_LEADER_       INT,
   MAIN_ORG_LEADER_     INT,
   DIRECT_USER_IDS_     NVARCHAR2(1000),
   DIRECT_USER_NAMES_   NVARCHAR2(1000),
   DIRECT_USER_         INT,
   CONSTRAINT PK_BPM_TASK_REMINDER PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_TASK_REMINDER IS '任务催办';
COMMENT ON COLUMN BPM_TASK_REMINDER.TASK_ID_ IS '催办任务ID';
COMMENT ON COLUMN BPM_TASK_REMINDER.NAME_ IS '催办名称';
COMMENT ON COLUMN BPM_TASK_REMINDER.DUE_ACTION_ IS '到期执行动作';
COMMENT ON COLUMN BPM_TASK_REMINDER.DUE_SCRIPT_ IS '调用指定方法';
COMMENT ON COLUMN BPM_TASK_REMINDER.IS_SEND_MSG_ IS '期间是否发送催办';
COMMENT ON COLUMN BPM_TASK_REMINDER.MSG_INTERVAL_ IS '发送消息间隔';
COMMENT ON COLUMN BPM_TASK_REMINDER.MSG_COUNT_ IS '发送次数';
COMMENT ON COLUMN BPM_TASK_REMINDER.MSG_TYPE_ IS '消息类型  inner,msg,email 等';
COMMENT ON COLUMN BPM_TASK_REMINDER.HTML_MSG_ IS '富文本';
COMMENT ON COLUMN BPM_TASK_REMINDER.PLAIN_MSG_ IS '纯文本消息';
COMMENT ON COLUMN BPM_TASK_REMINDER.WARNINGSET_ IS '预警配置（预警名称，triggerDate，change2level）';
COMMENT ON COLUMN BPM_TASK_REMINDER.SEND_USER_ID_ IS '发送个人ID';
COMMENT ON COLUMN BPM_TASK_REMINDER.DURATION_SCRIPT_ IS '时长脚本';
COMMENT ON COLUMN BPM_TASK_REMINDER.DURATION_ IS '时长';
COMMENT ON COLUMN BPM_TASK_REMINDER.SEND_DURATION_ IS '消息时长';
COMMENT ON COLUMN BPM_TASK_REMINDER.DATE_TYPE_ IS '类型 caltime日历日 worktime工作日';
COMMENT ON COLUMN BPM_TASK_REMINDER.TYPE_SCRIPT_ IS '类型脚本';
COMMENT ON COLUMN BPM_TASK_REMINDER.REL_TIME_SCRIPT_ IS '相对时间脚本';
COMMENT ON COLUMN BPM_TASK_REMINDER.TRANSFER_ID_ is '转办人ID';
COMMENT ON COLUMN BPM_TASK_REMINDER.TRANSFER_NAME_ is '转办人名称';
COMMENT ON COLUMN BPM_TASK_REMINDER.DIRECT_LEADER_ is '催办直接上级';
COMMENT ON COLUMN BPM_TASK_REMINDER.MAIN_ORG_LEADER_ is '催办主组织负责人';
COMMENT ON COLUMN BPM_TASK_REMINDER.DIRECT_USER_IDS_ is '指定用户ID';
COMMENT ON COLUMN BPM_TASK_REMINDER.DIRECT_USER_NAMES_ is '指定用户名称';
COMMENT ON COLUMN BPM_TASK_REMINDER.DIRECT_USER_ is '催办指定用户';

CREATE TABLE BPM_TASK_SIGNDATA 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   DEF_ID_              NVARCHAR2(64)         DEFAULT NULL,
   INST_ID_             NVARCHAR2(64)         DEFAULT NULL,
   EXECUTE_ID_          NVARCHAR2(40)         DEFAULT NULL,
   ACT_INST_ID_         NVARCHAR2(64)         DEFAULT NULL,
   NODE_ID_             NVARCHAR2(128)        DEFAULT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   QUALIFIED_ID_        NVARCHAR2(255)        DEFAULT NULL,
   QUALIFIED_NAME_      NVARCHAR2(512)        DEFAULT NULL,
   CREATE_TIME_         DATE,
   VOTE_RESULT_         NVARCHAR2(20)         DEFAULT NULL,
   VOTE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   VOTER_               NVARCHAR2(40)         DEFAULT NULL,
   VOTE_TIME_           DATE,
   INDEX_               INTEGER              DEFAULT NULL,
   IS_ACTIVE_           INTEGER              DEFAULT NULL,
   TYPE_                NVARCHAR2(64)         DEFAULT NULL,
   IDENTITY_TYPE_       NVARCHAR2(64)         DEFAULT NULL,
   FROM_                NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TASK_SIGNDATA PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_TASK_SIGNDATA IS '会签数据';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.DEF_ID_ IS '流程定义ID';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.INST_ID_ IS '流程实例ID';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.EXECUTE_ID_ IS 'act运行实例Id';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.ACT_INST_ID_ IS 'ACT流程实例ID';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.NODE_ID_ IS '节点ID';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.TASK_ID_ IS '流程任务ID';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.QUALIFIED_ID_ IS '有资格审批的成员ID';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.QUALIFIED_NAME_ IS '有资格审批的成员名称';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.VOTE_RESULT_ IS '投票结果(no 未投票 通过 agree,abandON 弃权,oppose 反对)';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.VOTE_ID_ IS '投票人';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.VOTER_ IS '投票人';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.INDEX_ IS '投票次序';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.IS_ACTIVE_ IS '是否活动';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.TYPE_ IS '流程定义ID';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.IDENTITY_TYPE_ IS '用户组类型';
COMMENT ON COLUMN BPM_TASK_SIGNDATA.FROM_ IS '来源。assign由指定历史会签处理人产生的';


CREATE TABLE BPM_TASK_SIGN_LINE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   INSTANCE_ID_         NVARCHAR2(64)         DEFAULT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   PARENT_TASK_ID_      NVARCHAR2(64)         DEFAULT NULL,
   PATH_                NVARCHAR2(512)        DEFAULT NULL,
   STATUS_              NVARCHAR2(64)         DEFAULT NULL,
   EXECUTOR_            NVARCHAR2(2000)       DEFAULT NULL,
   ACTION_              NVARCHAR2(64)         DEFAULT NULL,
   NODE_ID_             NVARCHAR2(128)        DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TASK_SIGN_LINE PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_TASK_SIGN_LINE IS
'并行签署';

COMMENT ON COLUMN BPM_TASK_SIGN_LINE.INSTANCE_ID_ IS
'流程实例';

COMMENT ON COLUMN BPM_TASK_SIGN_LINE.TASK_ID_ IS
'任务ID';

COMMENT ON COLUMN BPM_TASK_SIGN_LINE.PATH_ IS
'路径';

COMMENT ON COLUMN BPM_TASK_SIGN_LINE.EXECUTOR_ IS
'执行人';

COMMENT ON COLUMN BPM_TASK_SIGN_LINE.ACTION_ IS
'并行签署后的动作 submit提交 back返回 ';

COMMENT ON COLUMN BPM_TASK_SIGN_LINE.NODE_ID_ IS
'节点id';

CREATE TABLE BPM_TASK_SIGN_SEQUENCE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   INSTANCE_ID_         NVARCHAR2(64)         DEFAULT NULL,
   NODE_ID_             NVARCHAR2(128)        DEFAULT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   NEXT_TASK_ID_        NVARCHAR2(64)         DEFAULT NULL,
   PARENT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   STATUS_              NVARCHAR2(64)         DEFAULT NULL,
   PATH_                NVARCHAR2(512)        DEFAULT NULL,
   SEQ_                 SMALLINT             DEFAULT NULL,
   EXECUTOR_            NVARCHAR2(2000)       DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TASK_SIGN_SEQUENCE PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_TASK_SIGN_SEQUENCE IS
'顺序签署人员';

COMMENT ON COLUMN BPM_TASK_SIGN_SEQUENCE.INSTANCE_ID_ IS
'流程实例';

COMMENT ON COLUMN BPM_TASK_SIGN_SEQUENCE.NODE_ID_ IS
'节点KEY';

COMMENT ON COLUMN BPM_TASK_SIGN_SEQUENCE.TASK_ID_ IS
'任务ID';

COMMENT ON COLUMN BPM_TASK_SIGN_SEQUENCE.NEXT_TASK_ID_ IS
'下一任务ID';

COMMENT ON COLUMN BPM_TASK_SIGN_SEQUENCE.PATH_ IS
'路径';

COMMENT ON COLUMN BPM_TASK_SIGN_SEQUENCE.SEQ_ IS
'顺序';

COMMENT ON COLUMN BPM_TASK_SIGN_SEQUENCE.EXECUTOR_ IS
'执行人';

CREATE TABLE BPM_TASK_TRANS 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   INSTANCE_ID_         NVARCHAR2(64)         DEFAULT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   ACTION_              NVARCHAR2(20)         DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATOR_             NVARCHAR2(128)        DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   DECIDE_TYPE_         NVARCHAR2(20)         DEFAULT NULL,
   VOTE_TYPE_           NVARCHAR2(20)         DEFAULT NULL,
   VOTE_AMOUNT_         SMALLINT             DEFAULT NULL,
   SIGN_TYPE_           NVARCHAR2(20)         DEFAULT NULL,
   INQU_TYPE_           NVARCHAR2(20),
   TOTAL_AMOUNT_        SMALLINT             DEFAULT NULL,
   AGREE_AMOUNT_        SMALLINT             DEFAULT NULL,
   OPPOSE_AMOUNT_       SMALLINT             DEFAULT NULL,
   SEQ_                 SMALLINT             DEFAULT NULL,
   USER_JSON_           NVARCHAR2(2000)       DEFAULT NULL,
   ALLOW_FORM_EDIT_     SMALLINT             DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TASK_TRANS PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_TASK_TRANS IS
'流程流转';

COMMENT ON COLUMN BPM_TASK_TRANS.INSTANCE_ID_ IS
'流程实例';

COMMENT ON COLUMN BPM_TASK_TRANS.TASK_ID_ IS
'任务ID\r\n流转任务ID';

COMMENT ON COLUMN BPM_TASK_TRANS.ACTION_ IS
'完成后的操作';

COMMENT ON COLUMN BPM_TASK_TRANS.CREATOR_ IS
'创建人';

COMMENT ON COLUMN BPM_TASK_TRANS.DECIDE_TYPE_ IS
'决策类型\r\nagree\r\noppose';

COMMENT ON COLUMN BPM_TASK_TRANS.VOTE_TYPE_ IS
'投票类型\r\namount\r\npercent';

COMMENT ON COLUMN BPM_TASK_TRANS.VOTE_AMOUNT_ IS
'票数';

COMMENT ON COLUMN BPM_TASK_TRANS.SIGN_TYPE_ IS
'会签类型\r\nparallel,seq';

COMMENT ON COLUMN BPM_TASK_TRANS.INQU_TYPE_ IS
'征询类型 direct step';

COMMENT ON COLUMN BPM_TASK_TRANS.TOTAL_AMOUNT_ IS
'总票数';

COMMENT ON COLUMN BPM_TASK_TRANS.AGREE_AMOUNT_ IS
'通过票数';

COMMENT ON COLUMN BPM_TASK_TRANS.OPPOSE_AMOUNT_ IS
'反对票数';

COMMENT ON COLUMN BPM_TASK_TRANS.SEQ_ IS
'投票次序';

COMMENT ON COLUMN BPM_TASK_TRANS.USER_JSON_ IS
'用户数据';

COMMENT ON COLUMN BPM_TASK_TRANS.ALLOW_FORM_EDIT_ IS
'表单允许编辑';

CREATE TABLE BPM_TASK_TRANS_RECORD 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         DEFAULT NULL,
   TASK_ID_             NVARCHAR2(64)         DEFAULT NULL,
   ACTION_              NVARCHAR2(20)         DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATOR_             NVARCHAR2(128)        DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   DECIDE_TYPE          NVARCHAR2(20)         DEFAULT NULL,
   VOTE_TYPE_           NVARCHAR2(20)         DEFAULT NULL,
   VOTE_AMOUNT_         SMALLINT             DEFAULT NULL,
   SIGN_TYPE_           NVARCHAR2(20)         DEFAULT NULL,
   TOTAL_AMOUNT_        SMALLINT             DEFAULT NULL,
   AGREE_AMOUNT_        SMALLINT             DEFAULT NULL,
   OPPOSE_AMOUNT_       SMALLINT             DEFAULT NULL,
   TRANS_USERS_         NVARCHAR2(300)        DEFAULT NULL,
   TASK_NAME_           NVARCHAR2(200)        DEFAULT NULL,
   TASK_SUBJECT_        NVARCHAR2(300)        DEFAULT NULL,
   STATUS_              SMALLINT             DEFAULT NULL,
   TRANS_USER_IDS_      NVARCHAR2(300)        DEFAULT NULL,
   TRANS_OPINION_       NVARCHAR2(200)        DEFAULT NULL,
   TRANS_TIME_          DATE,
   DEF_NAME_            NVARCHAR2(200)        DEFAULT NULL,
   TRANS_OWNER_         NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TASK_TRANS_RECORD PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_TASK_TRANS_RECORD IS
'流程流转记录';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.PROC_INST_ID_ IS
'流程实例';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.TASK_ID_ IS
'任务ID\r\n流转任务ID';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.ACTION_ IS
'完成后的操作';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.CREATOR_ IS
'创建人';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.DECIDE_TYPE IS
'决策类型\r\n同意 agree\r\n反对  oppose';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.VOTE_TYPE_ IS
'投票类型';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.VOTE_AMOUNT_ IS
'票数';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.SIGN_TYPE_ IS
'会签类型';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.TOTAL_AMOUNT_ IS
'总票数';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.AGREE_AMOUNT_ IS
'通过票数';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.OPPOSE_AMOUNT_ IS
'反对票数';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.TRANS_USERS_ IS
'流转人员';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.TASK_NAME_ IS
'任务名称';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.TASK_SUBJECT_ IS
'流转任务标题';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.STATUS_ IS
'状态：0流转中 1流转结束 2已撤销';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.TRANS_USER_IDS_ IS
'流转人员ids';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.TRANS_OPINION_ IS
'流转意见(原因)';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.DEF_NAME_ IS
'流程名称';

COMMENT ON COLUMN BPM_TASK_TRANS_RECORD.TRANS_OWNER_ IS
'流转任务所属人ID';

CREATE TABLE BPM_TASK_TURN 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   TASK_ID_             NVARCHAR2(64)         NOT NULL,
   TASK_NAME_           NVARCHAR2(64)         NOT NULL,
   TASK_SUBJECT_        NVARCHAR2(128)        NOT NULL,
   NODE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   PROC_INST_ID_        NVARCHAR2(64)         NOT NULL,
   OWNER_ID_            NVARCHAR2(64)         DEFAULT NULL,
   OWNER_NAME_          NVARCHAR2(64)         DEFAULT NULL,
   ASSIGNEE_ID_         NVARCHAR2(64)         DEFAULT NULL,
   ASSIGNEE_NAME_       NVARCHAR2(64)         DEFAULT NULL,
   STATUS_              NVARCHAR2(40)         DEFAULT NULL,
   TURN_TYPE_           NVARCHAR2(40)         DEFAULT NULL,
   TYPE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   FINISH_TIME_         DATE,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TASK_TURN PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_TASK_TURN IS
'任务的执行更改，更改类型。agent=代理；shift=转办；copy_to=抄送';

COMMENT ON COLUMN BPM_TASK_TURN.TASK_ID_ IS
'任务ID';

COMMENT ON COLUMN BPM_TASK_TURN.TASK_NAME_ IS
'任务名称';

COMMENT ON COLUMN BPM_TASK_TURN.TASK_SUBJECT_ IS
'待办事项标题';

COMMENT ON COLUMN BPM_TASK_TURN.NODE_ID_ IS
'关联 - 任务节点ID';

COMMENT ON COLUMN BPM_TASK_TURN.PROC_INST_ID_ IS
'关联 - 流程实例ID';

COMMENT ON COLUMN BPM_TASK_TURN.OWNER_ID_ IS
'任务所属人ID';

COMMENT ON COLUMN BPM_TASK_TURN.OWNER_NAME_ IS
'任务所属人姓名';

COMMENT ON COLUMN BPM_TASK_TURN.ASSIGNEE_ID_ IS
'任务执行人ID';

COMMENT ON COLUMN BPM_TASK_TURN.ASSIGNEE_NAME_ IS
'任务执行人姓名';

COMMENT ON COLUMN BPM_TASK_TURN.STATUS_ IS
'状态。running=正在运行；finish=完成；cancel=取消';

COMMENT ON COLUMN BPM_TASK_TURN.TURN_TYPE_ IS
'更改类型。agent=代理；shift=转办；copy_to=抄送';

COMMENT ON COLUMN BPM_TASK_TURN.TYPE_ID_ IS
'所属分类ID';

CREATE TABLE BPM_TASK_TURNASSIGN 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   TASK_TURN_ID_        NVARCHAR2(64)         DEFAULT NULL,
   FROM_USER_ID_        NVARCHAR2(64)         DEFAULT NULL,
   FROM_USER_           NVARCHAR2(64)         DEFAULT NULL,
   RECEIVER_ID_         NVARCHAR2(64)         DEFAULT NULL,
   RECEIVER             NVARCHAR2(64)         DEFAULT NULL,
   CREATE_TIME_         DATE,
   COMMENT_             NVARCHAR2(1024)       DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TASK_TURNASSIGN PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_TASK_TURNASSIGN IS
'任务指派人员';

COMMENT ON COLUMN BPM_TASK_TURNASSIGN.TASK_TURN_ID_ IS
'转交ID和task_turn表主键关联';

COMMENT ON COLUMN BPM_TASK_TURNASSIGN.FROM_USER_ID_ IS
'任务转交人ID';

COMMENT ON COLUMN BPM_TASK_TURNASSIGN.FROM_USER_ IS
'任务转交人';

COMMENT ON COLUMN BPM_TASK_TURNASSIGN.RECEIVER_ID_ IS
'接收人ID';

COMMENT ON COLUMN BPM_TASK_TURNASSIGN.RECEIVER IS
'接收人';

COMMENT ON COLUMN BPM_TASK_TURNASSIGN.COMMENT_ IS
'备注';

CREATE TABLE BPM_TASK_URGENT 
(
   ID_                  NVARCHAR2(255)        NOT NULL,
   TASK_ID_             NVARCHAR2(255)        DEFAULT NULL,
   NODE_NAME_           NVARCHAR2(255)        DEFAULT NULL,
   INST_ID_             NVARCHAR2(255)        DEFAULT NULL,
   SUBJECT_             NVARCHAR2(255)        DEFAULT NULL,
   CONTENT_             CLOB,
   URGRNT_DATE_         DATE,
   PROMOTER_ID_         NVARCHAR2(255)        DEFAULT NULL,
   PROMOTER_            NVARCHAR2(255)        DEFAULT NULL,
   APPOINTEE_ID_        NVARCHAR2(255)        DEFAULT NULL,
   APPOINTEE_           NVARCHAR2(2000)       DEFAULT NULL,
   TYPE_                NVARCHAR2(255)        DEFAULT NULL,
   APPOINTEE_SECRETARY_CONF_ NVARCHAR2(1024)       DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TASK_URGENT PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_TASK_URGENT IS
'人工催办表';

COMMENT ON COLUMN BPM_TASK_URGENT.TASK_ID_ IS
'任务ID';

COMMENT ON COLUMN BPM_TASK_URGENT.NODE_NAME_ IS
'节点名称';

COMMENT ON COLUMN BPM_TASK_URGENT.INST_ID_ IS
'流程实例ID';

COMMENT ON COLUMN BPM_TASK_URGENT.SUBJECT_ IS
'流程标题';

COMMENT ON COLUMN BPM_TASK_URGENT.CONTENT_ IS
'催办内容';

COMMENT ON COLUMN BPM_TASK_URGENT.PROMOTER_ID_ IS
'催办人ID';

COMMENT ON COLUMN BPM_TASK_URGENT.PROMOTER_ IS
'催办人';

COMMENT ON COLUMN BPM_TASK_URGENT.APPOINTEE_ID_ IS
'被催办人ID';

COMMENT ON COLUMN BPM_TASK_URGENT.APPOINTEE_ IS
'被催办人';

COMMENT ON COLUMN BPM_TASK_URGENT.TYPE_ IS
'催办类型';

COMMENT ON COLUMN BPM_TASK_URGENT.APPOINTEE_SECRETARY_CONF_ IS
'催办的领导和秘书的id关系map，方便秘书回复时确定代哪个领导审批的';

CREATE TABLE BPM_TEST_CASE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(128)        DEFAULT NULL,
   BO_FORM_DATA_        CLOB,
   FLOW_VARS_           NVARCHAR2(2000)       DEFAULT NULL,
   ACTION_TYPE_         NVARCHAR2(2000)       DEFAULT NULL,
   STARTOR_             NVARCHAR2(2000)       DEFAULT NULL,
   BPM_DEBUGGER_        NVARCHAR2(2000)       DEFAULT NULL,
   DEF_KEY_             NVARCHAR2(64)         DEFAULT NULL,
   STARTOR_ACCOUNT_     NVARCHAR2(64)         DEFAULT NULL,
   STARTOR_FULL_NAME_   NVARCHAR2(128)        DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TEST_CASE PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_TEST_CASE IS
'流程仿真测试用例表';

COMMENT ON COLUMN BPM_TEST_CASE.NAME_ IS
'测试用例名称';

COMMENT ON COLUMN BPM_TEST_CASE.BO_FORM_DATA_ IS
'表单数据';

COMMENT ON COLUMN BPM_TEST_CASE.FLOW_VARS_ IS
'流程变量';

COMMENT ON COLUMN BPM_TEST_CASE.ACTION_TYPE_ IS
'审批动作， 默认动作时 agree';

COMMENT ON COLUMN BPM_TEST_CASE.STARTOR_ IS
'发起人jsON';

COMMENT ON COLUMN BPM_TEST_CASE.BPM_DEBUGGER_ IS
'断点测试设置';

COMMENT ON COLUMN BPM_TEST_CASE.DEF_KEY_ IS
'流程定义KEY';

COMMENT ON COLUMN BPM_TEST_CASE.STARTOR_ACCOUNT_ IS
'发起人账号';

COMMENT ON COLUMN BPM_TEST_CASE.STARTOR_FULL_NAME_ IS
'发起人姓名';

CREATE TABLE BPM_TEST_CASE_LOGS 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   OPE_NAME_            NVARCHAR2(128)        DEFAULT NULL,
   EXECUTION_TIME_      DATE                 DEFAULT NULL,
   OPE_CONTENT_         CLOB                 DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(255)        DEFAULT NULL,
   CONSTRAINT PK_BPM_TEST_CASE_LOGS PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_TEST_CASE_LOGS IS
'流程仿真异常日志';

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

COMMENT ON COLUMN BPM_TEST_CASE_LOGS.OPE_NAME_ IS
'操作名称';

COMMENT ON COLUMN BPM_TEST_CASE_LOGS.OPE_CONTENT_ IS
'操作内容';

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

CREATE TABLE BPM_TRANS_RECEIVER 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   TRANS_RECORDID_      NVARCHAR2(64)         DEFAULT NULL,
   RECEIVER_            NVARCHAR2(100)        DEFAULT NULL,
   RECEIVER_ID_         NVARCHAR2(64)         DEFAULT NULL,
   STATUS_              SMALLINT             DEFAULT NULL,
   OPINION_             NVARCHAR2(500)        DEFAULT NULL,
   RECEIVER_TIME_       DATE,
   CHECK_TIME_          DATE,
   CHECK_TYPE_          SMALLINT             DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TRANS_RECEIVER PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_TRANS_RECEIVER IS
'流转任务接收人';

COMMENT ON COLUMN BPM_TRANS_RECEIVER.TRANS_RECORDID_ IS
'流转任务记录ID';

COMMENT ON COLUMN BPM_TRANS_RECEIVER.RECEIVER_ IS
'流转接受人员';

COMMENT ON COLUMN BPM_TRANS_RECEIVER.RECEIVER_ID_ IS
'流转接收人id';

COMMENT ON COLUMN BPM_TRANS_RECEIVER.STATUS_ IS
'状态:0尚未处理1已处理';

COMMENT ON COLUMN BPM_TRANS_RECEIVER.OPINION_ IS
'审核意见';

COMMENT ON COLUMN BPM_TRANS_RECEIVER.CHECK_TYPE_ IS
'审核状态';

CREATE TABLE BPM_TRANS_RECORD 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   TYPE_                NVARCHAR2(20)         DEFAULT NULL,
   TRANSFER_            NVARCHAR2(64)         DEFAULT NULL,
   TRANSFER_NAME_       NVARCHAR2(64)         DEFAULT NULL,
   TRANSFERED_          NVARCHAR2(64)         DEFAULT NULL,
   TRANSFERED_NAME_     NVARCHAR2(64)         DEFAULT NULL,
   REASON_              NVARCHAR2(2000)       DEFAULT NULL,
   CREATE_TIME_         DATE,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE,
   RESULT_              NVARCHAR2(2000)       DEFAULT NULL,
   VAR_                 INTEGER              DEFAULT NULL,
   PROC_INST_IDS_       NVARCHAR2(2000)       DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_TRANS_RECORD PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_TRANS_RECORD IS
'移交记录';

COMMENT ON COLUMN BPM_TRANS_RECORD.TYPE_ IS
'移交类型';

COMMENT ON COLUMN BPM_TRANS_RECORD.TRANSFER_ IS
'移交人ID';

COMMENT ON COLUMN BPM_TRANS_RECORD.TRANSFER_NAME_ IS
'移交人姓名';

COMMENT ON COLUMN BPM_TRANS_RECORD.TRANSFERED_NAME_ IS
'被移交人姓名';

COMMENT ON COLUMN BPM_TRANS_RECORD.REASON_ IS
'移交原因';

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

COMMENT ON COLUMN BPM_TRANS_RECORD.RESULT_ IS
'移交结果';

COMMENT ON COLUMN BPM_TRANS_RECORD.VAR_ IS
'移交方式';

COMMENT ON COLUMN BPM_TRANS_RECORD.PROC_INST_IDS_ IS
'流程实例ID';

CREATE TABLE BPM_WATERMARK 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   NAME_                NVARCHAR2(128)        DEFAULT NULL,
   CONTENT_             CLOB,
   TYPE_                SMALLINT             DEFAULT NULL,
   COLOR_               NVARCHAR2(32)         DEFAULT NULL,
   AMOUNT_              INTEGER              DEFAULT NULL,
   CREATE_TIME_         DATE                 DEFAULT NULL,
   CREATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   UPDATE_TIME_         DATE                 DEFAULT NULL,
   UPDATE_BY_           NVARCHAR2(64)         DEFAULT NULL,
   CREATE_ORG_ID_       NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_WATERMARK PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_WATERMARK IS
'流程水印';

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

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

COMMENT ON COLUMN BPM_WATERMARK.CONTENT_ IS
'内容';

COMMENT ON COLUMN BPM_WATERMARK.TYPE_ IS
'类型 1文字 2图片';

COMMENT ON COLUMN BPM_WATERMARK.COLOR_ IS
'颜色 透明度';

COMMENT ON COLUMN BPM_WATERMARK.AMOUNT_ IS
'页面展示数量';

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

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

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

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

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

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

CREATE TABLE BPM_WATERMARK_PROCESS 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   PROC_DEF_ID_         NVARCHAR2(64)         DEFAULT NULL,
   PROC_DEF_KEY_        NVARCHAR2(128)        DEFAULT NULL,
   PROC_DEF_NAME_       NVARCHAR2(128)        DEFAULT NULL,
   WATERMARK_ID_        NVARCHAR2(64)         DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_WATERMARK_PROCESS PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_WATERMARK_PROCESS IS
'水印分配流程';

COMMENT ON COLUMN BPM_WATERMARK_PROCESS.ID_ IS
'ID';

COMMENT ON COLUMN BPM_WATERMARK_PROCESS.PROC_DEF_ID_ IS
'流程ID';

COMMENT ON COLUMN BPM_WATERMARK_PROCESS.PROC_DEF_KEY_ IS
'流程KEY';

COMMENT ON COLUMN BPM_WATERMARK_PROCESS.PROC_DEF_NAME_ IS
'流程名称';

COMMENT ON COLUMN BPM_WATERMARK_PROCESS.WATERMARK_ID_ IS
'水印ID';

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

CREATE TABLE BPM_WATERMARK_TYPE 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   TYPE_ID_             NVARCHAR2(64)         DEFAULT NULL,
   WATERMARK_ID_        NVARCHAR2(64)         DEFAULT NULL,
   TYPE_NAME_           NVARCHAR2(256)        DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   CONSTRAINT PK_BPM_WATERMARK_TYPE PRIMARY KEY (ID_)
);

COMMENT ON TABLE BPM_WATERMARK_TYPE IS
'水印分配分类';

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

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

COMMENT ON COLUMN BPM_WATERMARK_TYPE.WATERMARK_ID_ IS
'水印ID';

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

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

create table BPM_FREE_PROCESS_DEF
(
    ID_            	NVARCHAR2(64) NOT NULL,
    SOURCE_DEF_ID_ 	NVARCHAR2(64),
    PROC_INST_ID_  	NVARCHAR2(255),
    BPMN_XML_      	CLOB,
    TENANT_ID_     	NVARCHAR2(255),
		PRIMARY KEY (ID_)
);
comment on table BPM_FREE_PROCESS_DEF is '自由流程定义备份表';
comment on column BPM_FREE_PROCESS_DEF.ID_ is '新流程定义ID';
comment on column BPM_FREE_PROCESS_DEF.SOURCE_DEF_ID_ is '原流程定义ID';
comment on column BPM_FREE_PROCESS_DEF.PROC_INST_ID_ is '实例ID';
comment on column BPM_FREE_PROCESS_DEF.BPMN_XML_ is 'XML';
comment on column BPM_FREE_PROCESS_DEF.TENANT_ID_ is '租户ID';

create table BPM_SERVICE_LOG(
    ID_           	NVARCHAR2(64) NOT NULL,
    SUBJECT_      	NVARCHAR2(600),
    PROC_DEF_ID_  	NVARCHAR2(64),
    PROC_INST_ID_ 	NVARCHAR2(64),
    NODE_ID_      	NVARCHAR2(64),
    STATUS_       	INT,
    CREATE_TIME_  	DATE,
    TENANT_ID_    	NVARCHAR2(64),
		PRIMARY KEY (ID_)
);
comment on table BPM_SERVICE_LOG is '服务节点执行日志';
comment on column BPM_SERVICE_LOG.SUBJECT_ is '流程标题';
comment on column BPM_SERVICE_LOG.PROC_DEF_ID_ is '流程定义ID';
comment on column BPM_SERVICE_LOG.PROC_INST_ID_ is '流程实例ID';
comment on column BPM_SERVICE_LOG.NODE_ID_ is '节点ID';
comment on column BPM_SERVICE_LOG.STATUS_ is '处理结果：1.处理成功  0.处理失败';
comment on column BPM_SERVICE_LOG.TENANT_ID_ is '租户ID';


create table BPM_DOCUMENTATION_CONFIG
(
    ID_             NVARCHAR2(255)  NOT NULL,
    DATA_KEY_       NVARCHAR2(255),
    AUTORUN_        NVARCHAR2(10),
    AUTORUN_CONFIG_ NVARCHAR2(255),
    DELETE_DATA_    NVARCHAR2(10),
    LIMIT_          NVARCHAR2(10),
    LIMIT_NUMBER_   NVARCHAR2(255),
    UPDATE_BY_      NVARCHAR2(255),
    UPDATE_TIME_    DATE,
    BEFORE_MONTH_   NVARCHAR2(255),
    JOB_NAME_       NVARCHAR2(255),
    TENANT_ID_      NVARCHAR2(255),
				PRIMARY KEY (ID_)
);
comment on table BPM_DOCUMENTATION_CONFIG is '数据归档配置表';
comment on column BPM_DOCUMENTATION_CONFIG.DATA_KEY_ is '数据源key';
comment on column BPM_DOCUMENTATION_CONFIG.AUTORUN_ is '是否自动执行';
comment on column BPM_DOCUMENTATION_CONFIG.AUTORUN_CONFIG_ is '自动执行配置';
comment on column BPM_DOCUMENTATION_CONFIG.DELETE_DATA_ is '是否删除数据';
comment on column BPM_DOCUMENTATION_CONFIG.LIMIT_ is '是否限制数据';
comment on column BPM_DOCUMENTATION_CONFIG.LIMIT_NUMBER_ is '限制数量';
comment on column BPM_DOCUMENTATION_CONFIG.UPDATE_BY_ is '修改人';
comment on column BPM_DOCUMENTATION_CONFIG.UPDATE_TIME_ is '修改时间';
comment on column BPM_DOCUMENTATION_CONFIG.BEFORE_MONTH_ is '同步时间';
comment on column BPM_DOCUMENTATION_CONFIG.JOB_NAME_ is '定时任务名称';
comment on column BPM_DOCUMENTATION_CONFIG.TENANT_ID_ is '租户ID';

create table BPM_DOCUMENTATION_ERROR_LOG
(
    ID_         NVARCHAR2(255) NOT NULL,
    TABLE_NAME_ NVARCHAR2(255),
    DATA_ID_    NVARCHAR2(255),
    DATA_       NVARCHAR2(1000),
    REASON_     CLOB,
    TABLE_ID_   NVARCHAR2(255),
    TIME_       date,
    TENANT_ID_  NVARCHAR2(255),
		PRIMARY KEY (ID_)
);
comment on table BPM_DOCUMENTATION_ERROR_LOG is '同步错误日志表';
comment on column BPM_DOCUMENTATION_ERROR_LOG.TABLE_NAME_ is '表名';
comment on column BPM_DOCUMENTATION_ERROR_LOG.DATA_ID_ is '数据ID';
comment on column BPM_DOCUMENTATION_ERROR_LOG.DATA_ is '数据';
comment on column BPM_DOCUMENTATION_ERROR_LOG.REASON_ is '失败原因';
comment on column BPM_DOCUMENTATION_ERROR_LOG.TABLE_ID_ is '数据表ID';
comment on column BPM_DOCUMENTATION_ERROR_LOG.TIME_ is '时间';
comment on column BPM_DOCUMENTATION_ERROR_LOG.TENANT_ID_ is '租户ID';

create table BPM_DOCUMENTATION_TABLE
(
    ID_           NVARCHAR2(255) NOT NULL,
    TABLE_NAME_   NVARCHAR2(255),
    DML_          CLOB,
    DDL_          CLOB,
    SYSTEM_       NVARCHAR2(10),
    START_        NVARCHAR2(255),
    INFO_         NVARCHAR2(255),
    ORDER_        NVARCHAR2(255),
    UPDATE_BY_    NVARCHAR2(64),
    PARENT_FIELD_ NVARCHAR2(255),
    FIELD_        NVARCHAR2(255),
    TIME_KEY_     NVARCHAR2(255),
    PARENT_ID_    NVARCHAR2(255),
    UPDATE_TIME_  DATE,
    TENANT_ID_    NVARCHAR2(255),
		PRIMARY KEY (ID_)
);
comment on table BPM_DOCUMENTATION_TABLE is '同步数据目标表';
comment on column BPM_DOCUMENTATION_TABLE.TABLE_NAME_ is '表名';
comment on column BPM_DOCUMENTATION_TABLE.DML_ is '表查询语句';
comment on column BPM_DOCUMENTATION_TABLE.DDL_ is '表定义语句';
comment on column BPM_DOCUMENTATION_TABLE.SYSTEM_ is '是否系统默认表';
comment on column BPM_DOCUMENTATION_TABLE.START_ is '是否启动';
comment on column BPM_DOCUMENTATION_TABLE.INFO_ is '说明';
comment on column BPM_DOCUMENTATION_TABLE.ORDER_ is '同步顺序';
comment on column BPM_DOCUMENTATION_TABLE.UPDATE_BY_ is '创建人';
comment on column BPM_DOCUMENTATION_TABLE.PARENT_FIELD_ is '主表字段';
comment on column BPM_DOCUMENTATION_TABLE.FIELD_ is '子表字段';
comment on column BPM_DOCUMENTATION_TABLE.TIME_KEY_ is '同步表时间字段';
comment on column BPM_DOCUMENTATION_TABLE.PARENT_ID_ is '父表ID';
comment on column BPM_DOCUMENTATION_TABLE.UPDATE_TIME_ is '创建时间';
comment on column BPM_DOCUMENTATION_TABLE.TENANT_ID_ is '租户';

create table BPM_SHOW_RECORD(
    ID_            VARCHAR(32)	 not null ,
    ACCOUNT_       VARCHAR(32)	 not null,
    FULL_NAME_     VARCHAR(32)	 not null,
    SHOW_TIME_     DATE       	 not null,
    TASK_ID_       VARCHAR(32),
    ACTION_        VARCHAR(32),
    SHOW_TYPE_     VARCHAR(20),
    REASONS_       CLOB       	 not null,
    CREATE_BY_     VARCHAR(32),
    CREATE_TIME_   DATE,
    CREATE_ORG_ID_ VARCHAR(32),
    UPDATE_BY_     VARCHAR(32),
    UPDATE_TIME_   DATE,
    TENANT_ID_     VARCHAR(32),
		PRIMARY KEY(ID_)
);
comment on table BPM_SHOW_RECORD is '流程实例和流程任务查阅记录';
comment on column BPM_SHOW_RECORD.ID_ is '主键ID';
comment on column BPM_SHOW_RECORD.ACCOUNT_ is '查阅人账号';
comment on column BPM_SHOW_RECORD.FULL_NAME_ is '查阅人名称';
comment on column BPM_SHOW_RECORD.SHOW_TIME_ is '查阅时间';
comment on column BPM_SHOW_RECORD.TASK_ID_ is '流程实例ID或任务ID';
comment on column BPM_SHOW_RECORD.ACTION_ is '流程定义中的动作：发布新版本/保存';
comment on column BPM_SHOW_RECORD.SHOW_TYPE_ is '展示类型：实例/任务/流程定义';
comment on column BPM_SHOW_RECORD.REASONS_ is '查阅原因';
comment on column BPM_SHOW_RECORD.CREATE_BY_ is '创建人';
comment on column BPM_SHOW_RECORD.CREATE_TIME_ is '创建时间';
comment on column BPM_SHOW_RECORD.UPDATE_BY_ is '更新人';
comment on column BPM_SHOW_RECORD.UPDATE_TIME_ is '更新时间';
comment on column BPM_SHOW_RECORD.TENANT_ID_ is '租户ID';

create table BPM_PRO_PUBLICITY_READ
(
    ID_  VARCHAR(64) 	not null ,
    PROC_INST_ID_ 	VARCHAR(64),
    USER_ID_      	VARCHAR(64),
    TENANT_ID_    	VARCHAR(64),
		PRIMARY KEY(ID_)
);
comment on table BPM_PRO_PUBLICITY_READ is '流程公示阅读记录';
comment on column BPM_PRO_PUBLICITY_READ.PROC_INST_ID_ is '实例ID';
comment on column BPM_PRO_PUBLICITY_READ.USER_ID_ is '用户ID';


CREATE TABLE BPM_AUTO_START_CONF 
(
   ID_                  NVARCHAR2(64)         NOT NULL,
   DEF_KEY_             NVARCHAR2(64)         DEFAULT NULL,
   START_USER_          CLOB                 DEFAULT NULL,
   FORM_DATA_           CLOB                 DEFAULT NULL,
   TRIGGER_             NVARCHAR2(512)        DEFAULT NULL,
   TENANT_ID_           NVARCHAR2(64)         DEFAULT NULL,
   TRIGGER_NAME_        NVARCHAR2(100)        DEFAULT NULL,
   CONSTRAINT PK_BPM_AUTO_START_CONF PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_AUTO_START_CONF IS '流程自动发起配置表';
COMMENT ON COLUMN BPM_AUTO_START_CONF.ID_ IS 'ID';
COMMENT ON COLUMN BPM_AUTO_START_CONF.DEF_KEY_ IS '流程定义KEY';
COMMENT ON COLUMN BPM_AUTO_START_CONF.START_USER_ IS '启动用户';
COMMENT ON COLUMN BPM_AUTO_START_CONF.FORM_DATA_ IS '表单数据';
COMMENT ON COLUMN BPM_AUTO_START_CONF.TRIGGER_ IS '触发器';
COMMENT ON COLUMN BPM_AUTO_START_CONF.TENANT_ID_ IS '租户id';
COMMENT ON COLUMN BPM_AUTO_START_CONF.TRIGGER_NAME_ IS '触发器KEY';

create table BPM_BLOOM
(
    ID_           NVARCHAR2(64) not null  constraint BPM_BLOOM_PK  primary key,
    BLOOM_BYTES_  clob,
    CODE_         NVARCHAR2(255)
);
comment on table BPM_BLOOM is '布隆过滤器数据表';
comment on column BPM_BLOOM.ID_ is '主键';
comment on column BPM_BLOOM.BLOOM_BYTES_ is '布隆过滤器的数据';
comment on column BPM_BLOOM.CODE_ is '编码，做唯一记录识别';

CREATE TABLE BPM_CHECK_RECORD(
    ID_             NVARCHAR2(64)   NOT NULL,
    TENANT_ID_      NVARCHAR2(64),
    CREATE_TIME_    DATE,
    UPDATE_TIME_    DATE,
    CREATE_BY_      NVARCHAR2(64),
    TASK_ID_        NVARCHAR2(64),
    INST_ID_        NVARCHAR2(64),
    CREATE_ORG_ID_  NVARCHAR2(64),
    UPDATE_BY_      NVARCHAR2(64),
	PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_CHECK_RECORD IS '任务阅读记录';
COMMENT ON COLUMN BPM_CHECK_RECORD.TENANT_ID_ IS '租户ID';
COMMENT ON COLUMN BPM_CHECK_RECORD.CREATE_TIME_ IS '创建时间';
COMMENT ON COLUMN BPM_CHECK_RECORD.UPDATE_TIME_ IS '更新时间';
COMMENT ON COLUMN BPM_CHECK_RECORD.CREATE_BY_ IS '创建人';
COMMENT ON COLUMN BPM_CHECK_RECORD.TASK_ID_ IS '任务ID';
COMMENT ON COLUMN BPM_CHECK_RECORD.INST_ID_ IS '实例ID';


CREATE TABLE BPM_MOBILE_CATEGORY
(
    ID_          NVARCHAR2(64) not null  cONstraint BPM_MOBILE_CATEGORY_PK primary KEY,
    DEF_KEY_     NVARCHAR2(64),
    TYPE_ID_     NVARCHAR2(64),
    CREATE_TIME_ DATE,
    UPDATE_TIME_ DATE,
    TENANT_ID_   NVARCHAR2(64),
    TYPE_KEY_    NVARCHAR2(64),
    CREATOR_     NVARCHAR2(64),
    DEF_NAME_    NVARCHAR2(255)
);
comment ON TABLE BPM_MOBILE_CATEGORY is '移动端流程分类表';
comment ON column BPM_MOBILE_CATEGORY.ID_ is '主键';
comment ON column BPM_MOBILE_CATEGORY.DEF_KEY_ is '流程定义KEY';
comment ON column BPM_MOBILE_CATEGORY.TYPE_ID_ is '分类ID';
comment ON column BPM_MOBILE_CATEGORY.CREATE_TIME_ is '创建时间';
comment ON column BPM_MOBILE_CATEGORY.UPDATE_TIME_ is '更新时间';
comment ON column BPM_MOBILE_CATEGORY.TENANT_ID_ is '租户ID';
comment ON column BPM_MOBILE_CATEGORY.TYPE_KEY_ is '分类KEY';
comment ON column BPM_MOBILE_CATEGORY.CREATOR_ is '创建人';
comment ON column BPM_MOBILE_CATEGORY.DEF_NAME_ is '流程定义名称';


CREATE TABLE BPM_FLOW_COLLECT
(
    ID_           NVARCHAR2(64) not null cONstraint BPM_FLOW_COLLECT_PK primary KEY,
    DEF_KEY_      NVARCHAR2(64),
    CREATOR_      NVARCHAR2(64),
    CREATE_TIME_  DATE,
    TENANT_ID_    NVARCHAR2(64)
) ;
comment ON TABLE BPM_FLOW_COLLECT is '流程收藏表';
comment ON column BPM_FLOW_COLLECT.ID_ is '主键';
comment ON column BPM_FLOW_COLLECT.DEF_KEY_ is '流程定义KEY';
comment ON column BPM_FLOW_COLLECT.CREATOR_ is '创建人';
comment ON column BPM_FLOW_COLLECT.CREATE_TIME_ is '创建时间';
comment ON column BPM_FLOW_COLLECT.TENANT_ID_ is '租户ID';


CREATE TABLE BPM_EXTEND_JAR 
(
      ID_               NVARCHAR2(64)      NOT NULL,
      NAME_             NVARCHAR2(255)     DEFAULT NULL ,
      DESC_             NVARCHAR2(255)     DEFAULT NULL ,
      JAR_FILE_         NVARCHAR2(2000)    DEFAULT NULL ,
      JAR_BYTES_ blob   NULL ,
      CREATE_BY_        NVARCHAR2(255)     DEFAULT NULL ,
      CREATE_NAME_      NVARCHAR2(255)     DEFAULT NULL ,
      UPDATE_BY_        NVARCHAR2(255)     DEFAULT NULL ,
      UPDATE_NAME_      NVARCHAR2(255)     DEFAULT NULL ,
      CREATE_TIME_      timestamp(0)      DEFAULT NULL NULL ,
      UPDATE_TIME_      timestamp(0)      DEFAULT NULL NULL ,
      SIZE_             number(10)        DEFAULT NULL NULL ,
      STATUS_           number(10)        DEFAULT NULL NULL ,
      TYPE_             INT DEFAULT 0,
      PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_EXTEND_JAR IS '扩展jar包管理表';
COMMENT ON COLUMN BPM_EXTEND_JAR.TYPE_ IS 'jar包类型。0：script脚本扩展，1：用户数据同步';

CREATE TABLE BPM_EXTEND_CLASS  
(
      ID_               NVARCHAR2(64)      NOT NULL,
      JAR_ID_           NVARCHAR2(64)      DEFAULT NULL ,
      SIMPLE_NAME_      NVARCHAR2(255)     DEFAULT NULL ,
      PATH_             NVARCHAR2(500)     DEFAULT NULL ,
      DESC_             NVARCHAR2(255)     DEFAULT NULL ,
      MD5_              NVARCHAR2(255)     DEFAULT NULL ,
      TYPE_             NVARCHAR2(1)       DEFAULT NULL ,
      PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_EXTEND_CLASS IS '已发布扩展脚本管理表';

CREATE TABLE BPM_INST_DELETE_LOG 
(
      ID_                NVARCHAR2(64)      DEFAULT NULL,
      FULLNAME_          NVARCHAR2(255)     DEFAULT NULL ,
      ACCOUNT_           NVARCHAR2(255)     DEFAULT NULL ,
      DELETE_TIME_       timestamp(0)       DEFAULT NULL ,
      INST_SUBJECT_      NVARCHAR2(128)     DEFAULT NULL ,
      CONTENT_           NVARCHAR2(550)     DEFAULT NULL ,
      PRIMARY KEY (ID_)
);
COMMENT ON TABLE BPM_INST_DELETE_LOG IS '流程实例删除日志';


CREATE TABLE BPM_FLOW_DEFAULT_BUTTON
(
    ID_                          NVARCHAR2(64)      NOT NULL,
    NAME_                        NVARCHAR2(64)      NOT NULL,
    ALIAS_                       NVARCHAR2(64)      NOT NULL,
    BEFORESCRIPT_                CLOB,
    AFTERSCRIPT_                 CLOB,
    GROOVYSCRIPT_                CLOB,
    COMPLETEEVENTGROOVYSCRIPT_   CLOB,
    REJECTMODE_                  NVARCHAR2(64),
    REJECTNODE_                  NVARCHAR2(64),
    ISLOCK_                      NUMBER,
    SUPPORTSCRIPT_               NUMBER,
    MSGCONFIG_                   NVARCHAR2(255),
    TYPE_                        NVARCHAR2(64),
    DISABLED_                    NUMBER,
    cONstraint BPM_FLOW_DEFAULT_BUTTON_pk PRIMARY KEY (ID_)
);
comment ON column BPM_FLOW_DEFAULT_BUTTON.ID_ is '主键';
comment ON column BPM_FLOW_DEFAULT_BUTTON.NAME_ is '按钮名称';
comment ON column BPM_FLOW_DEFAULT_BUTTON.ALIAS_ is '按钮别名';
comment ON column BPM_FLOW_DEFAULT_BUTTON.BEFORESCRIPT_ is '前置脚本';
comment ON column BPM_FLOW_DEFAULT_BUTTON.AFTERSCRIPT_ is '后置脚本';
comment ON column BPM_FLOW_DEFAULT_BUTTON.GROOVYSCRIPT_ is '后台java脚本';
comment ON column BPM_FLOW_DEFAULT_BUTTON.COMPLETEEVENTGROOVYSCRIPT_ is '后台完成任务后执行的java脚本';
comment ON column BPM_FLOW_DEFAULT_BUTTON.REJECTMODE_ is '驳回模式 reject 驳回指定节点  rejectPre 驳回上一步   backToStart 驳回发起人';
comment ON column BPM_FLOW_DEFAULT_BUTTON.REJECTNODE_ is '指定驳回的节点';
comment ON column BPM_FLOW_DEFAULT_BUTTON.SUPPORTSCRIPT_ is '是否支持脚本';
comment ON column BPM_FLOW_DEFAULT_BUTTON.MSGCONFIG_ is '按钮消息配置';
comment ON column BPM_FLOW_DEFAULT_BUTTON.TYPE_ is '按钮节点类型';
comment ON column BPM_FLOW_DEFAULT_BUTTON.DISABLED_ is '启用或者禁用';
comment ON TABLE BPM_FLOW_DEFAULT_BUTTON is '流程默认按钮表';


create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_);
create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_);
create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_);
create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_);
create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_);
create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_);
create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_);
create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_);
create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_);
create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_);
create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_);
create index ACT_IDX_HI_PROCVAR_TASK_ID on ACT_HI_VARINST(TASK_ID_);
create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_);
create index ACT_IDX_HI_IDENT_LNK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_);
create index ACT_IDX_HI_IDENT_LNK_PROCINST on ACT_HI_IDENTITYLINK(PROC_INST_ID_);
create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_);
create index ACT_IDX_HI_ACT_INST_EXEC on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_);
create index ACT_IDX_HI_TASK_INST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_);
create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_);
create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_);
create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_);
create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_);
create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_);
create index ACT_IDX_TASK_PARENTID on ACT_RU_TASK(PARENT_TASK_ID_);
create index ACT_IDX_BYTEAR_DEPL on ACT_GE_BYTEARRAY(DEPLOYMENT_ID_);
alter table ACT_GE_BYTEARRAY add constraint ACT_FK_BYTEARR_DEPL foreign key (DEPLOYMENT_ID_)  references ACT_RE_DEPLOYMENT (ID_);
alter table ACT_RE_PROCDEF  add constraint ACT_UNIQ_PROCDEF unique (KEY_,VERSION_, TENANT_ID_);    
create index ACT_IDX_EXE_PROCDEF on ACT_RU_EXECUTION(PROC_DEF_ID_);
alter table ACT_RU_EXECUTION  add constraint ACT_FK_EXE_PROCDEF   foreign key (PROC_DEF_ID_)  references ACT_RE_PROCDEF (ID_);    
create index ACT_IDX_IDL_PROCINST on ACT_RU_IDENTITYLINK(PROC_INST_ID_);
alter table ACT_RU_IDENTITYLINK  add constraint ACT_FK_IDL_PROCINST foreign key (PROC_INST_ID_)  references ACT_RU_EXECUTION (ID_);    
create index ACT_IDX_TASK_EXEC on ACT_RU_TASK(EXECUTION_ID_);
ALTER TABLE ACT_RU_TASK ADD CONSTRAINT ACT_FK_TASK_EXE FOREIGN KEY (EXECUTION_ID_) REFERENCES ACT_RU_EXECUTION (ID_) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
create index ACT_IDX_VAR_EXE on ACT_RU_VARIABLE(EXECUTION_ID_);
alter table ACT_RU_VARIABLE  add constraint ACT_FK_VAR_EXE foreign key (EXECUTION_ID_) references ACT_RU_EXECUTION (ID_);
create index ACT_IDX_VAR_PROCINST on ACT_RU_VARIABLE(PROC_INST_ID_);
alter table ACT_RU_VARIABLE add constraint ACT_FK_VAR_PROCINST foreign key (PROC_INST_ID_) references ACT_RU_EXECUTION(ID_);
create index ACT_IDX_VAR_BYTEARRAY on ACT_RU_VARIABLE(BYTEARRAY_ID_);
alter table ACT_RU_VARIABLE  add constraint ACT_FK_VAR_BYTEARRAY  foreign key (BYTEARRAY_ID_) references ACT_GE_BYTEARRAY (ID_);
create index ACT_IDX_JOB_EXCEPTION on ACT_RU_JOB(EXCEPTION_STACK_ID_);
alter table ACT_RU_JOB  add constraint ACT_FK_JOB_EXCEPTION foreign key (EXCEPTION_STACK_ID_) references ACT_GE_BYTEARRAY (ID_);
create index ACT_IDX_EVENT_SUBSCR on ACT_RU_EVENT_SUBSCR(EXECUTION_ID_);
alter table ACT_RU_EVENT_SUBSCR add constraint ACT_FK_EVENT_EXEC foreign key (EXECUTION_ID_) references ACT_RU_EXECUTION(ID_);
create index ACT_IDX_MODEL_SOURCE on ACT_RE_MODEL(EDITOR_SOURCE_VALUE_ID_);
alter table ACT_RE_MODEL add constraint ACT_FK_MODEL_SOURCE foreign key (EDITOR_SOURCE_VALUE_ID_) references ACT_GE_BYTEARRAY (ID_);
create index ACT_IDX_MODEL_SOURCE_EXTRA on ACT_RE_MODEL(EDITOR_SOURCE_EXTRA_VALUE_ID_);
alter table ACT_RE_MODEL add constraint ACT_FK_MODEL_SOURCE_EXTRA foreign key (EDITOR_SOURCE_EXTRA_VALUE_ID_) references ACT_GE_BYTEARRAY (ID_);
create index ACT_IDX_MODEL_DEPLOYMENT on ACT_RE_MODEL(DEPLOYMENT_ID_);    
alter table ACT_RE_MODEL add constraint ACT_FK_MODEL_DEPLOYMENT foreign key (DEPLOYMENT_ID_) references ACT_RE_DEPLOYMENT (ID_);        
create index ACT_IDX_PROCDEF_INFO_JSON on ACT_PROCDEF_INFO(INFO_JSON_ID_);
alter table ACT_PROCDEF_INFO add constraint ACT_FK_INFO_JSON_BA foreign key (INFO_JSON_ID_)  references ACT_GE_BYTEARRAY (ID_);
create index ACT_IDX_PROCDEF_INFO_PROC on ACT_PROCDEF_INFO(PROC_DEF_ID_);
alter table ACT_PROCDEF_INFO add constraint ACT_FK_INFO_PROCDEF foreign key (PROC_DEF_ID_) references ACT_RE_PROCDEF (ID_);  
alter table ACT_PROCDEF_INFO add constraint ACT_UNIQ_INFO_PROCDEF unique (PROC_DEF_ID_);
CREATE INDEX ACT_IDX_EVENT_PROCINSTID ON ACT_RU_EVENT_SUBSCR (PROC_INST_ID_);
CREATE INDEX ACT_IDX_RUEXECUTION_PROCINSTID ON ACT_RU_EXECUTION (PROC_INST_ID_);  
CREATE INDEX ACR_IDX_RUEXECUTION_PARENTID ON ACT_RU_EXECUTION (PARENT_ID_);
CREATE INDEX ACT_IDX_RUTASK_PROCINSTID ON ACT_RU_TASK (PROC_INST_ID_);
DROP INDEX ACT_IDX_IDENT_LNK_USER;
DROP INDEX ACT_IDX_IDL_PROCINST;
CREATE INDEX ACT_IDX_IDENT_LNK_TASK_ID ON ACT_RU_IDENTITYLINK(TASK_ID_);
ALTER TABLE ACT_RU_VARIABLE DROP CONSTRAINT ACT_FK_VAR_PROCINST;
ALTER TABLE ACT_RU_VARIABLE ADD CONSTRAINT ACT_FK_VAR_PROCINST FOREIGN KEY (PROC_INST_ID_) REFERENCES ACT_RU_EXECUTION (ID_) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
CREATE INDEX IDX_BUSLINK_INSTID ON BPM_BUS_LINK (PROC_INST_ID_);
CREATE INDEX IDX_OPINION_AUDITOR ON BPM_CHECK_OPINION (AUDITOR_);
CREATE INDEX IDX_OPINION_INSTID ON BPM_CHECK_OPINION (PROC_INST_ID_);
CREATE INDEX IDX_OPINION_TASK ON BPM_CHECK_OPINION (TASK_ID_);
CREATE INDEX IDX_CHECKOPINION_SUPINSTID ON BPM_CHECK_OPINION (SUP_INST_ID_);
CREATE INDEX IDX_CPTORECEIVER_CPTOID ON BPM_CPTO_RECEIVER (CPTO_ID_);
CREATE INDEX IDX_CUSTOM_SIGN_PARENTID ON BPM_CUSTOM_SIGNDATA (PARENT_ID_);
CREATE INDEX IDX_CUSTOM_SIGN_TYPE ON BPM_CUSTOM_SIGNDATA (TYPE_);
CREATE INDEX IDX_AUTHDEF_AUTHID ON BPM_DEF_ACT (AUTHORIZE_ID_);
CREATE INDEX IDX_AUTHTYPE_AUTHID ON BPM_DEF_AUTH_TYPE (AUTHORIZE_ID_);
CREATE INDEX IDX_DEFUSER_AUTHID ON BPM_DEF_USER (AUTHORIZE_ID_);
CREATE INDEX IDX_EXESTACK_INSTID ON BPM_EXE_STACK (PROC_INST_ID_);
CREATE INDEX IDX_STACKEXECUTOR_STACKID ON BPM_EXE_STACK_EXECUTOR (STACK_ID_);
CREATE INDEX IDX_STACKEXECUTOR_TASKID ON BPM_EXE_STACK_EXECUTOR (TASK_ID_);
CREATE INDEX IDX_EXESTACKHIS_INSTID ON BPM_EXE_STACK_HIS (PROC_INST_ID_);
CREATE INDEX IDX_STACKREL_FROMSTACK ON BPM_EXE_STACK_RELATION (FROM_STACK_ID_);
CREATE INDEX IDX_STACKREL_INSTID ON BPM_EXE_STACK_RELATION (PROC_INST_ID_);
CREATE INDEX IDX_STACKREL_TOSTACK ON BPM_EXE_STACK_RELATION (TO_STACK_ID_);
CREATE INDEX IDX_STACKRELHIS_FROMSTACK ON BPM_EXE_STACK_RELATION_HIS (FROM_STACK_ID_);
CREATE INDEX IDX_STACKRELHIS_INSTID ON BPM_EXE_STACK_RELATION_HIS (PROC_INST_ID_);
CREATE INDEX IDX_STACKRELHIS_TOSTACK ON BPM_EXE_STACK_RELATION_HIS (TO_STACK_ID_);
CREATE INDEX IDX_INST_FORM_INSTID ON BPM_INST_FORM (INST_ID_);
CREATE INDEX IDX_INTERPOSE_INSTID ON BPM_INTERPOSE_RECORED (PROC_INST_ID_);
CREATE INDEX IDX_INTERPOSE_TASK ON BPM_INTERPOSE_RECORED (TASK_ID_);
CREATE INDEX IDX_MR_MEETINGROOM ON BPM_MEETINGROOM_APPOINTMENT (MEETINGROOM_ID_);
CREATE INDEX IDX_MR_PROINSTANCE ON BPM_MEETINGROOM_APPOINTMENT (MEETING_ID_);
CREATE INDEX IDX_PROCPTO_INSTID ON BPM_PRO_CPTO (INST_ID_);
CREATE INDEX IDX_PROCPTO_START ON BPM_PRO_CPTO (STARTOR_ID_);
CREATE INDEX IDX_PROINSTHI_BIZKEY ON BPM_PRO_INST_HI (BIZ_KEY_);
CREATE INDEX IDX_PROINSTHI_BPMINSTID ON BPM_PRO_INST_HI (BPMN_INST_ID_);
CREATE INDEX IDX_PROINSTHI_PARENTID ON BPM_PRO_INST_HI (PARENT_INST_ID_);
CREATE INDEX IDX_PROSTATUS_INSTID ON BPM_PRO_STATUS (PROC_INST_ID_);
CREATE INDEX IDX_PROSTATUSHI_INSTID ON BPM_PRO_STATUS_HI (PROC_INST_ID_);
CREATE INDEX IDX_BPM_TASK_TASKID ON BPM_TASK (TASK_ID_);
CREATE INDEX IDX_TASKCANDIDATE_TASKID ON BPM_TASK_CANDIDATE (TASK_ID_);
CREATE INDEX IDX_BPM_TASK_PARENTID ON BPM_TASK(PARENT_ID_);
CREATE INDEX IDX_DUETIME_TASKID ON BPM_TASK_DUE_TIME (TASK_ID_);
CREATE INDEX IDX_BPMTASK_INSTID ON BPM_TASK_NOTICE (PROC_INST_ID_);
CREATE INDEX IDX_BPMTASK_PARENTID ON BPM_TASK_NOTICE (PARENT_ID_);
CREATE INDEX IDX_BPMTASK_TASKID ON BPM_TASK_NOTICE (TASK_ID_);
CREATE INDEX IDX_BPMTASK_USERID ON BPM_TASK_NOTICE (ASSIGNEE_ID_);
CREATE INDEX IDX_TND_INSTID ON BPM_TASK_NOTICE_DONE (PROC_INST_ID_);
CREATE INDEX IDX_OPINION_SUPINSTID ON BPM_TASK_NOTICE_DONE (SUP_INST_ID_);
CREATE INDEX IDX_NOTICE_TASK ON BPM_TASK_NOTICE_DONE (TASK_ID_);
CREATE INDEX IDX_TASKTURN_TASKID ON BPM_TASK_TURN (TASK_ID_);
CREATE INDEX IDX_BPM_TASK_INSTID ON BPM_TASK (PROC_INST_ID_);
CREATE INDEX IDX_BPM_TASK_STATUS ON BPM_TASK (STATUS_);
CREATE INDEX IDX_REMINDER_TASKID ON BPM_REMINDER_HISTORY (TASK_ID_);
CREATE INDEX IDX_BUSLINK_BUSINESSKEY ON BPM_BUS_LINK (BUSINESSKEY_STR_);
CREATE UNIQUE INDEX IDX_PRO_INST_BPMNINSTID ON BPM_PRO_INST (BPMN_INST_ID_);
CREATE INDEX IDX_AGENT_SETTINGID ON BPM_AGENT_CONDITION (SETTING_ID_);
CREATE INDEX IDX_AGENTDEF_FLOWKEY ON BPM_AGENT_DEF (FLOW_KEY_);
CREATE INDEX IDX_AGENTSETTING_AUTHID ON BPM_AGENT_SETTING (AUTH_ID_);   
CREATE INDEX IDX_AGENTSETTING_TYPE ON BPM_AGENT_SETTING (TYPE_);
CREATE INDEX IDX_AGENTSETTING_ISENABLED ON BPM_AGENT_SETTING (IS_ENABLED_);
CREATE INDEX IDX_AGENTSETTING_FLOWKEY ON BPM_AGENT_SETTING (FLOW_KEY_);
CREATE INDEX IDX_APPROVALITEM_USERID ON BPM_APPROVAL_ITEM (USER_ID_); 
CREATE INDEX IDX_APPROVALITEM_TYPE ON BPM_APPROVAL_ITEM (TYPE_);
CREATE INDEX IDX_CALLLOG_CALLTIME ON BPM_CALL_LOG (CALL_TIME_);
CREATE INDEX IDX_OPINIONHI_PROCINSTID ON BPM_CHECK_OPINION_HI (PROC_INST_ID_); 
CREATE INDEX IDX_COMMURECEIVER_COMMUID ON BPM_COMMU_RECEIVER (COMMU_ID_);
CREATE INDEX IDX_COMMURECEIVER_RECEIVERID ON BPM_COMMU_RECEIVER (RECEIVER_ID_);
CREATE INDEX IDX_CPTORECEIVER_RECEIVERID ON BPM_CPTO_RECEIVER (RECEIVER_ID_);   
CREATE INDEX IDX_CUSTOM_SIGN_TASKID ON BPM_CUSTOM_SIGNDATA (TASK_ID_);
CREATE INDEX IDX_CUSTOM_SIGN_INSTID ON BPM_CUSTOM_SIGNDATA (INST_ID_);
CREATE INDEX IDX_AUTHTYPE_AUTHTYPE ON BPM_DEF_AUTH_TYPE (AUTHORIZE_TYPE_); 
CREATE INDEX IDX_DEFUSER_RIGHTTYPE ON BPM_DEF_USER (RIGHT_TYPE_);
CREATE INDEX IDX_DEFUSER_OBJTYPE ON BPM_DEF_USER (OBJ_TYPE_);  
CREATE INDEX IDX_DEFINITION_DEFKEY ON BPM_DEFINITION (DEF_KEY_);
CREATE INDEX IDX_DEFINITION_BPMNDEFID ON BPM_DEFINITION (BPMN_DEF_ID_);  
CREATE INDEX IDX_DEPUTY_USERID ON BPM_DEPUTY (USER_ID_);
CREATE INDEX IDX_DEPUTY_AGENTID ON BPM_DEPUTY (AGENT_ID_);
CREATE INDEX IDX_MULTISCRIPT_ALIASNAME ON BPM_MULTI_SCRIPT (ALIAS_NAME_);
CREATE INDEX IDX_OFTENFLOW_DEFKEY ON BPM_OFTEN_FLOW (DEF_KEY_);
CREATE INDEX IDX_OFTENFLOW_USERID ON BPM_OFTEN_FLOW (USER_ID_);
CREATE INDEX IDX_OFTENFLOWUSER_OFTENFLOWID ON BPM_OFTEN_FLOW_USER (OFTEN_FLOW_ID_);
CREATE INDEX IDX_PRINTRECORD_PROCINSTID ON BPM_PRINT_RECORD (PROC_INST_ID_);
CREATE INDEX IDX_PROBO_PROCESSID ON BPM_PRO_BO (PROCESS_ID_);
CREATE INDEX IDX_PROBO_BOCODE ON BPM_PRO_BO (BO_CODE_);
CREATE INDEX IDX_PRO_INST_PROCDEFKEY ON BPM_PRO_INST (PROC_DEF_KEY_);
CREATE INDEX IDX_PRO_INST_PROCDEFID ON BPM_PRO_INST (PROC_DEF_ID_);
CREATE INDEX IDX_PROINSTSTATUS_KEY ON BPM_PRO_INST_STATUS (KEY_);
CREATE INDEX IDX_PROSTATUS_NODEID ON BPM_PRO_STATUS (NODE_ID_);
CREATE INDEX IDX_PROSTATUSHI_NODEID ON BPM_PRO_STATUS_HI (NODE_ID_);
CREATE INDEX IDX_READRECORD_PROCINSTID ON BPM_READ_RECORD (PROC_INST_ID_);
CREATE INDEX IDX_READRECORD_TASKID ON BPM_READ_RECORD (TASK_ID_);
CREATE INDEX IDX_READRECORD_TASKKEY ON BPM_READ_RECORD (TASK_KEY_);
CREATE INDEX IDX_REPORTACT_REPORTID ON BPM_REPORT_ACT (REPORT_ID_);
CREATE INDEX IDX_REPORTUSER_REPORTID ON BPM_REPORT_USER (REPORT_ID_);
CREATE INDEX IDX_SAVEOPINION_PROCINSTID ON BPM_SAVE_OPINION (PROC_INST_ID_);
CREATE INDEX IDX_SAVEOPINION_TASKID ON BPM_SAVE_OPINION (TASK_ID_);
CREATE INDEX IDX_SCRIPT_NAME ON BPM_SCRIPT (NAME_);
CREATE INDEX IDX_SEC_SECRETARYID ON BPM_SECRETARY_MANAGE (SECRETARY_ID_);
CREATE INDEX IDX_SELECTORDEF_ALIAS ON BPM_SELECTOR_DEF (ALIAS_);
CREATE INDEX IDX_TASKCANDIDATE_PROCINSTID ON BPM_TASK_CANDIDATE (PROC_INST_ID_);
CREATE INDEX IDX_TASKCOMMU_TASKID ON BPM_TASK_COMMU (TASK_ID_);
CREATE INDEX IDX_TASKCOMMU_INSTANCEID ON BPM_TASK_COMMU (INSTANCE_ID_);
CREATE INDEX IDX_WATE_TYPE_WMA_ID ON BPM_WATERMARK_TYPE (WATERMARK_ID_);
CREATE INDEX IDX_TRANS_REC_TRANS_RDID ON BPM_TRANS_RECEIVER (TRANS_RECORDID_);
CREATE INDEX IDX_TASK_TURN_TASK_TURN_ID ON BPM_TASK_TURNASSIGN (TASK_TURN_ID_);
CREATE INDEX IDX_TASK_TRANS_RECT_ID ON BPM_TASK_TRANS_RECORD (TASK_ID_);
CREATE INDEX IDX_TASK_TRANS_TASK_ID ON BPM_TASK_TRANS (TASK_ID_);
CREATE INDEX IDX_TASK_TRANS_INSTANCE_ID ON BPM_TASK_TRANS (INSTANCE_ID_);
CREATE INDEX IDX_TASK_SIGNDATA_EXECUTE_ID ON BPM_TASK_SIGNDATA (EXECUTE_ID_);
CREATE INDEX IDX_TASK_SIGNDATA_NODE_ID ON BPM_TASK_SIGNDATA (NODE_ID_);
CREATE INDEX IDX_TASK_SIGN_SEQ_INST_ID ON BPM_TASK_SIGN_SEQUENCE (INSTANCE_ID_);
CREATE INDEX IDX_TASK_SIGN_SEQUENCE_TASK_ID ON BPM_TASK_SIGN_SEQUENCE (TASK_ID_);
CREATE INDEX IDX_TASK_SIGN_LINE_TASK_ID ON BPM_TASK_SIGN_LINE (TASK_ID_);
CREATE INDEX IDX_TASK_SIGN_LINE_INSTANCE_ID ON BPM_TASK_SIGN_LINE (INSTANCE_ID_);
CREATE INDEX IDX_TASK_REMINDER_TASK_ID ON BPM_TASK_REMINDER (TASK_ID_);
CREATE INDEX IDX_TASK_NDP_DEF_ID ON BPM_TASK_NOTICE_DONE (PROC_DEF_ID_);
CREATE INDEX IDX_TASK_NOTICE_OWNER_ID ON BPM_TASK_NOTICE (OWNER_ID_);
CREATE INDEX IDX_BPM_TASK_OWNER_ID_  ON BPM_TASK (OWNER_ID_);
CREATE INDEX IDX_BPM_TASK_ASSIGNEE_ID_ ON BPM_TASK (ASSIGNEE_ID_);
CREATE INDEX IDX_TASKCANDIDATE_EXECUTOR ON BPM_TASK_CANDIDATE (EXECUTOR_);
CREATE INDEX IDX_TASKCANDIDATE_TYPE ON BPM_TASK_CANDIDATE (TYPE_);
CREATE INDEX IDX_YEARS_PARTITION_  ON BPM_FLOW_MQ_LOG (YEARS_PARTITION_);
CREATE INDEX IDX_PROC_INST_ID_ ON BPM_FLOW_MQ_LOG (PROC_INST_ID_);
CREATE INDEX idx_bpm_flow_message_type  ON BPM_FLOW_MQ_LOG (TYPE_);
create index IDX_USER_ID_USER_ID   on BPM_PRO_PUBLICITY_READ (USER_ID_);
create index BPM_PRO_PUBLICITY_   on BPM_PRO_PUBLICITY_READ (PROC_INST_ID_);
create index SHOW_RECORD_TASK_ID_   on BPM_SHOW_RECORD (TASK_ID_, SHOW_TYPE_);
create index PROC_INST_ID_  on BPM_SERVICE_LOG (PROC_INST_ID_);


INSERT INTO  "ACT_GE_PROPERTY" VALUES ('schema.version', '5.22.0.0', '1');
INSERT INTO  "ACT_GE_PROPERTY" VALUES ('schema.history', 'create(5.22.0.0)', '1');
INSERT INTO  "ACT_GE_PROPERTY" VALUES ('next.dbid', '1', '1');

INSERT INTO  "BPM_APPROVAL_ITEM" VALUES ('6901702', '1', NULL, NULL, NULL, '4', '管理员同意', NULL, NULL, NULL, NULL, TO_DATE('2020-09-29 10:30:10', 'SYYYY-MM-DD HH24:MI:SS'), '-1');
INSERT INTO  "BPM_APPROVAL_ITEM" VALUES ('752469', '1', NULL, NULL, NULL, '1', '请后面的同事审批', NULL, NULL, NULL, NULL, TO_DATE('2020-09-29 10:30:11', 'SYYYY-MM-DD HH24:MI:SS'), '-1');
INSERT INTO  "BPM_APPROVAL_ITEM" VALUES ('752475', '1', NULL, NULL, NULL, '1', '我不同意', NULL, NULL, NULL, NULL, TO_DATE('2020-09-29 10:30:14', 'SYYYY-MM-DD HH24:MI:SS'), '-1');
INSERT INTO  "BPM_APPROVAL_ITEM" VALUES ('8982173', '1', NULL, NULL, NULL, '1', '确认通过', NULL, NULL, NULL, NULL, TO_DATE('2020-09-29 10:30:13', 'SYYYY-MM-DD HH24:MI:SS'), '-1');

INSERT INTO  "BPM_DOCUMENTATION_CONFIG" VALUES ('1', NULL, '1', '{\"type\":4,\"timeInterval\":\"MON,TUE,WED,SUN|11:49:20\"}', '2', '1', '500', '1', NULL, '0', '流程归档数据同步', '-1');

INSERT INTO "BPM_DOCUMENTATION_TABLE" VALUES ('1644254843394052096', 'bpm_read_record', NULL, 'CREATE TABLE bpm_read_record(
	ID_ NVARCHAR2(255) NOT NULL,
	PROC_DEF_ID_ NVARCHAR2(255) DEFAULT NULL,
	SUP_INST_ID_ NVARCHAR2(255) DEFAULT NULL,
	PROC_INST_ID_ NVARCHAR2(255) DEFAULT NULL,
	TASK_ID_ NVARCHAR2(255) DEFAULT NULL,
	TASK_KEY_ NVARCHAR2(255) DEFAULT NULL,
	TASK_NAME_ NVARCHAR2(255) DEFAULT NULL,
	READER_ NVARCHAR2(255) DEFAULT NULL,
	READER_NAME_ NVARCHAR2(255) DEFAULT NULL,
	READ_TIME_ DATET,
	ORG_ID_ NVARCHAR2(255) DEFAULT NULL,
	ORG_PATH_ NVARCHAR2(255) DEFAULT NULL,
	TENANT_ID_ NVARCHAR2(64) DEFAULT NULL,
	 PRIMARY KEY(ID_)
);', '1', '0', NULL, '6', '1', 'id_', 'PROC_INST_ID_', NULL, '1644250277726375936', NULL, '-1');
INSERT INTO "BPM_DOCUMENTATION_TABLE" VALUES ('1644272017298935808', 'bpm_exe_stack_executor', NULL, 'CREATE TABLE BPM_EXE_STACK_EXECUTOR (
	ID_ NVARCHAR2(64) NOT NULL PRIMARY KEY unique,
	STACK_ID_ NVARCHAR2(64) DEFAULT NULL,
	TASK_ID_ NVARCHAR2(64) DEFAULT NULL,
	ASSIGNEE_ID_ NVARCHAR2(64) DEFAULT NULL,
	CREATE_TIME_ DATE,
	END_TIME_ DATE,
	STATUS_ SMALLINT DEFAULT NULL,
	TENANT_ID_ NVARCHAR2(64) DEFAULT NULL,
	TARGET_NODE_ NVARCHAR2(64),
		 PRIMARY KEY(ID_)
);', NULL, '1', NULL, '7', '1', 'id_', 'STACK_ID_', NULL, '1644253067093725184', NULL, '-1');
INSERT INTO "BPM_DOCUMENTATION_TABLE" VALUES ('1644250277726375936', 'bpm_pro_inst', NULL, 'CREATE TABLE bpm_pro_inst (
	ID_ NVARCHAR2(64) NOT NULL,
	SUBJECT_ NVARCHAR2(256) NOT NULL,
	PROC_DEF_ID_ NVARCHAR2(64) NOT NULL,
	BPMN_DEF_ID_ NVARCHAR2(64) DEFAULT NULL,
	PROC_DEF_KEY_ NVARCHAR2(128) DEFAULT NULL,
	PROC_DEF_NAME_ NVARCHAR2(128) NOT NULL,
	BIZ_KEY_ NVARCHAR2(64) DEFAULT NULL,
	SYS_CODE_ NVARCHAR2(64) DEFAULT NULL,
	FORM_KEY_ NVARCHAR2(64) DEFAULT NULL,
	STATUS_ NVARCHAR2(40) DEFAULT NULL,
	END_TIME_ DATE,
	DURATION_ INTEGER DEFAULT NULL,
	TYPE_ID_ NVARCHAR2(64) DEFAULT NULL,
	RESULT_TYPE_ NVARCHAR2(40) DEFAULT NULL,
	BPMN_INST_ID_ NVARCHAR2(64) DEFAULT NULL,
	CREATE_BY_ NVARCHAR2(64) DEFAULT NULL,
	CREATE_TIME_ DATE,
	CREATE_ORG_ID_ NVARCHAR2(64) DEFAULT NULL,
	UPDATE_BY_ NVARCHAR2(64) DEFAULT NULL,
	UPDATE_TIME_ DATE,
	IS_FORMMAL_ CHAR(1) NOT NULL,
	PARENT_INST_ID_ NVARCHAR2(64) DEFAULT NULL,
	IS_FORBIDDEN_ SMALLINT DEFAULT NULL,
	DATA_MODE_ NVARCHAR2(20) DEFAULT NULL,
	CREATOR_ NVARCHAR2(64) DEFAULT NULL,
	SUPPORT_MOBILE_ INTEGER DEFAULT 0,
	SUPER_NODE_ID_ NVARCHAR2(64) DEFAULT NULL,
	IS_DELE_ INTEGER DEFAULT 0 NOT NULL,
	URGENT_STATE_ NVARCHAR2(64) DEFAULT NULL,
	TENANT_ID_ NVARCHAR2(64) DEFAULT NULL,
	CREATE_ORG_PATH_ CLOB,
	PC_INST_URL_ NVARCHAR2(200),
	MOBILE_INST_URL_ NVARCHAR2(200),
	CREATE_ACCOUNT_ NVARCHAR2(64)，
	CONSTRAINT PK_BPM_PRO_INST PRIMARY KEY (ID_)
);', '1', '1', NULL, '1', '1', NULL, NULL, 'UPDATE_TIME_', '0', NULL, '-1');
INSERT INTO "BPM_DOCUMENTATION_TABLE" VALUES ('1644251197944090624', 'bpm_bus_link', NULL, 'CREATE TABLE bpm_bus_link(
	ID_ NVARCHAR2(64) NOT NULL ,
	DEF_ID_ NVARCHAR2(64) DEFAULT NULL,
	PROC_INST_ID_ NVARCHAR2(64) DEFAULT NULL,
	BUSINESSKEY_ INTEGER DEFAULT NULL,
	BUSINESSKEY_STR_ NVARCHAR2(64) DEFAULT NULL,
	SYS_CODE_ NVARCHAR2(64) DEFAULT NULL,
	FORM_IDENTIFY_ NVARCHAR2(64) NOT NULL,
	START_ID_ VARCHARNVARCHAR264) DEFAULT NULL,
	STARTOR_ NVARCHAR2(128) DEFAULT NULL,
	CREATE_DATE_ DATE,
	START_GROUP_ID_ NVARCHAR2(64) DEFAULT NULL,
	START_GROUP_ NVARCHAR2(128) DEFAULT NULL,
	IS_MAIN_ SMALLINT DEFAULT NULL,
	BO_DEF_CODE_ NVARCHAR2(64) DEFAULT NULL,
	SAVE_MODE_ NVARCHAR2(50) DEFAULT NULL,
	TENANT_ID_ NVARCHAR2(64) DEFAULT NULL,
	PRIMARY KEY(ID_)
);', '1', '0', NULL, '1', '1', 'id_', 'PROC_INST_ID_', NULL, '1644250277726375936', NULL, '-1');
INSERT INTO "BPM_DOCUMENTATION_TABLE" VALUES ('1644251940189097984', 'bpm_pro_status', NULL, 'CREATE TABLE bpm_pro_status(
	ID_ NVARCHAR2(64) NOT NULL ,
	PROC_INST_ID_ NVARCHAR2(64) NOT NULL,
	PROC_DEF_ID_ NVARCHAR2(64) NOT NULL,
	NODE_ID_ NVARCHAR2(255) NOT NULL,
	NODE_NAME_ NVARCHAR2(255) DEFAULT NULL,
	STATUS_ NVARCHAR2(50) NOT NULL,
	LAST_UPDATE_ DATE,
	LAST_USERID_ NVARCHAR2(64) DEFAULT NULL,
	TENANT_ID_ NVARCHAR2(64) DEFAULT NULL,
	RECYCLE_NODE_ NVARCHAR2(2) DEFAULT,
	PRIMARY KEY(ID_)
);', '1', '0', NULL, '2', '1', 'id_', 'PROC_INST_ID_', NULL, '1644250277726375936', NULL, '-1');
INSERT INTO "BPM_DOCUMENTATION_TABLE" VALUES ('1644252316812431360', 'bpm_check_opinion', NULL, 'CREATE TABLE bpm_check_opinion(
	ID_ NVARCHAR2(64) NOT NULL ,
	PROC_DEF_ID_ NVARCHAR2(64) NOT NULL,
	SUP_INST_ID_ NVARCHAR2(64) DEFAULT NULL,
	PROC_INST_ID_ NVARCHAR2(64) NOT NULL,
	TASK_ID_ NVARCHAR2(64) DEFAULT NULL,
	TASK_KEY_ NVARCHAR2(64) DEFAULT NULL,
	TASK_NAME_ NVARCHAR2(255) DEFAULT NULL,
	TOKEN_ NVARCHAR2(64) DEFAULT NULL,
	QUALFIEDS_ CLOB DEFAULT NULL,
	QUALFIED_NAMES_ CLOB DEFAULT NULL,
	AUDITOR_ NVARCHAR2(64) DEFAULT NULL,
	AUDITOR_NAME_ NVARCHAR2(64) DEFAULT NULL,
	ORG_ID_ NVARCHAR2(64) DEFAULT NULL,
	ORG_PATH_ NVARCHAR2(600) DEFAULT NULL,
	OPINION_ NVARCHAR2(4000) DEFAULT NULL,
	STATUS_ NVARCHAR2(40) NOT NULL,
	FORM_DEF_ID_ NVARCHAR2(64) DEFAULT NULL,
	FORM_NAME_ NVARCHAR2(64) DEFAULT NULL,
	CREATE_TIME_ DATE,
	ASSIGN_TIME_ DATE,
	COMPLETE_TIME_ DATE,
	DUR_MS_ INTEGER DEFAULT NULL,
	FILES_ NVARCHAR2(4000) DEFAULT NULL,
	INTERPOSE_ SMALLINT DEFAULT NULL,
	IS_DELE_ INTEGER DEFAULT 0 NOT NULL,
	IS_READ_ INTEGER DEFAULT 0 NOT NULL,
	AGENT_LEADER_ID_ NVARCHAR2(64) DEFAULT NULL,
	PROP1_ NVARCHAR2(200) DEFAULT NULL,
	PROP2_ NVARCHAR2(200) DEFAULT NULL,
	PROP3_ NVARCHAR2(200) DEFAULT NULL,
	PROP4_ NVARCHAR2(200) DEFAULT NULL,
	PROP5_ NVARCHAR2(200) DEFAULT NULL,
	PROP6_ CLOB,
	Z_FILES_ NVARCHAR2(1000) DEFAULT NULL,
	FORM_DATA_ CLOB,
	PARENT_TASK_ID_ VARCHAR(64) DEFAULT NULL,
	SIGN_TYPE_ NVARCHAR2(64) DEFAULT NULL,
	SKIP_TYPE_ NVARCHAR2(64) DEFAULT NULL,
	TENANT_ID_ NVARCHAR2(64) DEFAULT NULL,
	VARS_ CLOB,
	QUALFIEDS_ACCOUNT_ CLOB,
	AUDITOR_ACCOUNT_ NVARCHAR2(255),
	PRIMARY KEY(ID_)
);', '1', '0', NULL, '3', '1', 'id_', 'proc_inst_id_', NULL, '1644250277726375936', NULL, '-1');
INSERT INTO "BPM_DOCUMENTATION_TABLE" VALUES ('1644253067093725184', 'bpm_exe_stack', NULL, 'CREATE TABLE BPM_EXE_STACK (
	ID_ NVARCHAR2(64) NOT NULL ,
	PRCO_DEF_ID_ NVARCHAR2(64) DEFAULT NULL,
	NODE_ID_ NVARCHAR2(64) NOT NULL,
	NODE_NAME_ NVARCHAR2(128) DEFAULT NULL,
	START_TIME_ DATE,
	END_TIME DATE,
	IS_MULITI_TASK_ SMALLINT NOT NULL,
	PARENT_ID_ NVARCHAR2(64) DEFAULT NULL,
	PROC_INST_ID_ NVARCHAR2(64) DEFAULT NULL,
	NODE_PATH_ NVARCHAR2(1024) DEFAULT NULL,
	DEPTH_ SMALLINT DEFAULT NULL,
	TASK_TOKEN_ NVARCHAR2(255) DEFAULT NULL,
	NODE_TYPE_ NVARCHAR2(255) DEFAULT NULL,
	TARGET_NODE_ NVARCHAR2(200) DEFAULT NULL,
	TARGET_TOKEN_ NVARCHAR2(255) DEFAULT NULL,
	INTERPOSE_ SMALLINT DEFAULT NULL,
	TENANT_ID_ NVARCHAR2(64) DEFAULT NULL,
	PRIMARY KEY(ID_)
);', '1', '0', NULL, '4', '1', 'id_', 'PROC_INST_ID_', NULL, '1644250277726375936', NULL, '-1');
INSERT INTO "BPM_DOCUMENTATION_TABLE" VALUES ('1644254426346016768', 'bpm_flow_mq_log', NULL, 'CREATE TABLE bpm_flow_mq_log(
	ID_ NVARCHAR2(64) NOT NULL,
	TYPE_ NVARCHAR2(40) NOT NULL,
	TITLE_ NVARCHAR2(300),
	CONTENT_ CLOB,
	STATUS_ INT NOT NULL,
	TRY_TIME_ INT,
	EXCEPTION_ NVARCHAR2(2000),
	LOG_TIME_ DATE,
	TARGET_ NVARCHAR2(64),
	PROC_INST_ID_ NVARCHAR2(64),
	TASK_ID_ NVARCHAR2(64),
	OWNER_ID_ NVARCHAR2(64),
	OWNER_NAME_ NVARCHAR2(64),
	TENANT_ID_ NVARCHAR2(64),
	YEARS_PARTITION_ INT,
	 PRIMARY KEY(ID_)
);', '1', '0', NULL, '5', '1', 'id_', 'PROC_INST_ID_', NULL, '1644250277726375936', NULL, '-1');

INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('1', '启动', 'startFlow', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'start', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('10', '签收', 'lockUnlock', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '0', NULL, 'userTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('11', '保存', 'saveDraft', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'userTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('12', '挂起', 'hangUp', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '0', NULL, 'userTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('13', '取消挂起', 'cancelHangUp', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '0', NULL, 'userTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('14', '反对', 'oppose', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'userTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('15', '流转', 'startTrans', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '0', NULL, 'userTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('16', '加签', 'addSign', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '0', NULL, 'userTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('17', '终止', 'endProcess', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'userTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('18', '传阅', 'instanceTrans', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '0', NULL, 'userTask', '1');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('19', '驳回发起人', 'backToStart', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'userTask', '1');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('2', '保存', 'saveDraft', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'start', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('20', '同意', 'agree', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'signTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('21', '沟通反馈', 'commu', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'signTask', '1');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('22', '驳回', 'reject', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'signTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('23', '征询', 'inqu', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '0', NULL, 'signTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('24', '转办', 'delegate', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '0', NULL, 'signTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('25', '保存', 'saveDraft', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'signTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('26', '反对', 'oppose', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'signTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('27', '驳回发起人', 'backToStart', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'signTask', '1');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('28', '传阅', 'instanceTrans', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '0', NULL, 'signTask', '1');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('29', '加签', 'addSign', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '0', NULL, 'signTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('3', '同意', 'agree', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'userTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('4', '同意（流转）', 'agreeTrans', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'userTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('5', '反对（流转）', 'opposeTrans', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'userTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('6', '沟通反馈', 'commu', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'userTask', '1');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('7', '驳回', 'reject', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '1', NULL, 'userTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('8', '征询', 'inqu', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '0', NULL, 'userTask', '0');
INSERT INTO "BPM_FLOW_DEFAULT_BUTTON" VALUES ('9', '转办', 'delegate', NULL, NULL, NULL, NULL, 'backToStart,rejectPre,reject', NULL, '0', '0', NULL, 'userTask', '0');

INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('1', NULL, NULL, 'com.hotent.runtime.script.UserScript', 'userScript', 'getRoleByAlias', '根据角色别名获取角色列表', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.String","paraDesc":"角色别名","paraCt":"base:role-selector","paraCtBindName":"code","paraCtBindKey":"code","multiSelect":false}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('10', NULL, NULL, 'com.hotent.runtime.script.UserRelScript', 'userRelScript', 'getUpChargesByOrgId', '获取上级组织负责人(包含主负责人)或主负责人', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.String","paraDesc":"组织ID","paraCt":"base:org-selector","paraCtBindName":"组织ID","paraCtBindKey":"id","multiSelect":false,"$$hashKey":"object:3067"},{"paraName":"arg1","paraType":"java.lang.Boolean","paraDesc":"是否主负责人","paraCt":null,"paraCtBindName":"","paraCtBindKey":null,"multiSelect":false,"$$hashKey":"object:3068"}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('11', NULL, NULL, 'com.hotent.runtime.script.UserRelScript', 'userRelScript', 'getChargesByPreNode', '获取上一节点执行人的部门负责人(主组织)', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.Boolean","paraDesc":"是否主负责人","paraCt":""},{"paraName":"arg1","paraType":"java.lang.String","paraDesc":"传维度id或编码都可以          "}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('12', NULL, NULL, 'com.hotent.runtime.script.UserRelScript', 'userRelScript', 'getByRelPreNode', '通过上一节点执行人获取汇报线上级 人员列表', 'java.util.Set', '[{"paraName":"arg1","paraType":"java.lang.String","paraDesc":"汇报线类型编码","paraCt":"","paraCtBindName":"ID_","paraCtBindKey":"","multiSelect":false}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('13', NULL, NULL, 'com.hotent.runtime.script.UserRelScript', 'userRelScript', 'getByRelStartUser', '通过发起人获取汇报线上级 人员列表', 'java.util.Set', '[{"paraName":"arg1","paraType":"java.lang.String","paraDesc":"汇报线类型编码","paraCt":"","paraCtBindName":"ID_","paraCtBindKey":"","multiSelect":false}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('1318030354614980608', NULL, NULL, 'com.hotent.runtime.script.UserScript', 'userScript', 'getUserFromSubData', '从子表数据中提取节点审批人(固定值生效)', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.String","paraDesc":"业务对象别名"},{"paraName":"arg1","paraType":"java.lang.String","paraDesc":"子表别名（sub_)"},{"paraName":"arg2","paraType":"java.lang.String","paraDesc":"用户帐号字段"}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('16', NULL, NULL, 'com.hotent.runtime.script.OrgScript', 'orgScript', 'getChargesByPOrg', '获取上一节点用户的上级部门（主）的负责人(主组织生效）', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.Boolean","paraDesc":"是否主负责人(值为true或false)","paraCt":"null","$$hashKey":"object:2340","multiSelect":false},{"paraName":"arg1","paraType":"java.lang.String","paraDesc":"维度编码（不传为默认维度）","multiSelect":false,"paraCt":"base:dem-selector","paraCtBindKey":"code","paraCtBindName":"code"}]
', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('17', NULL, NULL, 'com.hotent.runtime.script.OrgScript', 'orgScript', 'getChargesByStartPOrg', '获取发起人的上级部门的（主）负责人', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.Boolean","paraDesc":"是否主负责人(值为true或false)","paraCt":"","$$hashKey":"object:1955","multiSelect":false},{"paraName":"arg1","paraType":"java.lang.String","paraDesc":"维度编码（不传为默认维度）","multiSelect":false,"paraCt":"base:dem-selector","paraCtBindKey":"code","paraCtBindName":"code"}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('18', NULL, NULL, 'com.hotent.runtime.script.OrgScript', 'orgScript', 'getChargesByOrg', '获取上一点节用户所在部门的（主）负责人', 'java.util.Set', '[{"paraName":"arg0","paraType":"boolean","paraDesc":"是否主负责人(值为true或false)","paraCt":"","$$hashKey":"object:1387","multiSelect":false},{"paraName":"arg1","paraType":"java.lang.String","paraDesc":"维度编码（不传为默认维度）","multiSelect":false,"paraCt":"base:dem-selector","paraCtBindKey":"code","paraCtBindName":"code"}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('19', NULL, NULL, 'com.hotent.runtime.script.OrgScript', 'orgScript', 'getChargesByStartOrg', '获取发起人所在部门的（主）负责人', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.Boolean","paraDesc":"是否主负责人","paraCt":"null","$$hashKey":"object:1002","multiSelect":false},{"paraName":"arg1","paraType":"java.lang.String","paraDesc":"维度编码（不传为默认维度）","multiSelect":false,"paraCt":"base:dem-selector","paraCtBindKey":"code","paraCtBindName":"code"}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('2', NULL, NULL, 'com.hotent.runtime.script.UserScript', 'userScript', 'getOrgById', '根据组织id查询组织作为候选处理人（不抽取）', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.String","paraDesc":"组织编码","paraCt":"base:org-selector","paraCtBindName":"id_","paraCtBindKey":"id","multiSelect":false,"$$hashKey":"object:645"}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('20', NULL, NULL, 'com.hotent.runtime.script.OrgScript', 'orgScript', 'getByOrgRelDefCode', '通过职务编码和组织编码查询用户', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.String","paraDesc":"组织编码","paraCt":"base:org-selector","paraCtBindName":"code","paraCtBindKey":"code","multiSelect":false},{"paraName":"arg1","paraType":"java.lang.String","paraDesc":"职务编码","paraCt":"base:job-selector","paraCtBindName":"code","paraCtBindKey":"code","multiSelect":false}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('3', NULL, NULL, 'com.hotent.runtime.script.BpmUserScript', 'bpmUserScript', 'getListUserByRelCode', '根据岗位编码获取人员列表', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.String","paraDesc":"岗位编码","paraCt":"base:pos-selector","paraCtBindName":"code","paraCtBindKey":"code","multiSelect":false}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('4', NULL, NULL, 'com.hotent.runtime.script.UserScript', 'userScript', 'getMainByOrgId', '获取该组织中为主组织的人员列表', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.String","paraDesc":"组织ID","paraCt":"base:org-selector","paraCtBindName":"id_","paraCtBindKey":"id","multiSelect":false,"$$hashKey":"object:3514"}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('9', NULL, NULL, 'com.hotent.runtime.script.UserRelScript', 'userRelScript', 'getChargesByOrgId', '获取组织负责人(包含主负责人)或主负责人', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.String","paraDesc":"组织ID","paraCt":"base:org-selector","paraCtBindName":"ID_","paraCtBindKey":"id","multiSelect":false},{"paraName":"arg1","paraType":"java.lang.Boolean","paraDesc":"是否主负责人","paraCt":null,"paraCtBindName":"","paraCtBindKey":null,"multiSelect":false,"$$hashKey":"object:2506"}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('1338367741324824576', NULL, NULL, 'com.hotent.runtime.script.UserScript', 'userScript', 'getByCompanyRole', '找这个组织底下拥有这个角色的人员', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.String","paraDesc":"组织ID","paraCt":"base:org-selector","paraCtBindKey":"code"},{"paraName":"arg1","paraType":"java.lang.String","paraDesc":"角色别名","paraCt":"base:role-selector","paraCtBindKey":"code"}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('1338375124944031744', NULL, NULL, 'com.hotent.runtime.script.UserScript', 'userScript', 'getLeaderStep', '获取逐级审批(获取主负责人)', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.Integer","paraDesc":"级别"},{"paraName":"arg1","paraType":"boolean","paraDesc":"是否需要上级（true，false）"}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('1338377219818524672', NULL, NULL, 'com.hotent.runtime.script.UserScript', 'userScript', 'getUserById', '根据ID获取审批人', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.String","paraDesc":"ID"}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('1338379764150439936', NULL, NULL, 'com.hotent.runtime.script.UserRelScript', 'userRelScript', 'getUserFromBusSql', 'sql查询用户ID(固定值SQL要用\" \"包裹)', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.String","paraDesc":"查询SQL，返回结果只有一列"}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('1338381406014935040', NULL, NULL, 'com.hotent.runtime.script.UserScript', 'userScript', 'getLeaderStepByOrgId', '根据组织ID获取逐级审批', 'java.util.Set', '[{"paraName":"arg0","paraType":"java.lang.String","paraDesc":"组织ID","paraCt":"base:org-selector","paraCtBindKey":"id"},{"paraName":"arg1","paraType":"java.lang.Integer","paraDesc":"组织级别"}]', '1', '2', '-1');
INSERT INTO "BPM_MULTI_SCRIPT" VALUES ('22', NULL, NULL, 'com.hotent.runtime.script.OrgScript', 'orgScript', 'getMasterFromUnder', '通过下属管理获取上一节点用户的上级', 'java.util.Set', '[{\"paraName\":\"arg0\",\"paraType\":\"java.lang.String\",\"paraDesc\":\"维度id或编码\",\"multiSelect\":false,\"paraCt\":\"base:dem-selector\",\"paraCtBindKey\":\"id\",\"paraCtBindName\":\"id\"}]', '1', '2', '-1');

INSERT INTO "BPM_SCRIPT" VALUES ('10', '获取cmd对象', 'return scriptImpl.getActionCmd();', '系统脚本', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '-1');
INSERT INTO "BPM_SCRIPT" VALUES ('11', '获取当前用户的主组织名称', 'return scriptImpl.getIUserMainOrgName();', '系统脚本', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '-1');
INSERT INTO "BPM_SCRIPT" VALUES ('12', '获取当前用户的主组织ID', 'return scriptImpl.getIUserMainOrgID();', '系统脚本', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '-1');
INSERT INTO "BPM_SCRIPT" VALUES ('13', '获取当前用户的岗位名称', 'return scriptImpl.getIUserPostName();', '系统脚本', '返回：Set(String)', NULL, NULL, NULL, NULL, NULL, NULL, '-1');
INSERT INTO "BPM_SCRIPT" VALUES ('14', '获取当前用户的岗位ID', 'return scriptImpl.getIUserPostID();', '系统脚本', '返回：Set(String)', NULL, NULL, NULL, NULL, NULL, NULL, '-1');
INSERT INTO "BPM_SCRIPT" VALUES ('15', '获取当前用户的角色名称', 'return scriptImpl.getIUserRoleName();', '系统脚本', '返回：Set(String)', NULL, NULL, NULL, NULL, NULL, NULL, '-1');
INSERT INTO "BPM_SCRIPT" VALUES ('16', '获取当前用户的角色ID', 'return scriptImpl.getIUserRoleID();', '系统脚本', '返回：Set(String)', NULL, NULL, NULL, NULL, NULL, NULL, '-1');
INSERT INTO "BPM_SCRIPT" VALUES ('7', '获取当前用户名称', 'return scriptImpl.getCurrentUserName();', '系统脚本', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '-1');
INSERT INTO "BPM_SCRIPT" VALUES ('8', '获取当前日期', 'return scriptImpl.getCurrentDate();', '系统脚本', '获取当前日期，例如"2002-11-06"', NULL, NULL, NULL, NULL, NULL, NULL, '-1');
INSERT INTO "BPM_SCRIPT" VALUES ('9', '获取当前日期（指定格式）', 'return scriptImpl.getCurrentDateByStyle(String style);', '系统脚本', '获取当前日期，按指定格式输出', NULL, NULL, NULL, NULL, NULL, NULL, '-1');
INSERT INTO "BPM_SCRIPT" VALUES ('1269805454708576256', '获取当前年份', 'return scriptImpl.getCurrentYear();', '系统脚本', '获取当前年份，例如"2020"', NULL, '1', NULL, NULL, NULL, NULL, '-1');
INSERT INTO "BPM_SCRIPT" VALUES ('1269805555023745024', '获取当前月份', 'return scriptImpl.getCurrentMonth();', '系统脚本', '获取当前月份，例如"06"', NULL, '1', NULL, NULL, NULL, NULL, '-1');
INSERT INTO "BPM_SCRIPT" VALUES ('1310142489381965824', '获取当前登录用户的id', 'return scriptImpl.getCurrentUserId();', '系统脚本', NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO "BPM_SCRIPT" VALUES ('1310143493599006720', '获取当前登录用户账号', 'return scriptImpl.getCurrentAccount()', '系统脚本', '返回String', NULL, '1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO "BPM_SCRIPT" VALUES ('1310143776035049472', '获取职务级别', 'return scriptImpl.getMainPostName("postLevel");', '系统脚本', NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO "BPM_SCRIPT" VALUES ('1310147332251193344', '根据级别获取当前登录用户组织编码', 'return scriptImpl.getString(orgScript.getParentMainOrg("1").getGroupCode());', '系统脚本', '集团1，公司2，部门3', NULL, '1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO "BPM_SCRIPT" VALUES ('1310149027446263808', '获取当前用户的角色名称', 'return scriptImpl.getIUserRoleName();', '系统脚本', '返回字符串数组', NULL, '1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO "BPM_SCRIPT" VALUES ('1310150341488152576', '获取组织参数值', 'return orgScript.getParamKey('''','''');', '系统脚本', '组织id，组织参数编码', NULL, '1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO "BPM_SCRIPT" VALUES ('1310153058105298944', '根据id获取工号', 'return scriptImpl.getUser("1").getAccount();', '系统脚本', NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO "BPM_SCRIPT" VALUES ('1310155448002940928', '判断组织参数', 'return orgScript.isOrgHasParamKey('''','''')', '系统脚本', '组织ID，参数别名', NULL, NULL, NULL, '1', NULL, NULL, NULL);
INSERT INTO "BPM_SCRIPT" VALUES ('1338364268277534720', '判断当前用户是否拥有该角色', 'return scriptImpl.isCurrentInRole('''');', '系统脚本', '参数：角色别名', NULL, '1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO "BPM_SCRIPT" VALUES ('1338334576715632640', '执行sql', 'return scriptImpl.executeSql('''');', '系统脚本', '参数：sql(String)，参数中加入<#id#>，在流程中会替换成表单数据主键。返回值只有一行一列(String)', NULL, '1', NULL, '1', NULL, NULL, NULL);
INSERT INTO "BPM_SCRIPT" VALUES ('1338326415497629696', '获取当前用户主岗位编码', 'return scriptImpl.getCurrentMainPostId();', '系统脚本', '无参数', NULL, '1', NULL, '1', NULL, NULL, NULL);
INSERT INTO "BPM_SCRIPT" VALUES ('1338326248547553280', '获取当前用户主岗位ID', 'return scriptImpl.getCurrentMainPostId();', '系统脚本', '无参数', NULL, '1', NULL, '1', NULL, NULL, NULL);
INSERT INTO "BPM_SCRIPT" VALUES ('1338326076463648768', '获取当前用户主岗位名称', 'return scriptImpl.getCurrentMainPostName();', '系统脚本', '无参数', NULL, '1', NULL, '1', NULL, NULL, NULL);
INSERT INTO "BPM_SCRIPT" VALUES ('1338321870394626048', '根据级别获取当前用户组织ID', 'return orgScript.getParamMainOrgId('''');', '系统脚本', 'param:grade(String)', NULL, '1', NULL, '1', NULL, NULL, NULL);
INSERT INTO "BPM_SCRIPT" VALUES ('1338310603730718720', '根据组织ID和参数判断组织是否有该参数', 'return orgScript.isOrgHasParamKey('''','''');', '系统脚本', '组织ID(String)，组织参数(String)', NULL, '1', NULL, '1', NULL, NULL, NULL);

