/*
 change.sql 说明
 1.数据库相关修改添加到对应的 change.sql 文件，无需调整其他 sql  文件
 2.sql 语句验证正确后再提交
*/
/**
    pgsql提交需要注意：
    所有的DDL语句，字段名请不要使用双引号包裹， 这么做可能会导致执行sql时找不到字段

 */


-- wanghb 2020-12-02 新增短链接管理表
CREATE TABLE "portal_shorturl_manage" (
  "ID_" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "URL_" varchar(2000) COLLATE "pg_catalog"."default" NOT NULL,
  "url_desc_" varchar(2000) COLLATE "pg_catalog"."default",
  "SHORT_URL_" varchar(255) COLLATE "pg_catalog"."default",
  "create_by_" varchar(255) COLLATE "pg_catalog"."default",
  "create_time_" timestamp(6),
  "lose_time_" timestamp(6),
  "create_org_id_" varchar(255) COLLATE "pg_catalog"."default",
  "update_by_" varchar(255) COLLATE "pg_catalog"."default",
  "update_time_" timestamp(6),
  "ENABLED_" varchar(1) COLLATE "pg_catalog"."default",
  "tenant_id_" varchar(64) COLLATE "pg_catalog"."default"
);

COMMENT ON COLUMN "portal_shorturl_manage"."ID_" IS '主键';
COMMENT ON COLUMN "portal_shorturl_manage"."URL_" IS '原链接';
COMMENT ON COLUMN "portal_shorturl_manage"."url_desc_" IS '原链接描述';
COMMENT ON COLUMN "portal_shorturl_manage"."SHORT_URL_" IS '短链接';
COMMENT ON COLUMN "portal_shorturl_manage"."create_by_" IS '创建人';
COMMENT ON COLUMN "portal_shorturl_manage"."create_time_" IS '创建时间';
COMMENT ON COLUMN "portal_shorturl_manage"."lose_time_" IS '失效时间';
COMMENT ON COLUMN "portal_shorturl_manage"."create_org_id_" IS '创建人组织id';
COMMENT ON COLUMN "portal_shorturl_manage"."update_by_" IS '更新人';
COMMENT ON COLUMN "portal_shorturl_manage"."update_time_" IS '更新时间';
COMMENT ON COLUMN "portal_shorturl_manage"."ENABLED_" IS '是否启用.1:启用，2：禁用';
COMMENT ON TABLE "portal_shorturl_manage" IS '短连接管理表';

ALTER TABLE "portal_shorturl_manage" ADD CONSTRAINT "portal_shorturl_manage_pkey" PRIMARY KEY ("ID_");

-- zjq 2020-12-04 修改流程附件上传配置表的ALIYUN_OSS_ENDPOINT_字段注释
COMMENT ON COLUMN "portal_flow_upload_properties"."aliyun_oss_endpoint_" IS '访问域名 endpoint';

-- wanghb 2020-12-08 用户组织岗位关系表新增维度id字段
ALTER TABLE "uc_org_user"  ADD COLUMN "dem_id_" varchar(64);
COMMENT ON COLUMN "uc_org_user"."dem_id_" IS '维度id';
UPDATE uc_org_user SET dem_id_ = ( SELECT dem_id_ FROM uc_org WHERE uc_org.ID_ = uc_org_user.ORG_ID_ ) WHERE ORG_ID_ != ''  OR ORG_ID_ IS NOT NULL;

-- zengst 2020-12-21 数据报表增加所属表单列
alter table form_data_template
  add form_name_ varchar(64);

comment on column form_data_template.form_name_ is '表单名';


-- zengst 2020-12-21 替换消息模板的前端路径
update portal_sys_msg_tpl set html_ = replace(html_,'${baseUrl}/fvue','${baseUrl}/${frontBaseUrl}') where html_ like '%${baseUrl}/fvue%';
-- zengst 2020-12-21 增加用于模板解析的系统属性
insert into portal_sys_properties (ID, NAME, ALIAS, GROUP_, VALUE, ENCRYPT, DESCRIPTION, UPDATE_TIME_, CREATE_BY_, CREATE_TIME_, CREATE_ORG_ID_, UPDATE_BY_, TENANT_ID_) values ('21', '管理端基础路径', 'manageBaseUrl', null, 'mvue', 0, '管理端IP和端口号后面基础路径', null, 1, null, null, 1, null);
insert into portal_sys_properties (ID, NAME, ALIAS, GROUP_, VALUE, ENCRYPT, DESCRIPTION, UPDATE_TIME_, CREATE_BY_, CREATE_TIME_, CREATE_ORG_ID_, UPDATE_BY_, TENANT_ID_) values ('22', '应用端基础路径', 'frontBaseUrl', null, 'fvue', 0, '应用端IP和端口号后面基础路径', null, 1, null, null, 1, null);
insert into portal_sys_properties (ID, NAME, ALIAS, GROUP_, VALUE, ENCRYPT, DESCRIPTION, UPDATE_TIME_, CREATE_BY_, CREATE_TIME_, CREATE_ORG_ID_, UPDATE_BY_, TENANT_ID_) values ('23', '移动端基础路径', 'mobileBaseUrl', null, 'mobilevue', 0, '移动端IP和端口号后面基础路径', null, 1, null, null, 1, null);


-- zengst 2020-12-22 部分人员脚本描述
update bpm_multi_script set METHOD_DESC_  = '找这个组织底下拥有这个角色的人员' where METHOD_NAME_ = 'getByCompanyRole';
update bpm_multi_script set METHOD_DESC_  = '根据是否有用户参数以及组织参数获取审批人' where METHOD_NAME_ = 'getFgUsers';

-- zhangxw 2020-12-17 表单套打扩展字段
ALTER TABLE "form_print_template"
ADD COLUMN "MAIN_SQL_LIST" text,
ADD COLUMN "DATASOURCE_" varchar(64),
ADD COLUMN "LABEL_CONFIG_" text,
ADD COLUMN "DATASOURCE_FORM_" varchar(10),
ADD COLUMN "TYPE_ID_" varchar(64),
ADD COLUMN "TYPE_NAME_" varchar(64),
ADD COLUMN "NAME_" varchar(128),
ADD COLUMN "ALIAS_" varchar(64),
ADD COLUMN "DESC_" varchar(64),
ADD COLUMN "FILE_JSON_" text,
ADD COLUMN "BO_DEF_IDS_" varchar(2000);
COMMENT ON COLUMN "form_print_template"."MAIN_SQL_LIST" IS 'sql集合';
COMMENT ON COLUMN "form_print_template"."DATASOURCE_" IS '数据源别名';
COMMENT ON COLUMN "form_print_template"."LABEL_CONFIG_" IS '标签配置';
COMMENT ON COLUMN "form_print_template"."DATASOURCE_FORM_" IS '数据来源 form-表单 db-数据库';
COMMENT ON COLUMN "form_print_template"."TYPE_ID_" IS '分类id';
COMMENT ON COLUMN "form_print_template"."TYPE_NAME_" IS '分类名称';
COMMENT ON COLUMN "form_print_template"."NAME_" IS '模板名称';
COMMENT ON COLUMN "form_print_template"."ALIAS_" IS '模板别名';
COMMENT ON COLUMN "form_print_template"."DESC_" IS '模板描述';
COMMENT ON COLUMN "form_print_template"."FILE_JSON_" IS '模板文件json';
COMMENT ON COLUMN "FORM_PRINT_TEMPLATE"."BO_DEF_IDS_" IS 'BO建模id数据（多个用逗号分隔）';


-- zhangxw 2020-12-17 添加套打分类数据
INSERT INTO PORTAL_SYS_TYPE_GROUP(ID_, GROUP_KEY_, NAME_, FLAG_, SN_, TYPE_, CREATE_BY_, CREATE_TIME_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_) VALUES ('13', 'PRINT_TEMPLATE', '套打分类', '1', '13', '1', null, null, null, '1', null);
INSERT INTO PORTAL_SYS_TYPE(ID_, TYPE_GROUP_KEY_, NAME_, TYPE_KEY_, STRU_TYPE_, PARENT_ID_, DEPTH_, PATH_, IS_LEAF_, OWNER_ID_, SN_, CREATE_BY_, CREATE_TIME_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, ICON_, TENANT_ID_) VALUES ('31123', 'PRINT_TEMPLATE', '默认分类', 'default', '1', '13', '1', '13.31123.', 'Y', '0', '0', '1', null, null, null, null, '{}', '-1');


-- zhangxw 2020-12-25 添加印章管理模块sql
CREATE TABLE "portal_sys_signet" (
  "ID_" varchar(64) NOT NULL,
  "ALIAS_" varchar(64),
  "NAME_" varchar(64),
  "FILE_ID_" varchar(64),
  "DESC_" varchar(600),
  "CREATE_BY_" varchar(64),
  "CREATE_ORG_ID_" varchar(64),
  "CREATE_TIME_" timestamp(6),
  "UPDATE_BY_" timestamp(6),
  "UPDATE_TIME_" timestamp(6),
  "TENANT_ID_" varchar(64),
  PRIMARY KEY ("ID_")
)
;

COMMENT ON COLUMN "portal_sys_signet"."ID_" IS '主键';

COMMENT ON COLUMN "portal_sys_signet"."ALIAS_" IS '别名';

COMMENT ON COLUMN "portal_sys_signet"."NAME_" IS '印章名称';

COMMENT ON COLUMN "portal_sys_signet"."FILE_ID_" IS '印章附件id';

COMMENT ON COLUMN "portal_sys_signet"."DESC_" IS '印章描述';

COMMENT ON COLUMN "portal_sys_signet"."CREATE_BY_" IS '创建人id';

COMMENT ON COLUMN "portal_sys_signet"."CREATE_ORG_ID_" IS '创建人所属组织id';

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

COMMENT ON COLUMN "portal_sys_signet"."UPDATE_BY_" IS '更新人';

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

COMMENT ON COLUMN "portal_sys_signet"."TENANT_ID_" IS '租户id';

-- wanghb 知会任务表新增OPINION_ID_字段
ALTER TABLE "bpm_task_notice"  ADD COLUMN "OPINION_ID_" varchar(64);

-- zjq 矩阵表uc_matrix添加enable_字段, 添加矩阵和流程的关系表uc_matrix_proc_relation
ALTER TABLE "uc_matrix"
  ADD COLUMN "enabled_" int4 DEFAULT 1;
COMMENT ON COLUMN "uc_matrix"."enabled_" IS '是否启用: 0禁用 1启用';

CREATE TABLE "uc_matrix_proc_relation" (
  "id_" varchar(64) NOT NULL,
  "matrix_code_" varchar(255),
  "proc_def_key_" varchar(64),
  "proc_def_name_" varchar(64),
  "tenant_id_" varchar(64),
  PRIMARY KEY ("id_")
);
COMMENT ON COLUMN "uc_matrix_proc_relation"."id_" IS 'id';
COMMENT ON COLUMN "uc_matrix_proc_relation"."matrix_code_" IS '矩阵编码';
COMMENT ON COLUMN "uc_matrix_proc_relation"."proc_def_key_" IS '流程定义key';
COMMENT ON COLUMN "uc_matrix_proc_relation"."proc_def_name_" IS '流程定义名称';
COMMENT ON COLUMN "uc_matrix_proc_relation"."tenant_id_" IS '租户id';



-- zengst 2020-01-23 常用联系人迁移
create table UC_GROUP
(
  ID_            VARCHAR(64) not null
    constraint UC_GROUP_PK
      primary key,
  GROUP_NAME     VARCHAR(255),
  CODE_          VARCHAR(64),
  CREATE_BY_     VARCHAR(64),
  CREATOR_NAME_  VARCHAR(255),
  CREATE_ORG_ID_ VARCHAR(64),
  UPDATE_BY_     VARCHAR(64),
  CREATE_TIME_   TIMESTAMP,
  UPDATE_TIME_   TIMESTAMP,
  TENANT_ID_     VARCHAR(64)
);

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


-- auto-generated definition
create table UC_GROUP_USER
(
  ID_        VARCHAR(64) not null
    constraint UC_GROUP_USER_PK
      primary key,
  GROUP_ID_  VARCHAR(64),
  USER_ID    VARCHAR(64),
  TENANT_ID_ VARCHAR(64)
);


comment on table UC_GROUP_USER is '群组和用户关系表';
comment on column UC_GROUP_USER.ID_ is '主键';
comment on column UC_GROUP_USER.GROUP_ID_ is '外键';
comment on column UC_GROUP_USER.USER_ID is '用户Id';
comment on column UC_GROUP_USER.TENANT_ID_ is '租户Id';



-- 庞泉 2021-04-09 微信小程序集成
ALTER TABLE  "uc_user_unite"
  ADD COLUMN "mp_open_id_" varchar(255);
COMMENT ON COLUMN "uc_user_unite"."mp_open_id_" IS '微信小程序openid';

-- 刘江 2021-04-12 #9513 iframeUrl配置已无用，可以去掉
DELETE FROM portal_sys_properties WHERE ALIAS = 'iframeUrl'

-- 2021-04-12 pangq 应用端添加扫码功能
ALTER TABLE portal_sys_external_unite
  ADD COLUMN "scan_app_id_" varchar(255),
  ADD COLUMN "scan_app_secret_" varchar(255);
COMMENT ON COLUMN portal_sys_external_unite."scan_app_id_" IS '扫码登录的appId';
COMMENT ON COLUMN portal_sys_external_unite."scan_app_secret_" IS '扫码登录的appSecret';


-- zhangxw 2021-1-13 门户表添加级别字段
ALTER TABLE "portal_sys_layout_manage"
  ADD COLUMN "alias" varchar(64),
  ADD COLUMN "rank" int2;
COMMENT ON COLUMN "portal_sys_layout_manage"."alias" IS '别名';
COMMENT ON COLUMN "portal_sys_layout_manage"."rank" IS '优先级（数字递增优先级递减）';


-- zhangxw 2021-1-21 应用端添加我的布局菜单
INSERT INTO portal_sys_menu(ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, TENANT_ID_) VALUES ('1352205235262722048', '59217', '我的布局', 'v-myLayout', '', '', NULL, 101, '', '-1.3.59217.1352205235262722048.', '', '-1');

-- zhangxw 2021-2-1 布局表扩展字段
ALTER TABLE "portal_sys_layout_manage"
  ADD COLUMN "TYPE_" varchar(20),
  ADD COLUMN "AS_TEMPLATE_" int2;
COMMENT ON COLUMN "portal_sys_layout_manage"."TYPE_" IS '布局类型：column（栏目），datav（大屏）';
COMMENT ON COLUMN "portal_sys_layout_manage"."AS_TEMPLATE_" IS '是否发布为模板(1=是，0=否)';

-- zhangxw 2021-2-24 布局管理菜单调整
UPDATE portal_sys_menu SET PARENT_ID_ = '3711006', NAME_ = '门户管理', ALIAS_ = 'layoutManager', ACTIVE_TAB_ = '', MENU_ICON_ = '', OPENED_ = NULL, SN_ = 2, TABS_STYLE_ = '', PATH_ = '-1.1.3441002.3711006.6907875.', HREF_ = NULL, TENANT_ID_ = '-1' WHERE ID_ = '6907875';

-- zhangxw 2021-3-1 布局管理添加属性
ALTER TABLE "portal_sys_layout_manage"
  ADD COLUMN "CREATE_TIME_" date,
  ADD COLUMN "UPDATE_TIME_" date,
  ADD COLUMN "CREATE_BY_" varchar(64),
  ADD COLUMN "UPDATE_BY_" varchar(64),
  ADD COLUMN "CREATE_ORG_ID_" varchar(64),
  ADD COLUMN "SCREEN_CAPTURE_ID_" varchar(64);
COMMENT ON COLUMN "portal_sys_layout_manage"."CREATE_TIME_" IS '创建时间';
COMMENT ON COLUMN "portal_sys_layout_manage"."UPDATE_TIME_" IS '更新时间';
COMMENT ON COLUMN "portal_sys_layout_manage"."CREATE_BY_" IS '创建人id';
COMMENT ON COLUMN "portal_sys_layout_manage"."UPDATE_BY_" IS '更新人id';
COMMENT ON COLUMN "portal_sys_layout_manage"."CREATE_ORG_ID_" IS '创建人所属组织id';
COMMENT ON COLUMN "portal_sys_layout_manage"."SCREEN_CAPTURE_ID_" IS '截图附件id';


-- zhangxw 2021-4-22 调整初始化布局数据
update portal_sys_layout_manage set TYPE_='column' WHERE TYPE_ IS NULL;
update portal_sys_layout_manage set ALIAS='default_manage',RANK=1 WHERE ID='0';
update portal_sys_layout_manage set ALIAS='default_front',RANK=1 WHERE ID='2';
update portal_sys_layout_manage set ALIAS='default_mobile',RANK=1 WHERE ID='1';

-- zhangxw 2021-4-22 调整门户相关管理菜单
INSERT INTO portal_sys_menu(ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, TENANT_ID_) VALUES ('1366228495574896640', '3711006', '大屏管理', 'datavManager', '', '', NULL, 3, '', '-1.1.3441002.3711006.1366228495574896640.', '', '-1');
DELETE from portal_sys_menu where ALIAS_='layoutDistribution';

-- zhangxw 2021-4-25 添加套打模板菜单
INSERT INTO portal_sys_menu(ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, TENANT_ID_) VALUES ('1386144820958990336', '3391046', '套打模板', 'formPrintTemplateListManager', '', '', NULL, 6, '', '-1.1.3441002.3391046.1386144820958990336.', '', '-1');

-- zengst 2021-05-06 弹窗提醒表
create table PORTAL_SYS_POPUP
(
    ID_                VARCHAR(64)   not NULL
        PRIMARY KEY,
    SUBJECT_           VARCHAR(255)  NULL ,
    DATA_SOURCE_ALIAS_ VARCHAR(64)   NULL ,
    ORDER_             INTEGER           NULL ,
    IS_ENABLE_         INTEGER           NULL ,
    URL_               VARCHAR(2000) NULL ,
    POPUP_TYPE_        VARCHAR(64)   NULL ,
    DIALOG_WIDTH_      INTEGER           NULL ,
    DIALOG_HEIGHT_     INTEGER           NULL ,
    SQL_               VARCHAR(2000) NULL ,
    DESC_              text          NULL ,
    CREATE_TIME_       timestamp      NULL ,
    STYLE_CONTENT_     text          NULL,
    DATA_TYPE_         VARCHAR(64)   NULL ,
    SCRIPT_            text          NULL ,
    VALIDITY_START_    timestamp      NULL ,
    VALIDITY_END_      timestamp      NULL ,
    TENANT_ID_         VARCHAR(64)   NULL
)
;
COMMENT ON COLUMN  PORTAL_SYS_POPUP.ID_ IS '主键';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.SUBJECT_ IS '主题';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.DATA_SOURCE_ALIAS_ IS '数据源';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.ORDER_ IS '排序';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.IS_ENABLE_ IS '是否启用';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.URL_ IS '跳转地址';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.POPUP_TYPE_ IS '弹窗类型';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.DIALOG_WIDTH_ IS '对话框宽度';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.DIALOG_HEIGHT_ IS '对话框高度';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.SQL_ IS 'SQL语句';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.DESC_ IS '描述';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.CREATE_TIME_ IS '创建时间';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.STYLE_CONTENT_ IS '样式配置';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.DATA_TYPE_ IS 'groovy脚本';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.VALIDITY_START_ IS '有效期起';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.VALIDITY_END_ IS '有效期止';
COMMENT ON COLUMN  PORTAL_SYS_POPUP.TENANT_ID_ IS '租户ID';

-- 弹窗管理菜单
insert into PORTAL_SYS_MENU (ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_,
                             HREF_, TENANT_ID_)
values (1390150280544391168, 3711006, '弹窗提醒', 'popupManager', 'popupManager', null, null, 4, null,
        '-1.1.3441002.3711006.1390150280544391168.', null, -1);

--消息提醒栏目
insert into portal_sys_column (ID, NAME, ALIAS, CATALOG, COL_TYPE, DATA_MODE, DATA_FROM, DS_ALIAS, DS_NAME, COL_HEIGHT,
                               COL_URL, TEMPLATE_HTML, IS_PUBLIC, SUPPORT_REFESH, REFESH_TIME, SHOW_EFFECT, MEMO,
                               DATA_PARAM, NEEDPAGE, ORG_ID, CREATOR, CREATE_BY_, UPDATE_BY_, CREATE_TIME_,
                               UPDATE_TIME_, REQUEST_TYPE, CATALOG_NAME, CREATE_ORG_ID_, TENANT_ID_)
values (1390133228840554496, '消息提醒', 'xxtx', 31081, 0, null, '', '', null, 0, '', 'PHBvcHVwQ29sdW1uIC8+', 2, null, null,
        null, '', '', 0, null, null, 1, 1, null, null, '', '默认分类', '', -1);
-- 2020-05-07 zengst 弹窗提醒增加名称别名
alter table portal_sys_popup
	add name varchar(255);

comment on column portal_sys_popup.name is '名称';

alter table portal_sys_popup
	add alias_ varchar(255);

comment on column portal_sys_popup.alias_ is '别名';

 -- zhangxw 2021-06-11 mysql8关键字RANK问题
 ALTER TABLE "portal_sys_layout_manage" RENAME COLUMN "RANK" TO "RANK_";


-- zengst 2021-07-02  后端菜单收藏功能相关表
create table portal_menu_bookmark
(
    ID_             varchar(64)   not null
        primary key,
    ALIAS_          varchar(128)  null ,
    MENU_ID_        varchar(64)   null ,
    PARENT_MENU_ID_ varchar(64)   null ,
    HREF_           varchar(2000) null ,
    NAME_           varchar(128)  null ,
    TENANT_ID_      varchar(64)   null ,
    USER_ID_        varchar(64)   null
)
   ;

comment on table portal_menu_bookmark is '菜单收藏';
comment on column  portal_menu_bookmark.ID_ IS '主键';
comment on column  portal_menu_bookmark.ALIAS_ IS '菜单别名';
comment on column  portal_menu_bookmark.MENU_ID_ IS '菜单ID';
comment on column  portal_menu_bookmark.PARENT_MENU_ID_ IS '父菜单ID';
comment on column  portal_menu_bookmark.HREF_ IS '菜单链接';
comment on column  portal_menu_bookmark.NAME_ IS '菜单名';
comment on column  portal_menu_bookmark.TENANT_ID_ IS '租户ID';
comment on column  portal_menu_bookmark.USER_ID_ IS '用户ID';

-- zengst 2021-08-16 添加移动端流程分类表
-- auto-generated definition
create table BPM_MOBILE_CATEGORY
(
    ID_          VARCHAR2(64) not null
        constraint BPM_MOBILE_CATEGORY_PK
        primary key,
    DEF_KEY_     VARCHAR2(64),
    TYPE_ID_     VARCHAR2(64),
    CREATE_TIME_ DATE,
    UPDATE_TIME_ DATE,
    TENANT_ID_   VARCHAR2(64),
    TYPE_KEY_    VARCHAR2(64),
    CREATOR_     VARCHAR2(64),
    DEF_NAME_    VARCHAR2(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 '流程定义名称'
/

-- 管理端流程分类配置页面
INSERT INTO PORTAL_SYS_MENU (ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_,
                             HREF_, TENANT_ID_)
VALUES ('1372088887966568448', '3761202', '移动端流程分类', 'mobileFlowType', 'mobileFlowType', null, 1, 4, null,
        '-1.1.3641025.3761202.1372088887966568448.', null, '-1');

-- 应用端添加常用流程设置菜单
insert into PORTAL_SYS_MENU(id_, parent_id_, name_, alias_, active_tab_, menu_icon_, opened_, sn_, tabs_style_, path_,
                            href_, tenant_id_)
values ('1349913657512955905', '59217', '常用流程', 'commonFlow', null, null, 1, 6, null, '-1.3.59217.1349913657512955905.',
        null, '-1');

INSERT INTO PORTAL_SYS_TYPE_GROUP (ID_, GROUP_KEY_, NAME_, FLAG_, SN_, TYPE_, CREATE_BY_, CREATE_TIME_, CREATE_ORG_ID_,
                                   UPDATE_BY_, UPDATE_TIME_)
VALUES ('14', 'MOBILE_FLOW_TYPE', '移动端流程分类', 1, 5, 1, null, null, null, null, null);

-- 添加常用流程类型
INSERT INTO PORTAL_SYS_TYPE (ID_, TYPE_GROUP_KEY_, NAME_, TYPE_KEY_, STRU_TYPE_, PARENT_ID_, DEPTH_, PATH_, IS_LEAF_,
                             OWNER_ID_, SN_, CREATE_BY_, CREATE_TIME_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, ICON_,
                             TENANT_ID_)
VALUES ('15', 'MOBILE_FLOW_TYPE', '常用流程', 'default', '1', '14', 1, '14.15.', 'Y', '0', -1, '1', null, null, null,
        null, '{}', '-1');

-- 给一般用户角色授予权限常用流程菜单的权限（ybyh是初始化sql里添加的）
INSERT INTO portal_sys_role_auth (id_, role_alias_, menu_alias_, tenant_id_)
VALUES ('1371745528324427777', 'ybyh', 'commonFlow', '-1');

-- zengst 2021-08-20 表单元数据添加流水号配置
alter table form_meta
    add identity_config_ text;

comment on column form_meta.identity_config_ is '流水号配置';

-- zengst 2021-08-30 分级组织授权添加角色权限和配置
alter table uc_org_auth
    add role_perms_ varchar(255);
comment on column uc_org_auth.role_perms_ is '角色管理权限';
alter table uc_org_auth
    add role_config_ text;
comment on column uc_org_auth.role_config_ is '角色配置';

-- jason 2021-09-11 调整索引 优化性能
DROP INDEX "act_idx_athrz_procedef";

DROP INDEX "act_idx_ident_lnk_group";

DROP INDEX "act_idx_ident_lnk_user";

CREATE INDEX "ACT_IDX_IDENT_LNK_TASK_ID" ON "act_ru_identitylink" USING btree (
  "task_id_"
);

-- tangxin 2021-09-14 添加url表单管理表
DROP TABLE IF EXISTS FORM_URL_FORM;
CREATE TABLE FORM_URL_FORM (
   ID_                  VARCHAR(64)          NOT NULL,
   FORM_NAME_           VARCHAR(200)         NULL DEFAULT NULL,
   FORM_KEY_            VARCHAR(50)          NULL DEFAULT NULL,
   FORM_DESC_           VARCHAR(500)         NULL DEFAULT NULL,
   SYS_ID_              VARCHAR(64)          NULL DEFAULT NULL,
   SYS_NAME_            VARCHAR(200)         NULL DEFAULT NULL,
   FORM_URL_            VARCHAR(200)         NULL DEFAULT NULL,
   START_URL_           VARCHAR(200)         NULL DEFAULT NULL,
   TASK_URL_            VARCHAR(200)         NULL DEFAULT NULL,
   INST_URL_            VARCHAR(200)         NULL DEFAULT NULL,
   TOKEN_AUTH_          INT2                 NULL DEFAULT NULL,
   IS_EMBED_            INT2                 NULL DEFAULT NULL,
   STATUS_              VARCHAR(20)          NULL DEFAULT NULL,
   FORM_TYPE_           VARCHAR(20)          NULL DEFAULT NULL,
   TYPE_ID_             VARCHAR(50)          NULL DEFAULT NULL,
   TYPE_NAME_           VARCHAR(100)         NULL DEFAULT NULL,
   IS_MAIN_             CHAR(1)              NULL DEFAULT NULL,
   VERSION_             INT4                 NULL DEFAULT NULL,
   CREATE_BY_           VARCHAR(64)          NULL DEFAULT NULL,
   CREATE_ORG_ID_       VARCHAR(64)          NULL DEFAULT NULL,
   CREATE_TIME_         TIMESTAMP                 NULL,
   IS_DELE_             CHAR(1)              NULL DEFAULT NULL,
   UPDATE_BY_           VARCHAR(64)          NULL DEFAULT NULL,
   UPDATE_TIME_         TIMESTAMP                 NULL,
   TENANT_ID_           VARCHAR(64)          NULL DEFAULT NULL,
   CONSTRAINT PK_FORM_URL_FORM PRIMARY KEY (ID_)
);

COMMENT ON TABLE FORM_URL_FORM IS
'URL表单管理';

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

COMMENT ON COLUMN FORM_URL_FORM.FORM_NAME_ IS
'表单名称';

COMMENT ON COLUMN FORM_URL_FORM.FORM_KEY_ IS
'表单key';

COMMENT ON COLUMN FORM_URL_FORM.FORM_DESC_ IS
'表单描述';

COMMENT ON COLUMN FORM_URL_FORM.SYS_ID_ IS
'所属系统ID';

COMMENT ON COLUMN FORM_URL_FORM.SYS_NAME_ IS
'所属系统名称';

COMMENT ON COLUMN FORM_URL_FORM.FORM_URL_ IS
'表单地址';

COMMENT ON COLUMN FORM_URL_FORM.START_URL_ IS
'启动表单地址';

COMMENT ON COLUMN FORM_URL_FORM.TASK_URL_ IS
'待办表单地址';

COMMENT ON COLUMN FORM_URL_FORM.INST_URL_ IS
'实例表单地址';

COMMENT ON COLUMN FORM_URL_FORM.TOKEN_AUTH_ IS
'是否token认证，0：否，1：是';

COMMENT ON COLUMN FORM_URL_FORM.IS_EMBED_ IS
'是否嵌入表单，0：否，1：是';

COMMENT ON COLUMN FORM_URL_FORM.STATUS_ IS
'表单状态，draft：草稿，deploy：已发布';

COMMENT ON COLUMN FORM_URL_FORM.FORM_TYPE_ IS
'表单类型，pc电脑端，mobile移动端';

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

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

COMMENT ON COLUMN FORM_URL_FORM.IS_MAIN_ IS
'是否主表单，N：否，Y：是';

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

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

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

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

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

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

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

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

-- tangxin 2021-09-14 审批相关表添加表单地址字段
ALTER TABLE bpm_definition
  ADD COLUMN PC_START_URL_ varchar(200),
  ADD COLUMN MOBILE_START_URL_ varchar(200);
COMMENT ON COLUMN bpm_definition.PC_START_URL_ IS 'pc端启动地址';
COMMENT ON COLUMN bpm_definition.MOBILE_START_URL_ IS '手机端启动地址';

ALTER TABLE bpm_pro_inst
  ADD COLUMN PC_INST_URL_ varchar(200),
  ADD COLUMN MOBILE_INST_URL_ varchar(200);
COMMENT ON COLUMN bpm_pro_inst.PC_INST_URL_ IS 'pc端实例地址';
COMMENT ON COLUMN bpm_pro_inst.MOBILE_INST_URL_ IS '手机端实例地址';

ALTER TABLE bpm_pro_inst_hi
  ADD COLUMN PC_INST_URL_ varchar(200),
  ADD COLUMN MOBILE_INST_URL_ varchar(200);
COMMENT ON COLUMN bpm_pro_inst_hi.PC_INST_URL_ IS 'pc端实例地址';
COMMENT ON COLUMN bpm_pro_inst_hi.MOBILE_INST_URL_ IS '手机端实例地址';

ALTER TABLE bpm_task
  ADD COLUMN PC_TASK_URL_ varchar(200),
  ADD COLUMN MOBILE_TASK_URL_ varchar(200);
COMMENT ON COLUMN bpm_task.PC_TASK_URL_ IS 'pc端启动地址';
COMMENT ON COLUMN bpm_task.MOBILE_TASK_URL_ IS '手机端启动地址';

-- tangxin 2021-09-14 添加URL表单管理菜单
INSERT INTO portal_sys_menu(ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, TENANT_ID_) VALUES ('1437731738720321536', '3391046', 'URL表单管理', 'formUrlFormManager', '', '', NULL, 4, '', '-1.1.3441002.3391046.1437731738720321536.', '', '-1');
UPDATE portal_sys_menu SET SN_= 5 WHERE ID_='1287699251299749888';
UPDATE portal_sys_menu SET SN_= 6 WHERE ID_='1386144820958990336';
UPDATE portal_sys_menu SET SN_= 7 WHERE ID_='4151743';

-- zengst 2021-09-23 同步bpm_task到bpm_task_notice
ALTER TABLE bpm_task_notice
    ADD COLUMN PC_TASK_URL_ varchar(200),
    ADD COLUMN MOBILE_TASK_URL_ varchar(200);
COMMENT ON COLUMN bpm_task_notice.PC_TASK_URL_ IS 'pc端启动地址';
COMMENT ON COLUMN bpm_task_notice.MOBILE_TASK_URL_ IS '手机端启动地址';


-- zengst 2021-09-24 流程收藏表
create table bpm_flow_collect
(
    id_          varchar(64) not null
        constraint bpm_flow_collect_pk
        primary key,
    def_key_     varchar(64),
    creator_     varchar(64),
    create_time_ timestamp,
    tenant_id_   varchar(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';

alter table bpm_flow_collect
    owner to postgres;

-- zengst 2021-09-23 菜单路由信息扩展
alter table portal_sys_menu
    add route_extend_ text;

comment on column portal_sys_menu.route_extend_ is '路由信息扩展';

-- 2021-09-28 pangq 表单列表漏字段
ALTER TABLE FORM_DATA_TEMPLAT
ADD TABLE_CONFIGURE_ varchar(200);
comment on column FORM_DATA_TEMPLAT.TABLE_CONFIGURE_ is '按钮操作列配置';


-- 2021-09-29 zengst 常用联系人排序字段
alter table UC_GROUP_USER
    ADD SN_ INT;
COMMENT ON COLUMN UC_GROUP_USER.SN_ IS '排序值';

-- 2021-09-30 zengst 用户布局配置信息
-- auto-generated definition
create table portal_user_layout_config
(
    id_             varchar(64) not null
        constraint portal_user_layout_config_pkey
        primary key,
    layout_id_      varchar(64),
    config_content_ text,
    creator_        varchar(64)
);

comment on table portal_user_layout_config is '用户布局配置表';

comment on column portal_user_layout_config.id_ is '主键';

comment on column portal_user_layout_config.layout_id_ is '布局ID';

comment on column portal_user_layout_config.config_content_ is '布局配置信息';

comment on column portal_user_layout_config.creator_ is '创建者ID';

alter table portal_user_layout_config
    owner to postgres;



-- 2021-09-30 yujl 外部接口授权记录表
CREATE TABLE "portal_url_permission" (
                 "ID" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
                 "SYS_ID_" varchar(64),
                 "MODULE_" varchar(255) ,
                 "FUNCTION_" varchar(50) ,
                 "AUTH_URL_" varchar(255) ,
                 "CREATE_TIME_" timestamp,
                 "CREATE_BY_" varchar(255),
                 "CREATE_ORG_ID_" varchar(255) ,
                 "TENANT_ID_" varchar(255) ,
                 "DESCRIPTION_" varchar(255) ,
                 CONSTRAINT "portal_url_permission_key" PRIMARY KEY ("ID")
)
;

ALTER TABLE "portal_url_permission"
    OWNER TO "postgres";

CREATE UNIQUE INDEX "uniqueIndex" ON "portal_url_permission" USING btree (
    "SYS_ID_" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
    "AUTH_URL_" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
    );

COMMENT ON COLUMN "portal_url_permission"."SYS_ID_" IS '授权系统ID';

COMMENT ON COLUMN "portal_url_permission"."MODULE_" IS '所属模块';

COMMENT ON COLUMN "portal_url_permission"."FUNCTION_" IS '所属功能';

COMMENT ON COLUMN  "portal_url_permission"."AUTH_URL_" IS '接口授权路径';

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

COMMENT ON COLUMN "portal_url_permission"."DESCRIPTION_" IS '接口描述';

COMMENT ON INDEX "uniqueIndex" IS '联合索引，保证数据唯一性';


-- yujl 2021-09-30 外部系统管理表
CREATE TABLE "portal_biz_system" (
                                              "ID_" varchar(64) COLLATE "pg_catalog"."default",
                                              "SYS_CODE_" varchar(50) COLLATE "pg_catalog"."default",
                                              "SYS_NAME_" varchar(255) COLLATE "pg_catalog"."default",
                                              "ENABLED_" varchar(10) COLLATE "pg_catalog"."default",
                                              "SECRET_KEY_" varchar(255) COLLATE "pg_catalog"."default",
                                              "MANAGER_ID_" varchar(255) COLLATE "pg_catalog"."default",
                                              "MANAGER_NAME_" varchar(255) COLLATE "pg_catalog"."default",
                                              "ROOT_ADDRESS_" varchar(255) COLLATE "pg_catalog"."default",
                                              "HOME_ADDRESS_" varchar(255) COLLATE "pg_catalog"."default",
                                              "BPM_MSG_QUEUE_" varchar(50) COLLATE "pg_catalog"."default",
                                              "DESCRIPTION_" varchar(1000) COLLATE "pg_catalog"."default",
                                              "ROBOT_ID_" varchar(255) COLLATE "pg_catalog"."default",
                                              "CREATE_TIME_" timestamp(6),
                                              "CREATE_BY_" varchar(255) COLLATE "pg_catalog"."default",
                                              "CREATE_ORG_ID_" varchar(255) COLLATE "pg_catalog"."default",
                                              "IS_DELE_" varchar(255) COLLATE "pg_catalog"."default",
                                              "UPDATE_TIME_" timestamp(6),
                                              "UPDATE_BY_" timestamp(6),
                                              "TENANT_ID_" varchar(255) COLLATE "pg_catalog"."default"
)
;

ALTER TABLE "portal_biz_system"
    OWNER TO "postgres";

COMMENT ON COLUMN "portal_biz_system"."SYS_CODE_" IS '系统编码';

COMMENT ON COLUMN "portal_biz_system"."SYS_NAME_" IS '系统名称';

COMMENT ON COLUMN "portal_biz_system"."ENABLED_" IS '是否启用，可用 0：禁用，1：启用';

COMMENT ON COLUMN "portal_biz_system"."SECRET_KEY_" IS '系统密匙，用于鉴权';

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

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

COMMENT ON COLUMN "portal_biz_system"."ROOT_ADDRESS_" IS '用于其他地方拼接地址';

COMMENT ON COLUMN "portal_biz_system"."HOME_ADDRESS_" IS '系统首页地址';

COMMENT ON COLUMN "portal_biz_system"."BPM_MSG_QUEUE_" IS '流程消息队列';

COMMENT ON COLUMN "portal_biz_system"."DESCRIPTION_" IS '系统描述';

COMMENT ON COLUMN "portal_biz_system"."ROBOT_ID_" IS '机器人ID';

COMMENT ON COLUMN "portal_biz_system"."CREATE_BY_" IS '创建人';

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

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


-- yujl 2021-09-30 记录外部系统的消息发送日志记录表
CREATE TABLE "portal_msg_send_log" (
                                                "ID_" varchar(255) COLLATE "pg_catalog"."default",
                                                "SYS_CODE_" varchar(255) COLLATE "pg_catalog"."default",
                                                "FLOW_KEY_" varchar(255) COLLATE "pg_catalog"."default",
                                                "ACTION_TYPE_" varchar(255) COLLATE "pg_catalog"."default",
                                                "TRIG_NODE_ID_" varchar(255) COLLATE "pg_catalog"."default",
                                                "TRIG_USER_ID_" varchar(64) COLLATE "pg_catalog"."default",
                                                "SEND_TIME" timestamp(6),
                                                "TITLE_" varchar(255) COLLATE "pg_catalog"."default",
                                                "CONTENT_" text COLLATE "pg_catalog"."default",
                                                "STATUS_" varchar(1) COLLATE "pg_catalog"."default",
                                                "tenant_id_" varchar(20) COLLATE "pg_catalog"."default"
)
;

ALTER TABLE "portal_msg_send_log"
    OWNER TO "postgres";

COMMENT ON COLUMN "portal_msg_send_log"."SYS_CODE_" IS '发往系统';

COMMENT ON COLUMN "portal_msg_send_log"."FLOW_KEY_" IS '触发流程KEY';

COMMENT ON COLUMN "portal_msg_send_log"."ACTION_TYPE_" IS '流程动作类型';

COMMENT ON COLUMN "portal_msg_send_log"."TRIG_NODE_ID_" IS '触发节点';

COMMENT ON COLUMN "portal_msg_send_log"."TRIG_USER_ID_" IS '触发用户';

COMMENT ON COLUMN "portal_msg_send_log"."SEND_TIME" IS '发送时间';

COMMENT ON COLUMN "portal_msg_send_log"."TITLE_" IS '消息标题';

COMMENT ON COLUMN "portal_msg_send_log"."CONTENT_" IS 'MQ文本内容';

COMMENT ON COLUMN "portal_msg_send_log"."STATUS_" IS '0失败，1成功';

-- tangxin 2021-09-14 添加服务编排相关表
DROP TABLE IF EXISTS portal_connection_manager;
CREATE TABLE portal_connection_manager(
    id_ VARCHAR(64) NOT NULL,
    ref_id_ VARCHAR(64),
    name_ VARCHAR(60),
    alias_ VARCHAR(60),
    desc_ VARCHAR(200),
    type_id_ VARCHAR(60),
    type_name_ VARCHAR(200),
    type_id_path_ VARCHAR(500),
    status_ VARCHAR(1),
    connection_type_ VARCHAR(60),
    connect_param_ VARCHAR(200),
    create_by_ VARCHAR(64),
    create_org_id_ VARCHAR(64),
    create_time_ DATE,
    update_by_ VARCHAR(64),
    update_time_ DATE,
    revision_ VARCHAR(32),
    is_dele_ VARCHAR(1),
    tenant_id_ VARCHAR(64),
    PRIMARY KEY (id_)
);

COMMENT ON TABLE portal_connection_manager IS '连接管理';
COMMENT ON COLUMN portal_connection_manager.id_ IS '主键';
COMMENT ON COLUMN portal_connection_manager.ref_id_ IS '外键';
COMMENT ON COLUMN portal_connection_manager.name_ IS '连接名称';
COMMENT ON COLUMN portal_connection_manager.alias_ IS '连接别名';
COMMENT ON COLUMN portal_connection_manager.desc_ IS '连接描述';
COMMENT ON COLUMN portal_connection_manager.type_id_ IS '所属分类';
COMMENT ON COLUMN portal_connection_manager.type_name_ IS '所属分类名称';
COMMENT ON COLUMN portal_connection_manager.type_id_path_ IS '所属分类路径';
COMMENT ON COLUMN portal_connection_manager.status_ IS '启用状态1启用 0禁用';
COMMENT ON COLUMN portal_connection_manager.connection_type_ IS '连接类型';
COMMENT ON COLUMN portal_connection_manager.connect_param_ IS '属性参数';
COMMENT ON COLUMN portal_connection_manager.create_by_ IS '创建人';
COMMENT ON COLUMN portal_connection_manager.create_org_id_ IS '创建人组织ID';
COMMENT ON COLUMN portal_connection_manager.create_time_ IS '创建时间';
COMMENT ON COLUMN portal_connection_manager.update_by_ IS '更新人';
COMMENT ON COLUMN portal_connection_manager.update_time_ IS '更新时间';
COMMENT ON COLUMN portal_connection_manager.revision_ IS '乐观锁';
COMMENT ON COLUMN portal_connection_manager.is_dele_ IS '是否删除，0未删，1已删';
COMMENT ON COLUMN portal_connection_manager.tenant_id_ IS '租户ID';

DROP TABLE IF EXISTS portal_interface_manager;
CREATE TABLE portal_interface_manager(
    id_ VARCHAR(64) NOT NULL,
    ref_id_ VARCHAR(64),
    name_ VARCHAR(60),
    alias_ VARCHAR(64),
    desc_ VARCHAR(200),
    input_params_ TEXT,
    pre_processors_ VARCHAR(60),
    output_params_ TEXT,
    post_processors_ VARCHAR(60),
    status_ VARCHAR(1),
    create_by_ VARCHAR(64),
    create_org_id_ VARCHAR(64),
    create_time_ DATE,
    update_by_ VARCHAR(64),
    update_time_ DATE,
    revision_ VARCHAR(32),
    is_dele_ VARCHAR(1),
    tenant_id_ VARCHAR(64),
    PRIMARY KEY (id_)
);

COMMENT ON TABLE portal_interface_manager IS '接口管理';
COMMENT ON COLUMN portal_interface_manager.id_ IS '主键';
COMMENT ON COLUMN portal_interface_manager.ref_id_ IS '外键（连接管理ID）';
COMMENT ON COLUMN portal_interface_manager.name_ IS '接口名称';
COMMENT ON COLUMN portal_interface_manager.alias_ IS '接口别名';
COMMENT ON COLUMN portal_interface_manager.desc_ IS '接口描述';
COMMENT ON COLUMN portal_interface_manager.input_params_ IS '输入参数';
COMMENT ON COLUMN portal_interface_manager.pre_processors_ IS '前置处理器;用于对输入参数转换为map 或者自定义扩展输入参数';
COMMENT ON COLUMN portal_interface_manager.output_params_ IS '输出参数';
COMMENT ON COLUMN portal_interface_manager.post_processors_ IS '后置处理器;对返回结果进行处理';
COMMENT ON COLUMN portal_interface_manager.status_ IS '启用状态1启用 0禁用';
COMMENT ON COLUMN portal_interface_manager.create_by_ IS '创建人';
COMMENT ON COLUMN portal_interface_manager.create_org_id_ IS '创建人组织ID';
COMMENT ON COLUMN portal_interface_manager.create_time_ IS '创建时间';
COMMENT ON COLUMN portal_interface_manager.update_by_ IS '更新人';
COMMENT ON COLUMN portal_interface_manager.update_time_ IS '更新时间';
COMMENT ON COLUMN portal_interface_manager.revision_ IS '乐观锁';
COMMENT ON COLUMN portal_interface_manager.is_dele_ IS '是否删除，0未删，1已删';
COMMENT ON COLUMN portal_interface_manager.tenant_id_ IS '租户ID';

DROP TABLE IF EXISTS portal_db_interface;
CREATE TABLE portal_db_interface(
    id_ VARCHAR(64) NOT NULL,
    ref_id_ VARCHAR(64),
    type_ VARCHAR(60),
    dsalias_ VARCHAR(60),
    need_page_ INTEGER,
    page_size_ INTEGER,
    obj_name_ VARCHAR(200),
    displayfield_ TEXT,
    resultfield_ TEXT,
    conditionfield_ TEXT,
    sortfield_ TEXT,
    is_table_ VARCHAR(1),
    diy_sql_ TEXT,
    sql_build_type_ VARCHAR(1),
    create_by_ VARCHAR(64),
    create_org_id_ VARCHAR(64),
    create_time_ DATE,
    update_by_ VARCHAR(64),
    update_time_ DATE,
    revision_ VARCHAR(32),
    is_dele_ VARCHAR(1),
    tenant_id_ VARCHAR(64),
    PRIMARY KEY (id_)
);

COMMENT ON TABLE portal_db_interface IS '数据库接口';
COMMENT ON COLUMN portal_db_interface.id_ IS '主键';
COMMENT ON COLUMN portal_db_interface.ref_id_ IS '外键';
COMMENT ON COLUMN portal_db_interface.type_ IS '类型';
COMMENT ON COLUMN portal_db_interface.dsalias_ IS '数据源的别名';
COMMENT ON COLUMN portal_db_interface.need_page_ IS '是否需要分页';
COMMENT ON COLUMN portal_db_interface.page_size_ IS '分页大小';
COMMENT ON COLUMN portal_db_interface.obj_name_ IS '表名或者视图名';
COMMENT ON COLUMN portal_db_interface.displayfield_ IS '显示字段';
COMMENT ON COLUMN portal_db_interface.resultfield_ IS '返回字段';
COMMENT ON COLUMN portal_db_interface.conditionfield_ IS '条件字段';
COMMENT ON COLUMN portal_db_interface.sortfield_ IS '排序字段';
COMMENT ON COLUMN portal_db_interface.is_table_ IS '是否数据库表 0视图1数据库表';
COMMENT ON COLUMN portal_db_interface.diy_sql_ IS '自定义sql';
COMMENT ON COLUMN portal_db_interface.sql_build_type_ IS 'SQL构建类型';
COMMENT ON COLUMN portal_db_interface.create_by_ IS '创建人';
COMMENT ON COLUMN portal_db_interface.create_org_id_ IS '创建人组织ID';
COMMENT ON COLUMN portal_db_interface.create_time_ IS '创建时间';
COMMENT ON COLUMN portal_db_interface.update_by_ IS '更新人';
COMMENT ON COLUMN portal_db_interface.update_time_ IS '更新时间';
COMMENT ON COLUMN portal_db_interface.revision_ IS '乐观锁';
COMMENT ON COLUMN portal_db_interface.is_dele_ IS '是否删除，0未删，1已删';
COMMENT ON COLUMN portal_db_interface.tenant_id_ IS '租户ID';

DROP TABLE IF EXISTS portal_restful_interface;
CREATE TABLE portal_restful_interface(
    id_ VARCHAR(64) NOT NULL,
    ref_id_ VARCHAR(64),
    url_ VARCHAR(200),
    header_ VARCHAR(500),
    token_auth_ VARCHAR(1),
    request_type_ VARCHAR(60),
    content_type_ VARCHAR(60),
    request_params_ VARCHAR(900),
    list_key_ VARCHAR(50),
    resultfield_ TEXT,
    conditionfield_ TEXT,
    data_param_ VARCHAR(2000),
    create_by_ VARCHAR(64),
    create_org_id_ VARCHAR(64),
    create_time_ DATE,
    update_by_ VARCHAR(64),
    update_time_ DATE,
    revision_ VARCHAR(32),
    is_dele_ VARCHAR(1),
    tenant_id_ VARCHAR(64),
    PRIMARY KEY (id_)
);

COMMENT ON TABLE portal_restful_interface IS 'restful接口';
COMMENT ON COLUMN portal_restful_interface.id_ IS '主键';
COMMENT ON COLUMN portal_restful_interface.ref_id_ IS '外键';
COMMENT ON COLUMN portal_restful_interface.url_ IS '接口地址';
COMMENT ON COLUMN portal_restful_interface.header_ IS '接口头部';
COMMENT ON COLUMN portal_restful_interface.token_auth_ IS '是否token认证，0：否，1：是';
COMMENT ON COLUMN portal_restful_interface.request_type_ IS '请求方式';
COMMENT ON COLUMN portal_restful_interface.content_type_ IS '请求头的Content-type类型';
COMMENT ON COLUMN portal_restful_interface.request_params_ IS '请求参数 可以根据输入参数替换';
COMMENT ON COLUMN portal_restful_interface.list_key_ IS '列表(key)';
COMMENT ON COLUMN portal_restful_interface.resultfield_ IS '返回字段';
COMMENT ON COLUMN portal_restful_interface.conditionfield_ IS '条件字段';
COMMENT ON COLUMN portal_restful_interface.data_param_ IS '接口参数';
COMMENT ON COLUMN portal_restful_interface.create_by_ IS '创建人';
COMMENT ON COLUMN portal_restful_interface.create_org_id_ IS '创建人组织ID';
COMMENT ON COLUMN portal_restful_interface.create_time_ IS '创建时间';
COMMENT ON COLUMN portal_restful_interface.update_by_ IS '更新人';
COMMENT ON COLUMN portal_restful_interface.update_time_ IS '更新时间';
COMMENT ON COLUMN portal_restful_interface.revision_ IS '乐观锁';
COMMENT ON COLUMN portal_restful_interface.is_dele_ IS '是否删除，0未删，1已删';
COMMENT ON COLUMN portal_restful_interface.tenant_id_ IS '租户ID';

DROP TABLE IF EXISTS portal_service_choreography;
CREATE TABLE portal_service_choreography(
    id_ VARCHAR(64) NOT NULL,
    ref_id_ VARCHAR(64),
    name_ VARCHAR(60),
    alias_ VARCHAR(60),
    desc_ VARCHAR(200),
    flow_data_json_ TEXT,
    status_ VARCHAR(1),
    create_by_ VARCHAR(64),
    create_org_id_ VARCHAR(64),
    create_time_ DATE,
    update_by_ VARCHAR(64),
    update_time_ DATE,
    revision_ VARCHAR(64),
    is_dele_ VARCHAR(1),
    tenant_id_ VARCHAR(64),
    PRIMARY KEY (id_)
);

COMMENT ON TABLE portal_service_choreography IS '服务编排';
COMMENT ON COLUMN portal_service_choreography.id_ IS '主键';
COMMENT ON COLUMN portal_service_choreography.ref_id_ IS '外键';
COMMENT ON COLUMN portal_service_choreography.name_ IS '名称';
COMMENT ON COLUMN portal_service_choreography.alias_ IS '别名';
COMMENT ON COLUMN portal_service_choreography.desc_ IS '描述';
COMMENT ON COLUMN portal_service_choreography.flow_data_json_ IS '流程数据信息';
COMMENT ON COLUMN portal_service_choreography.status_ IS '启用状态1启用 0禁用';
COMMENT ON COLUMN portal_service_choreography.create_by_ IS '创建人';
COMMENT ON COLUMN portal_service_choreography.create_org_id_ IS '创建人组织ID';
COMMENT ON COLUMN portal_service_choreography.create_time_ IS '创建时间';
COMMENT ON COLUMN portal_service_choreography.update_by_ IS '更新人';
COMMENT ON COLUMN portal_service_choreography.update_time_ IS '更新时间';
COMMENT ON COLUMN portal_service_choreography.revision_ IS '乐观锁';
COMMENT ON COLUMN portal_service_choreography.is_dele_ IS '是否删除，0未删，1已删';
COMMENT ON COLUMN portal_service_choreography.tenant_id_ IS '租户ID';

DROP TABLE IF EXISTS portal_restful_manage;
CREATE TABLE portal_restful_manage(
    id_ VARCHAR(64) NOT NULL,
    base_url VARCHAR(200),
    create_by_ VARCHAR(64),
    create_org_id_ VARCHAR(64),
    create_time_ DATE,
    update_by_ VARCHAR(64),
    update_time_ DATE,
    status_ VARCHAR(1),
    revision_ VARCHAR(32),
    is_dele_ VARCHAR(1),
    tenant_id_ VARCHAR(64),
    PRIMARY KEY (id_)
);

COMMENT ON TABLE portal_restful_manage IS 'restful管理';
COMMENT ON COLUMN portal_restful_manage.id_ IS '主键';
COMMENT ON COLUMN portal_restful_manage.base_url IS '基础地址';
COMMENT ON COLUMN portal_restful_manage.create_by_ IS '创建人';
COMMENT ON COLUMN portal_restful_manage.create_org_id_ IS '创建人组织ID';
COMMENT ON COLUMN portal_restful_manage.create_time_ IS '创建时间';
COMMENT ON COLUMN portal_restful_manage.update_by_ IS '更新人';
COMMENT ON COLUMN portal_restful_manage.update_time_ IS '更新时间';
COMMENT ON COLUMN portal_restful_manage.status_ IS '启用状态1启用 0禁用';
COMMENT ON COLUMN portal_restful_manage.revision_ IS '乐观锁';
COMMENT ON COLUMN portal_restful_manage.is_dele_ IS '是否删除，0未删，1已删';
COMMENT ON COLUMN portal_restful_manage.tenant_id_ IS '租户号';

DROP TABLE IF EXISTS portal_service_log;
CREATE TABLE portal_service_log(
    id_ VARCHAR(64) NOT NULL,
    alias_ VARCHAR(60),
    proc_def_id_ VARCHAR(64),
    proc_def_key_ VARCHAR(128),
    proc_def_name_ VARCHAR(200),
    subject_ VARCHAR(600),
    sup_inst_id_ VARCHAR(64),
    proc_inst_id_ VARCHAR(64),
    task_id_ VARCHAR(64),
    node_id_ VARCHAR(64),
    node_name_ VARCHAR(200),
    user_id_ VARCHAR(64),
    user_account_ VARCHAR(60),
    user_name_ VARCHAR(200),
    type_ VARCHAR(10),
    is_success_ VARCHAR(1),
    response_ TEXT,
    call_time_ DATE,
    revision_ VARCHAR(64),
    tenant_id_ VARCHAR(64),
    PRIMARY KEY (id_)
);

COMMENT ON TABLE portal_service_log IS '服务调用日志';
COMMENT ON COLUMN portal_service_log.id_ IS '主键';
COMMENT ON COLUMN portal_service_log.alias_ IS '别名';
COMMENT ON COLUMN portal_service_log.proc_def_id_ IS '流程定义ID';
COMMENT ON COLUMN portal_service_log.proc_def_key_ IS '流程定义Key';
COMMENT ON COLUMN portal_service_log.proc_def_name_ IS '流程名称';
COMMENT ON COLUMN portal_service_log.subject_ IS '流程标题';
COMMENT ON COLUMN portal_service_log.sup_inst_id_ IS '父流程实例ID';
COMMENT ON COLUMN portal_service_log.proc_inst_id_ IS '流程实例ID';
COMMENT ON COLUMN portal_service_log.task_id_ IS '任务ID';
COMMENT ON COLUMN portal_service_log.node_id_ IS '节点ID';
COMMENT ON COLUMN portal_service_log.node_name_ IS '节点名称';
COMMENT ON COLUMN portal_service_log.user_id_ IS '用户ID';
COMMENT ON COLUMN portal_service_log.user_account_ IS '用户账号';
COMMENT ON COLUMN portal_service_log.user_name_ IS '用户名称';
COMMENT ON COLUMN portal_service_log.type_ IS '类型（interface：接口，service：服务）';
COMMENT ON COLUMN portal_service_log.is_success_ IS '是否调用成功';
COMMENT ON COLUMN portal_service_log.response_ IS '调用结果';
COMMENT ON COLUMN portal_service_log.call_time_ IS '调用时间';
COMMENT ON COLUMN portal_service_log.revision_ IS '乐观锁';
COMMENT ON COLUMN portal_service_log.tenant_id_ IS '租户号';

-- tangxin 2021-09-30 添加服务编排初始化数据
INSERT INTO PORTAL_SYS_TYPE_GROUP(ID_, GROUP_KEY_, NAME_, FLAG_, SN_, TYPE_, CREATE_BY_, CREATE_TIME_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_) VALUES ('15', 'CONNECT_TYPE', '连接分类', 1, 0, 1, NULL, NULL, NULL, NULL, NULL);
INSERT INTO PORTAL_SYS_TYPE(ID_, TYPE_GROUP_KEY_, NAME_, TYPE_KEY_, STRU_TYPE_, PARENT_ID_, DEPTH_, PATH_, IS_LEAF_, OWNER_ID_, SN_, CREATE_BY_, CREATE_TIME_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, ICON_, TENANT_ID_) VALUES ('31130', 'CONNECT_TYPE', '默认分类', 'default', '1', '15', 1, '15.31130.', 'Y', '0', 0, '1', NULL, '', NULL, NULL, NULL, '-1');

-- tangxin 2021-09-30 去掉数据源菜单，调整企微钉钉菜单位置
DELETE FROM PORTAL_SYS_MENU WHERE ALIAS_ = 'sysExternalUniteList';
DELETE FROM PORTAL_SYS_MENU WHERE ALIAS_ = 'dataSourceManager';

-- tangxin 2021-09-30 添加集成中心菜单
INSERT INTO PORTAL_SYS_MENU(ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, ROUTE_EXTEND_, TENANT_ID_) VALUES ('1437982148582154240', '1', '集成中心', 'IntegratedCenter', '', '', NULL, 4, '', '-1.1.1437982148582154240.', '', NULL, '-1');
INSERT INTO PORTAL_SYS_MENU(ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, ROUTE_EXTEND_, TENANT_ID_) VALUES ('1437975457390284800', '1437982148582154240', '集成管理', 'integratorManage', 'connectionManager', '', NULL, 1, '', '-1.1.1437982148582154240.1437975457390284800.', '', NULL, '-1');
INSERT INTO PORTAL_SYS_MENU(ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, ROUTE_EXTEND_, TENANT_ID_) VALUES ('1442676643885162496', '1437975457390284800', '连接管理', 'connectionManager', '', '', NULL, 1, '', '-1.1.1437982148582154240.1437975457390284800.1442676643885162496.', '', NULL, '-1');
INSERT INTO PORTAL_SYS_MENU(ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, ROUTE_EXTEND_, TENANT_ID_) VALUES ('1442676693583470592', '1437975457390284800', '接口管理', 'interfaceManage', '', '', NULL, 2, '', '-1.1.1437982148582154240.1437975457390284800.1442676693583470592.', '', NULL, '-1');
INSERT INTO PORTAL_SYS_MENU(ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, ROUTE_EXTEND_, TENANT_ID_) VALUES ('1442676731843911680', '1437975457390284800', '服务编排', 'serviceChoreography', '', '', NULL, 3, '', '-1.1.1437982148582154240.1437975457390284800.1442676731843911680.', '', NULL, '-1');
INSERT INTO PORTAL_SYS_MENU(ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, ROUTE_EXTEND_, TENANT_ID_) VALUES ('1285866673655648256', '1437982148582154240', '企微钉钉', 'sysExternalUniteList', '', '', NULL, 2, '', '-1.1.1437982148582154240.1285866673655648256.', '', NULL, '-1');
INSERT INTO PORTAL_SYS_MENU(ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, ROUTE_EXTEND_, TENANT_ID_) VALUES ('1437738312683724800', '1437982148582154240', '外部系统管理', 'externalSystem', '', '', NULL, 3, '', '-1.1.1437982148582154240.1437738312683724800.', '', NULL, '-1');

-- chenzm 流程按钮初始化表结构和数据
DROP TABLE IF EXISTS bpm_flow_default_button;
CREATE TABLE bpm_flow_default_button(
    ID_ VARCHAR(64) NOT NULL,
    NAME_ VARCHAR(64) NOT NULL,
    ALIAS_ VARCHAR(64) NOT NULL,
    BEFORESCRIPT_ TEXT(65535),
    AFTERSCRIPT_ TEXT(65535),
    GROOVYSCRIPT_ TEXT(65535),
    COMPLETEEVENTGROOVYSCRIPT_ TEXT(65535),
    REJECTMODE_ VARCHAR(64),
    REJECTNODE_ VARCHAR(64),
    ISLOCK_ INT(11),
    SUPPORTSCRIPT_ INT(11),
    MSGCONFIG_ VARCHAR(255),
    TYPE_ VARCHAR(64),
    DISABLED_ INT(11),
    PRIMARY KEY (ID_)
);

COMMENT ON TABLE bpm_flow_default_button 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 '启用或者禁用';


CREATE UNIQUE INDEX PRIMARY ON bpm_flow_default_button(ID_);

INSERT INTO bpm_flow_default_button VALUES ('1', '启动', 'startFlow', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 1, '', 'start', 0);
INSERT INTO bpm_flow_default_button VALUES ('10', '签收', 'lockUnlock', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 0, '', 'userTask', 0);
INSERT INTO bpm_flow_default_button VALUES ('11', '保存', 'saveDraft', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 1, '', 'userTask', 0);
INSERT INTO bpm_flow_default_button VALUES ('12', '挂起', 'hangUp', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 0, '', 'userTask', 0);
INSERT INTO bpm_flow_default_button VALUES ('13', '取消挂起', 'cancelHangUp', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 0, '', 'userTask', 0);
INSERT INTO bpm_flow_default_button VALUES ('14', '反对', 'oppose', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 1, '', 'userTask', 0);
INSERT INTO bpm_flow_default_button VALUES ('15', '流转', 'startTrans', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 0, '', 'userTask', 0);
INSERT INTO bpm_flow_default_button VALUES ('16', '加签', 'addSign', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 0, '', 'userTask', 0);
INSERT INTO bpm_flow_default_button VALUES ('17', '终止', 'endProcess', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 1, '', 'userTask', 0);
INSERT INTO bpm_flow_default_button VALUES ('18', '传阅', 'instanceTrans', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 0, '', 'userTask', 1);
INSERT INTO bpm_flow_default_button VALUES ('19', '驳回发起人', 'backToStart', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 1, '', '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', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 1, '', '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', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 1, '', 'signTask', 1);
INSERT INTO bpm_flow_default_button VALUES ('28', '传阅', 'instanceTrans', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 0, '', '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', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 1, '', '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', '', '', '', '', 'backToStart,rejectPre,reject', '', 0, 1, '', '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);

-- chenzm  流程初始化按钮菜单
INSERT INTO  portal_sys_menu ( ID_ ,  PARENT_ID_ ,  NAME_ ,  ALIAS_ ,  ACTIVE_TAB_ ,  MENU_ICON_ ,  OPENED_ ,  SN_ ,  TABS_STYLE_ ,  PATH_ ,  HREF_ ,  TENANT_ID_ ,  ROUTE_EXTEND_ ) VALUES ('1430769509001445376', '3641025', '流程按钮', 'flowButtonManager', 'startTaskButtons', '', NULL, 6, '', '-1.1.3641025.1430769509001445376.', '', '-1', NULL);
INSERT INTO  portal_sys_menu  ( ID_ ,  PARENT_ID_ ,  NAME_ ,  ALIAS_ ,  ACTIVE_TAB_ ,  MENU_ICON_ ,  OPENED_ ,  SN_ ,  TABS_STYLE_ ,  PATH_ ,  HREF_ ,  TENANT_ID_ ,  ROUTE_EXTEND_ ) VALUES ('1430788426285563904', '1430769509001445376', '用户任务节点', 'userTaskButtons', '', '', NULL, 2, '', '-1.1.3641025.1430769509001445376.1430788426285563904.', '', '-1', NULL);
INSERT INTO  portal_sys_menu  ( ID_ ,  PARENT_ID_ ,  NAME_ ,  ALIAS_ ,  ACTIVE_TAB_ ,  MENU_ICON_ ,  OPENED_ ,  SN_ ,  TABS_STYLE_ ,  PATH_ ,  HREF_ ,  TENANT_ID_ ,  ROUTE_EXTEND_ ) VALUES ('1430788606049239040', '1430769509001445376', '会签任务节点', 'signTaskButtons', '', '', NULL, 3, '', '-1.1.3641025.1430769509001445376.1430788606049239040.', '', '-1', NULL);
INSERT INTO  portal_sys_menu  ( ID_ ,  PARENT_ID_ ,  NAME_ ,  ALIAS_ ,  ACTIVE_TAB_ ,  MENU_ICON_ ,  OPENED_ ,  SN_ ,  TABS_STYLE_ ,  PATH_ ,  HREF_ ,  TENANT_ID_ ,  ROUTE_EXTEND_ ) VALUES ('1430789609448390656', '1430769509001445376', '开始任务节点', 'startTaskButtons', '', '', NULL, 1, '', '-1.1.3641025.1430769509001445376.1430789609448390656.', '', '-1', NULL);

-- chenzm  权限调整菜单
INSERT INTO  portal_sys_menu  ( ID_ ,  PARENT_ID_ ,  NAME_ ,  ALIAS_ ,  ACTIVE_TAB_ ,  MENU_ICON_ ,  OPENED_ ,  SN_ ,  TABS_STYLE_ ,  PATH_ ,  HREF_ ,  TENANT_ID_ ,  ROUTE_EXTEND_ ) VALUES ('1432175565783007232', '4073629', '权限调整', 'permissionAdjustmentManage', '', '', NULL, 4, '', '-1.1.3641025.4073629.1432175565783007232.', '', '-1', NULL);


/*
    2021-09-30 16:05 整合分界线
*/
-- chenzm  2021-10-14 前台菜单流程中心添加传阅事项
INSERT INTO portal_sys_menu (ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, TENANT_ID_, ROUTE_EXTEND_) VALUES ('1443153816786980864', '1441339605377536000', '传阅事项', 'circulateMatter', '', '', NULL, 5, '', '-1.3.1441339605377536000.1443153816786980864.', '', '-1', '{"path":"circulateMatter","component":"@/views/matter/circulateMatter","redirect":"","alwaysShow":false,"caseSensitive":false,"meta":{"title":"传阅事项","isChildren":true}}');

-- chenzm 2021-10-22 应用端获取待办列表字段显示配置时候固定的系统属性
INSERT INTO portal_sys_properties (ID, NAME, ALIAS, GROUP_, VALUE, ENCRYPT, DESCRIPTION, UPDATE_TIME_, CREATE_BY_, CREATE_TIME_, CREATE_ORG_ID_, UPDATE_BY_, TENANT_ID_) VALUES ('1448569683989442560', '待办列表字段显示配置', 'taskListFiledConf', NULL, 'bHfSv3x1fi+lJABUhmU8OeY08mPnTHxMWR1WRuHJKS+YRaSDGCyf8BgNKnk/fKbQ6GB5pHWcTo+Pv7lHddu4nR0yd0ZumquJU67O2r7qQsRL1iat2BjwCcvWIvV9R9fD7wB1PAmt1cZJVyEcqqR9MNjH1+rLhv0r/XXVUTo8DLRgFO3zWkBGqJVpKU2LKa6RKdIxeR7A5MkP3NcLLIjxF8Q4FgCrt+ocxpIvkSv9vGUagCMJdv+DO/5w3IHLiGBuOx9OzWcXxklfhuxxfPLRFBqnbSBjHl43GzCH4AAWNgoXvGWkdvJSqkb2sgme/tKrP6YXNuVGj5hluovbLbMRT8e4Ta8uqn9OB51DypxPdukgSkLw3QBa12S3TSQVXrx9GeM8skAX42N32OKxLj7R7fTtyyHuc9CHt50BMcV8TAdI8iSTmm78T/LmjcDT0H4hF7xlpHbyUqpG9rIJnv7Sqxl20VdLRQ8aM8QwNIdsOhJCa7ol0YM+plxudRs3v+EvbUpuU1ePW3KNbmprxbg1wC+kD+SwF+UcjNcjIj6/7nVMRp5f3d8yyR0pQRSz5l3SkTgstjiLwzfngj73eizXn6WRZuGdSbqdMLHsVKVViJRClggscn8OTNdmwbVFdsEFlOpXb2v/2yaBGiWdmSfM282c37fPM7mFxGFz7nHh992DvDITRvzwC4pl2TcgaO0QJ6K9cnwlMuSOkGT0ovfGdUQOnPoVwNwniZ/Mf04694p1GqR5RjWQ2rEDtMCfWygZg7wyE0b88AuKZdk3IGjtEHLApmqwDQbhbxVAFM0ww1HlybaTqIbqfSiUnJ3VKs1PbUpuU1ePW3KNbmprxbg1wBOtalPwYWjNBu6+Z7ISw1sEgsBSJvRwvBDd7TSVkGYFmoCBpC+qEK/RS9taMUB1ks4W8RU9PjyENMhwuFuIxeyX/9nyXAdUdMwA61xqpUv9+sKkmJOg9t63DzSmbU4PG7DDxg0kfk5mvFtFiezJBbzdOqF1UpiAO/YY4TyU2uR6YQkCZlC5adaDe2xePIjxo86bglQid98MXskEnk5+jhwk1aDDztDfYxDcdnZzSib0aS/flNo7z+gapOaVNzA1/TGyHy7ts0MortNHigKEVUSetBhFCxdZ60Dbkwmd12OBryb0F/G+hiG0cZKCBgF4EpqAgaQvqhCv0UvbWjFAdZLY6GafWiUlgkBTmejqa9zY', 1, '应用端待办列表字段显示配置', NULL, '1', '2021-10-14 16:41:40', '', NULL, NULL);


-- pangq 2021-10-25 表单列表添加数据源字段
ALTER TABLE  "FORM_DATA_TEMPLATE"
  ADD COLUMN "DS_NAME_" varchar(50);
COMMENT ON COLUMN "FORM_DATA_TEMPLATE"."DS_NAME_" IS '数据源名称';

-- pangq 2021-10-26 表单列表添加关联表字段
ALTER TABLE  "FORM_DATA_TEMPLATE"
  ADD COLUMN "JOIN_TABLES_" varchar(2000);
COMMENT ON COLUMN "FORM_DATA_TEMPLATE"."JOIN_TABLES_" IS '关联表';

-- zengst 2021-11-15 栏目布局添加版本号字段
ALTER TABLE portal_sys_layout_manage add VERSION_ INT;
COMMENT ON COLUMN portal_sys_layout_manage.VERSION_ IS '版本号'

-- yujul 2021-12-03 增加外部系统授权人的姓名字段
ALTER TABLE "PORTAL_BIZ_SYSTEM" ADD COLUMN "ROBOT_NAME_" VARCHAR(64) ;
COMMENT ON COLUMN "PORTAL_BIZ_SYSTEM"."ROBOT_NAME_" IS '授权人姓名';

-- yujl 2021-12-03 增加外部系统管理员表
DROP TABLE IF EXISTS portal_biz_system_auth;
CREATE TABLE portal_biz_system_auth(
               ID_ VARCHAR(64),
               SYS_CODE_ VARCHAR(50),
               SYS_NAME_ VARCHAR(50),
               MANAGER_ID_ VARCHAR(255),
               MANAGER_NAME_ VARCHAR(255),
               CREATE_TIME_ timestamp,
               CREATE_BY_ VARCHAR(255),
               CREATE_ORG_ID_ VARCHAR(255),
               IS_DELE_ VARCHAR(10),
               UPDATE_TIME_ timestamp,
               UPDATE_BY_ VARCHAR(64),
               TENANT_ID_ VARCHAR(255)
);

COMMENT ON TABLE portal_biz_system_auth IS '外部系统管理员表';

-- yujl 2021-12-03 新增【外部系统消息日志】菜单
INSERT INTO portal_sys_menu ( ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, ROUTE_EXTEND_, TENANT_ID_ )
VALUES
    ( '1467391005218881536', '5403008', '外部系统消息日志', 'externalSystemQueueLog', '', '', NULL, 7, '', '-1.1.3421053.5403008.1467391005218881536.', '', '{\"path\":\"\",\"component\":\"Layout\",\"redirect\":\"\",\"alwaysShow\":false,\"caseSensitive\":false,\"meta\":{\"title\":\"\"}}', '-1' );

-- jason 2021-12-10 新增表单脚本js字段
ALTER TABLE "form_history_record"
    ADD COLUMN "diy_js_" text;
COMMENT ON COLUMN "form_history_record"."diy_js_" IS '表单js脚本';

-- yujl 2021-12-18 增加外部系统管理员唯一索引
CREATE UNIQUE INDEX uni_auth ON portal_biz_system_auth (sys_code_,manager_id_);

-- zhqa 2022-1-20 流程图表添加别名字段
ALTER TABLE BPM_REPORT_LIST
ADD COLUMN ALIAS_ varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '别名' AFTER NAME_;

-- yujl 2021-01-26 关系矩阵添加搜索条件字段标识
ALTER TABLE uc_matrix_col_def
    ADD COLUMN SEARCH_FIELD_ varchar(50);
COMMENT ON COLUMN "uc_matrix_col_def"."search_field_" IS '是否作为搜索条件';

-- yujl 2022-01-24 新增在线用户管理菜单。目录：用户管理-在线用户
INSERT INTO portal_sys_menu(ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, TENANT_ID_) VALUES ('1376480241760997376', '3441027', '在线用户', 'onlineUserManager', '', '', NULL, 4, '', '-1.1.3441009.3441027.1376480241760997376.', '', '-1');


-- 2022-02-21 chenzm 新增扩展jar相关的菜单
INSERT INTO PORTAL_SYS_MENU(ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, TENANT_ID_) VALUES ('1351410819870625792', '4291768', '已发布脚本', 'extendClassManager', '', '', 1, 6, '', '-1.1.3641025.4291768.1351410819870625792.', '', '-1');
INSERT INTO PORTAL_SYS_MENU(ID_, PARENT_ID_, NAME_, ALIAS_, ACTIVE_TAB_, MENU_ICON_, OPENED_, SN_, TABS_STYLE_, PATH_, HREF_, TENANT_ID_) VALUES ('1351409335724544000', '4291768', '扩展Jar包管理', 'extendJarManager', '', '', 1, 5, '', '-1.1.3641025.4291768.1351409335724544000.', '', '-1');

-- 2022-02-21 chenzm  新增扩展jar包管理表
CREATE TABLE bpm_extend_class(
    ID_ VARCHAR(64) NOT NULL,
    JAR_ID_ VARCHAR(64),
    SIMPLE_NAME_ VARCHAR(255),
    PATH_ VARCHAR(500),
    DESC_ VARCHAR(255),
    MD5_ VARCHAR(255),
    TYPE_ VARCHAR(1),
    PRIMARY KEY (ID_)
);

COMMENT ON TABLE bpm_extend_class IS '已发布扩展脚本管理表';
COMMENT ON COLUMN bpm_extend_class.JAR_ID_ IS '所属jar包id';
COMMENT ON COLUMN bpm_extend_class.SIMPLE_NAME_ IS '类名首字母小写;即beanId';
COMMENT ON COLUMN bpm_extend_class.PATH_ IS '类名全路径';
COMMENT ON COLUMN bpm_extend_class.DESC_ IS '类描述';
COMMENT ON COLUMN bpm_extend_class.MD5_ IS 'MD5版本号';
COMMENT ON COLUMN bpm_extend_class.TYPE_ IS '脚本类型1：条件脚本;2：人员脚本';

-- 2022-02-21 chenzm  新增已发布扩展脚本管理表
CREATE TABLE bpm_extend_jar(
    ID_ VARCHAR(64) NOT NULL,
    NAME_ VARCHAR(255),
    DESC_ VARCHAR(255),
    JAR_FILE_ VARCHAR(2000),
    JAR_BYTES_ BYTEA,
    CREATE_BY_ VARCHAR(255),
    CREATE_NAME_ VARCHAR(255),
    UPDATE_BY_ VARCHAR(255),
    UPDATE_NAME_ VARCHAR(255),
    CREATE_TIME_ DATE,
    UPDATE_TIME_ DATE,
    SIZE_ INT,
    STATUS_ INT,
    PRIMARY KEY (ID_)
);

COMMENT ON TABLE bpm_extend_jar IS '扩展jar包管理表';
COMMENT ON COLUMN bpm_extend_jar.NAME_ IS 'jar包名称';
COMMENT ON COLUMN bpm_extend_jar.DESC_ IS 'jar包描述';
COMMENT ON COLUMN bpm_extend_jar.JAR_FILE_ IS 'jar包的附件路径';
COMMENT ON COLUMN bpm_extend_jar.JAR_BYTES_ IS 'jar包的二进制数据';
COMMENT ON COLUMN bpm_extend_jar.CREATE_BY_ IS '上传人id';
COMMENT ON COLUMN bpm_extend_jar.CREATE_NAME_ IS '上传人姓名';
COMMENT ON COLUMN bpm_extend_jar.UPDATE_BY_ IS '发布人id';
COMMENT ON COLUMN bpm_extend_jar.UPDATE_NAME_ IS '发布人姓名';
COMMENT ON COLUMN bpm_extend_jar.CREATE_TIME_ IS '创建时间';
COMMENT ON COLUMN bpm_extend_jar.UPDATE_TIME_ IS '更新时间';
COMMENT ON COLUMN bpm_extend_jar.SIZE_ IS 'jar包大小;kb)';
COMMENT ON COLUMN bpm_extend_jar.STATUS_ IS 'jar包状态。1：未发布;2：已发布';

-- 2022-2-21 新增流程发起人账号属性
ALTER TABLE BPM_PRO_INST
    ADD CREATE_ACCOUNT_ VARCHAR(64);
COMMENT ON COLUMN BPM_PRO_INST.CREATE_ACCOUNT_ IS '流程发起人账号';


-- 2022-03-03 zengst 一般用户添加默认菜单的权限
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092684890112', 'ybyh', 'matter', null, null, '-1');
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092705861632', 'ybyh', 'personal', null, null, '-1');
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092705861633', 'ybyh', 'appCenter1', null, null, '-1');
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092705861634', 'ybyh', 'new', null, null, '-1');
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092705861635', 'ybyh', 'myTask', null, null, '-1');
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092710055936', 'ybyh', 'apply', null, null, '-1');
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092710055937', 'ybyh', 'homePage', null, null, '-1');
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092714250240', 'ybyh', 'Index', null, null, '-1');
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092714250241', 'ybyh', 'setting', null, null, '-1');
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092718444544', 'ybyh', 'mail', null, null, '-1');
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092718444545', 'ybyh', 'appCenter2', null, null, '-1');
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092718444546', 'ybyh', 'personalCenter', null, null, '-1');
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092718444547', 'ybyh', 'approvalForm', null, null, '-1');
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092718444548', 'ybyh', 'circulateMatter', null, null, '-1');
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092722638848', 'ybyh', 'xxzx', null, null, '-1');
INSERT INTO portal_sys_role_auth (ID_, ROLE_ALIAS_, MENU_ALIAS_, METHOD_ALIAS_, DATA_PERMISSION_, TENANT_ID_) VALUES ('1499226092722638849', 'ybyh', 'startProcess', null, null, '-1');

-- 2022-04-08 yijj 新闻公告标签
create table PORTAL_NEWS_TAG (
  ID_ varchar(64) not null,
  NAME_ varchar(64),
  ALIAS_ varchar(64),
  STYLE_ varchar(255),
  TENANT_ID_ varchar(255),
  CREATE_TIME_ timestamp,
  CREATE_BY_ varchar(255),
  UPDATE_TIME_ timestamp,
  UPDATE_BY_ varchar(64),
  primary key (ID_)
) ;

-- 2022-04-08 yijj 新闻公告表新增字段
ALTER TABLE PORTAL_NEWS_NOTICE_ ADD ICON_COLOR_ VARCHAR(10);
COMMENT ON COLUMN PORTAL_NEWS_NOTICE_.ICON_COLOR_ IS '图标颜色';
ALTER TABLE PORTAL_NEWS_NOTICE_ ADD TAG_ VARCHAR(64);
COMMENT ON COLUMN PORTAL_NEWS_NOTICE_.TAG_ IS '标签';
ALTER TABLE PORTAL_NEWS_NOTICE_ ADD DEPARTMENT_ VARCHAR(255);
COMMENT ON COLUMN PORTAL_NEWS_NOTICE_.DEPARTMENT_ IS '拟稿人';
ALTER TABLE PORTAL_NEWS_NOTICE_ ADD PUBLISH_TIME_ timestamp;
COMMENT ON COLUMN PORTAL_NEWS_NOTICE_.PUBLISH_TIME_ IS '发布时间';


-- 2022-04-08 zengst pgsql缺失的内容
alter table form_data_template
    add join_tables_ varchar(2000);

comment on column form_data_template.join_tables_ is '关联表';

alter table portal_sys_layout_manage alter column "CREATE_TIME_" type timestamp using "CREATE_TIME_"::timestamp;

alter table portal_sys_layout_manage alter column "UPDATE_TIME_" type timestamp using "UPDATE_TIME_"::timestamp;

-- 2022-04-11 zengst pgsql 缺失内容
-- 重新添加formPrintTemplate的列
alter table form_print_template drop column "MAIN_SQL_LIST";

alter table form_print_template drop column "DATASOURCE_";

alter table form_print_template drop column "LABEL_CONFIG_";

alter table form_print_template drop column "DATASOURCE_FORM_";

alter table form_print_template drop column "TYPE_ID_";

alter table form_print_template drop column "TYPE_NAME_";

alter table form_print_template drop column "ALIAS_";

alter table form_print_template drop column "DESC_";

alter table form_print_template drop column "FILE_JSON_";

alter table form_print_template drop column "BO_DEF_IDS_";

alter table form_print_template drop column "NAME_";

alter table form_print_template
    add main_sql_list text;
alter table form_print_template
    add datasource_ varchar(64);
alter table form_print_template
    add label_config_ text;
alter table form_print_template
    add datasource_form_ varchar(10);
alter table form_print_template
    add type_id_ varchar(64);
alter table form_print_template
    add type_name_ varchar(64);
alter table form_print_template
    add name_ varchar(128);
alter table form_print_template
    add alias_ varchar(64);
alter table form_print_template
    add desc_ varchar(600);
alter table form_print_template
    add file_json_ text;
alter table form_print_template
    add bo_def_ids_ varchar(2000);
comment on column form_print_template.main_sql_list is 'sql集合';
comment on column form_print_template.datasource_ is '数据源别名';
comment on column form_print_template.label_config_ is '标签配置';
comment on column form_print_template.datasource_form_ is '数据来源 form-表单 db-数据库';
comment on column form_print_template.type_id_ is '分类id';
comment on column form_print_template.type_name_ is '分类名称';
comment on column form_print_template.name_ is '模板名称';
comment on column form_print_template.alias_ is '模板别名';
comment on column form_print_template.desc_ is '模板描述';
comment on column form_print_template.file_json_ is '模板文件json';
comment on column form_print_template.bo_def_ids_ is 'bo建模id数据（多个用逗号分隔）';

drop table if exists portal_biz_system  ;
CREATE TABLE portal_biz_system
(
    ID_            varchar(64) COLLATE "pg_catalog"."default",
    SYS_CODE_      varchar(50) COLLATE "pg_catalog"."default",
    SYS_NAME_      varchar(255) COLLATE "pg_catalog"."default",
    ENABLED_       varchar(10) COLLATE "pg_catalog"."default",
    SECRET_KEY_    varchar(255) COLLATE "pg_catalog"."default",
    MANAGER_ID_    varchar(255) COLLATE "pg_catalog"."default",
    MANAGER_NAME_  varchar(255) COLLATE "pg_catalog"."default",
    ROOT_ADDRESS_  varchar(255) COLLATE "pg_catalog"."default",
    HOME_ADDRESS_  varchar(255) COLLATE "pg_catalog"."default",
    BPM_MSG_QUEUE_ varchar(50) COLLATE "pg_catalog"."default",
    DESCRIPTION_   varchar(1000) COLLATE "pg_catalog"."default",
    ROBOT_ID_      varchar(255) COLLATE "pg_catalog"."default",
    CREATE_TIME_   timestamp(6),
    CREATE_BY_     varchar(255) COLLATE "pg_catalog"."default",
    CREATE_ORG_ID_ varchar(255) COLLATE "pg_catalog"."default",
    IS_DELE_       varchar(255) COLLATE "pg_catalog"."default",
    UPDATE_TIME_   timestamp(6),
    UPDATE_BY_     timestamp(6),
    ROBOT_NAME_    VARCHAR(64),
    TENANT_ID_     varchar(255) COLLATE "pg_catalog"."default"
)
;

ALTER TABLE portal_biz_system
    OWNER TO "postgres";

COMMENT ON COLUMN portal_biz_system.SYS_CODE_ IS '系统编码';

COMMENT ON COLUMN portal_biz_system .SYS_NAME_ IS '系统名称';

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

COMMENT ON COLUMN portal_biz_system .SECRET_KEY_ IS '系统密匙，用于鉴权';

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

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

COMMENT ON COLUMN portal_biz_system .ROOT_ADDRESS_ IS '用于其他地方拼接地址';

COMMENT ON COLUMN portal_biz_system .HOME_ADDRESS_ IS '系统首页地址';

COMMENT ON COLUMN portal_biz_system .BPM_MSG_QUEUE_ IS '流程消息队列';

COMMENT ON COLUMN portal_biz_system .DESCRIPTION_ IS '系统描述';

COMMENT ON COLUMN portal_biz_system.ROBOT_ID_ IS '机器人ID';

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

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

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

COMMENT ON COLUMN PORTAL_BIZ_SYSTEM.ROBOT_NAME_ IS '授权人姓名';

drop table if exists portal_sys_signet;
-- zhangxw 2020-12-25 添加印章管理模块sql
CREATE TABLE portal_sys_signet
(
    ID_            varchar(64) NOT NULL,
    ALIAS_         varchar(64),
    NAME_          varchar(64),
    FILE_ID_       varchar(64),
    DESC_          varchar(600),
    CREATE_BY_     varchar(64),
    CREATE_ORG_ID_ varchar(64),
    CREATE_TIME_   timestamp(6),
    UPDATE_BY_     timestamp(6),
    UPDATE_TIME_   timestamp(6),
    TENANT_ID_     varchar(64),
    PRIMARY KEY (ID_)
)
;

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

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

COMMENT ON COLUMN portal_sys_signet.NAME_ IS '印章名称';

COMMENT ON COLUMN portal_sys_signet.FILE_ID_ IS '印章附件id';

COMMENT ON COLUMN portal_sys_signet.DESC_ IS '印章描述';

COMMENT ON COLUMN portal_sys_signet.CREATE_BY_ IS '创建人id';

COMMENT ON COLUMN portal_sys_signet.CREATE_ORG_ID_ IS '创建人所属组织id';

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

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

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

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

ALTER TABLE PORTAL_SYS_COLUMN ADD SHOW_TITLE_ SMALLINT;
ALTER TABLE PORTAL_SYS_COLUMN ADD CONTAIN_COL_ VARCHAR(2000);
ALTER TABLE PORTAL_SYS_COLUMN ADD APPID_ VARCHAR(255);
ALTER TABLE PORTAL_SYS_COLUMN ADD SECRET_ VARCHAR(255);
COMMENT ON COLUMN PORTAL_SYS_COLUMN.SHOW_TITLE_ IS '是否 显示栏目名称';
COMMENT ON COLUMN PORTAL_SYS_COLUMN.CONTAIN_COL_ IS '组合栏目包含子栏目别名（逗号分隔）';
COMMENT ON COLUMN PORTAL_SYS_COLUMN.APPID_ IS '公众号appid';
COMMENT ON COLUMN PORTAL_SYS_COLUMN.SECRET_ IS '公众号secret';

-- 连接管理的query报错
alter table portal_connection_manager alter column create_time_ type timestamp using create_time_::timestamp;

alter table portal_connection_manager alter column revision_ type timestamp using revision_::timestamp;

-- 2021-09-30 yujl 外部接口授权记录表
drop table if exists portal_url_permission;
CREATE TABLE portal_url_permission
(
    ID             varchar(64) COLLATE pg_catalog.default NOT NULL,
    SYS_ID_        varchar(64),
    MODULE_        varchar(255),
    FUNCTION_      varchar(50),
    AUTH_URL_      varchar(255),
    CREATE_TIME_   timestamp,
    CREATE_BY_     varchar(255),
    CREATE_ORG_ID_ varchar(255),
    TENANT_ID_     varchar(255),
    DESCRIPTION_   varchar(255),
    CONSTRAINT portal_url_permission_key PRIMARY KEY (ID)
)
;

ALTER TABLE portal_url_permission
    OWNER TO postgres;

CREATE UNIQUE INDEX uniqueIndex ON portal_url_permission USING btree (
    SYS_ID_ COLLATE pg_catalog.default
    pg_catalog.text_ops ASC NULLS LAST,
    AUTH_URL_ COLLATE pg_catalog.default
    pg_catalog.text_ops ASC NULLS LAST
    );

COMMENT ON COLUMN portal_url_permission.SYS_ID_ IS '授权系统ID';

COMMENT ON COLUMN portal_url_permission.MODULE_ IS '所属模块';

COMMENT ON COLUMN portal_url_permission.FUNCTION_ IS '所属功能';

COMMENT ON COLUMN portal_url_permission.AUTH_URL_ IS '接口授权路径';

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

COMMENT ON COLUMN portal_url_permission.DESCRIPTION_ IS '接口描述';

COMMENT ON INDEX uniqueIndex IS '联合索引，保证数据唯一性';


drop table if exists uc_matrix_proc_relation;
CREATE TABLE uc_matrix_proc_relation (
  id_ varchar(64) NOT NULL,
  matrix_code_ varchar(255),
  proc_def_key_ varchar(64),
  proc_def_name_ varchar(64),
  tenant_id_ varchar(64),
  PRIMARY KEY (id_)
);
COMMENT ON COLUMN uc_matrix_proc_relation.id_ IS 'id';
COMMENT ON COLUMN uc_matrix_proc_relation.matrix_code_ IS '矩阵编码';
COMMENT ON COLUMN uc_matrix_proc_relation.proc_def_key_ IS '流程定义key';
COMMENT ON COLUMN uc_matrix_proc_relation.proc_def_name_ IS '流程定义名称';
COMMENT ON COLUMN uc_matrix_proc_relation.tenant_id_ IS '租户id';

alter table uc_matrix drop column if exists enabled_;
ALTER TABLE uc_matrix
  ADD COLUMN enabled_ int4 DEFAULT 1;
COMMENT ON COLUMN uc_matrix.enabled_ IS '是否启用: 0禁用 1启用';


alter table uc_matrix_col_def drop column if exists SEARCH_FIELD_;
-- yujl 2021-01-26 关系矩阵添加搜索条件字段标识
ALTER TABLE uc_matrix_col_def
    ADD COLUMN SEARCH_FIELD_ varchar(50);
COMMENT ON COLUMN uc_matrix_col_def.search_field_ IS '是否作为搜索条件';

alter table portal_sys_layout_manage
    drop column if exists TYPE_;
alter table portal_sys_layout_manage
    drop column if exists AS_TEMPLATE_;
alter table portal_sys_layout_manage
    drop column if exists CREATE_TIME_;
alter table portal_sys_layout_manage
    drop column if exists UPDATE_TIME_;
alter table portal_sys_layout_manage
    drop column if exists CREATE_BY_;
alter table portal_sys_layout_manage
    drop column if exists UPDATE_BY_;
alter table portal_sys_layout_manage
    drop column if exists CREATE_ORG_ID_;
alter table portal_sys_layout_manage
    drop column if exists SCREEN_CAPTURE_ID_;

ALTER TABLE portal_sys_layout_manage
    ADD COLUMN TYPE_              varchar(20),
    ADD COLUMN AS_TEMPLATE_       int2,
    ADD COLUMN CREATE_TIME_       timestamp,
    ADD COLUMN UPDATE_TIME_       timestamp,
    ADD COLUMN CREATE_BY_         varchar(64),
    ADD COLUMN UPDATE_BY_         varchar(64),
    ADD COLUMN CREATE_ORG_ID_     varchar(64),
    ADD COLUMN SCREEN_CAPTURE_ID_ varchar(64);
COMMENT ON COLUMN portal_sys_layout_manage.TYPE_ IS '布局类型：column（栏目），datav（大屏）';
COMMENT ON COLUMN portal_sys_layout_manage.AS_TEMPLATE_ IS '是否发布为模板(1=是，0=否)';
COMMENT ON COLUMN portal_sys_layout_manage.CREATE_TIME_ IS '创建时间';
COMMENT ON COLUMN portal_sys_layout_manage.UPDATE_TIME_ IS '更新时间';
COMMENT ON COLUMN portal_sys_layout_manage.CREATE_BY_ IS '创建人id';
COMMENT ON COLUMN portal_sys_layout_manage.UPDATE_BY_ IS '更新人id';
COMMENT ON COLUMN portal_sys_layout_manage.CREATE_ORG_ID_ IS '创建人所属组织id';
COMMENT ON COLUMN portal_sys_layout_manage.SCREEN_CAPTURE_ID_ IS '截图附件id';


-- wanghb 知会任务表新增OPINION_ID_字段
alter table bpm_task_notice drop column if exists "OPINION_ID_";
ALTER TABLE bpm_task_notice  ADD COLUMN OPINION_ID_ varchar(64);

-- jjx 内部消息地址修改
UPDATE PORTAL_SYS_MSG_TPL SET PLAIN_ = '审批提醒，您有新的工作流需要审批：${taskSubject}。', HTML_ = '<p>审批提醒：<br/>您有新的工作流需要审批<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a></p>' WHERE ID_ = '13';

UPDATE  PORTAL_SYS_PROPERTIES SET VALUE = 'front' WHERE ID = '22';
UPDATE  PORTAL_SYS_PROPERTIES  SET VALUE = 'mobile' WHERE ID  = '23';




-- 2022-05-05 yijj 增加target_node_目标节点字段
alter table BPM_EXE_STACK_EXECUTOR
	add TARGET_NODE_ varchar(64);
comment on column BPM_EXE_STACK_EXECUTOR.TARGET_NODE_ is '目标节点';


-- 2022-06-01 待办事项标题 存储字段长度不够，影响启动流程
alter table bpm_task alter column subject_ type varchar(256) using subject_::varchar(256);
alter table BPM_PRO_INST alter column SUBJECT_  type VARCHAR(256) using subject_::varchar(256);


-- 2022-06-06 jjx 内部消息链接地址修改
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '任务创${instSubject}建通知', PLAIN_ = '任务创建：流程实例：${instSubject}，执行到${nodeName}', HTML_ = '<p>任务创建：流程实例<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${instSubject}</a>，执行到${nodeName}</p>' WHERE ID_ = '1';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '流程实例抄送', PLAIN_ = '流程实例抄送：流程${taskSubject}的${instId}实例，已经抄送给您。', HTML_ = '<p>流程实例抄送：流程<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?readId=${readId}&instId=${instId}&from=received&receivedStatus=COPYTO&isRead=0" target="_self">${taskSubject}</a>的${instId}实例，已经抄送给您。</p>' WHERE ID_ = '10';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '驳回提醒', PLAIN_ = '驳回提醒，您的：${taskSubject}，请求被驳回，请处理!', HTML_ = '<p>驳回提醒：<br/>您的<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>请求被驳回，请处理!</p>'  WHERE ID_ = '14';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '流程人工终止结束通知', PLAIN_ = '流程实例人工终止结束通知：${instSubject}，意见:${cause}。', HTML_ = '<p>流程实例结束<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?instId=${instId}&type=request" target="_self">${taskSubject}</a>，意见:${cause}。</p>'  WHERE ID_ = '17';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '流程终止恢复通知', PLAIN_ = '流程实例终止恢复通知：${instSubject}，意见:${cause}。', HTML_ = '<p>流程实例已恢复运行中状态<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?instId=${instId}&type=request" target="_self">${instSubject}</a>，意见:${cause}。</p>'  WHERE ID_ = '20';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '设置任务执行人通知', PLAIN_ = '设置任务执行人：${taskSubject}，意见:${cause}。', HTML_ = '<p>设置任务执行人：<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>，意见:${cause}。</p>'  WHERE ID_ = '21';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '任务转交通知', PLAIN_ = '任务转交：流程实例：${instSubject}的${nodeName}任务，已经转交给你办理。', HTML_ = '<p>任务转交：流程实例<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>，需要你办理。</p>'  WHERE ID_ = '6';

-- 2022-06-08 liangjc删除 任务并行审批默认、撤销并行审批默认、任务驳回默认 配置
DELETE FROM	portal_sys_msg_tpl WHERE	ID_ IN ('18','19','9');
-- 2022-06-08 删除的消息模板：任务创建默认、任务完成默认、任务并行审批默认、撤销并行审批默认、撤销流转默认、任务驳回默认  update by ouyanggaolong
DELETE FROM portal_sys_msg_tpl where KEY_ in ('taskcreate-default', 'taskcomplete-default', 'bpmnTaskApproveLine-default', 'bpmnTaskApproveLineCancel-default', 'bpmtranscancel-default','taskback-default');

-- 2022-06-10 jjx 内部消息链接地址和提示内容修改
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '流程实例抄送', PLAIN_ = '流程实例抄送：流程${taskSubject}的${instId}实例，已经抄送给您。', HTML_ = '<p>流程实例抄送：</p><p>流程<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?readId=${readId}&instId=${instId}&from=received&receivedStatus=COPYTO&isRead=0" target="_self">${taskSubject}</a>的${instId}实例，已经抄送给您</p>' WHERE ID_ = '10';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '流程结束通知', PLAIN_ = '流程实例结束：${instSubject}，意见:${cause}。', HTML_ = '<p>流程实例结束</p><p>${instSubject}，意见:${cause}</p>' WHERE ID_ = '11';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '审批提醒', PLAIN_ = '审批提醒，您有新的工作流需要审批：${taskSubject}。', HTML_ = '<p>审批提醒：<br/>您有新的工作流需要审批<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a></p>' WHERE ID_ = '13';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '驳回提醒', PLAIN_ = '驳回提醒，您的：${taskSubject}，请求被驳回，请处理!', HTML_ = '<p>驳回提醒：<br/>您的<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>请求被驳回，请处理!</p>' WHERE ID_ = '14';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '撤销提醒', PLAIN_ = '撤销提醒，审批任务${taskSubject}被撤销，撤销原因${cause} 原因通过cmd获取。', HTML_ = '<p>撤销提醒：<br/>审批任务${taskSubject}被撤销，撤销原因${cause}</p>' WHERE ID_ = '15';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '代理任务审批', PLAIN_ = '代理任务审批，您有新的代理任务需要审批：${taskSubject}，委托人${delegate}.', HTML_ = '<p>代理任务审批：<br/>您有新的代理任务需要审批<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>，委托人${delegate}</p>' WHERE ID_ = '16';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '流程人工终止结束通知', PLAIN_ = '流程实例人工终止结束通知：${instSubject}，意见:${cause}。', HTML_ = '<p>人工终止结束通知:</p><p>流程实例结束<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?instId=${instId}&type=request" target="_self">${taskSubject}</a>，意见:${cause}</p>' WHERE ID_ = '17';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '任务沟通', PLAIN_ = '任务沟通提醒，${receiver}您好,任务：${taskSubject}需要与您交流，请给出意见。', HTML_ = '<p>任务沟通提醒:</p><p>${receiver}您好,任务：${taskSubject}需要与您交流，请给出意见</p>' WHERE ID_ = '2';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '流程终止恢复通知', PLAIN_ = '流程实例终止恢复通知：${instSubject}，意见:${cause}。', HTML_ = '<p>流程终止恢复通知:</p><p>流程实例已恢复运行中状态<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?instId=${instId}&type=request" target="_self">${instSubject}</a>，意见:${cause}</p>' WHERE ID_ = '20';
UPDATE portal_sys_msg_tpl SET SUBJECT_ = '设置任务执行人通知', PLAIN_ = '设置任务执行人：${taskSubject}，意见:${cause}。', HTML_ = '<p>设置任务执行人通知:</p><p>设置任务执行人：<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>，意见:${cause}</p>'WHERE ID_ = '21';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '通知被代理人', PLAIN_ = '代理通知，您的任务：${taskSubject}，代理给${agent}', HTML_ = '<p>代理通知：<br/>您的任务<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>，代理给${agent}</p>' WHERE ID_ = '3';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '通知沟通人nn', PLAIN_ = '流程任务沟通 已经给出意见n', HTML_ = '<p>沟通反馈提醒:</p><p>实例${taskSubject}发起的沟通，已给出意见</p><p><br/></p><p><br/></p><p><br/></p>' WHERE ID_ = '4';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '任务流转默认', PLAIN_ = '${cause}', HTML_ = '<p>任务流转通知：</p><p><a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>的${nodeName}任务，已经流转给您</p>' WHERE ID_ = '5';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '任务转交通知', PLAIN_ = '任务转交：流程实例：${instSubject}的${nodeName}任务，已经转交给你办理。', HTML_ = '<p>任务转交：</p><p>流程实例<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>，需要您办理</p>' WHERE ID_ = '6';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '加签通知', PLAIN_ = '加签通知，${sender}将任务：${taskSubject}转交给您', HTML_ = '<p>加签通知：<br/>${sender}邀请您参与会签任务<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>,加签原因:${cause}</p>' WHERE ID_ = '7';


-- 2022-06-17 jjx 待办列表字段显示配置 创建人改为发起人，创建时间改为发起时间
update portal_sys_properties set value='bHfSv3x1fi+lJABUhmU8OeY08mPnTHxMWR1WRuHJKS+YRaSDGCyf8BgNKnk/fKbQ6GB5pHWcTo+Pv7lHddu4nR0yd0ZumquJU67O2r7qQsRL1iat2BjwCcvWIvV9R9fD7wB1PAmt1cZJVyEcqqR9MNjH1+rLhv0r/XXVUTo8DLRgFO3zWkBGqJVpKU2LKa6RKdIxeR7A5MkP3NcLLIjxF8Q4FgCrt+ocxpIvkSv9vGUagCMJdv+DO/5w3IHLiGBuOx9OzWcXxklfhuxxfPLRFBqnbSBjHl43GzCH4AAWNgoXvGWkdvJSqkb2sgme/tKrP6YXNuVGj5hluovbLbMRT8e4Ta8uqn9OB51DypxPdukgSkLw3QBa12S3TSQVXrx9GeM8skAX42N32OKxLj7R7TAcvC+iMPwVq8TFkhb3SQhI8iSTmm78T/LmjcDT0H4hF7xlpHbyUqpG9rIJnv7Sqxl20VdLRQ8aM8QwNIdsOhKhgsYfdoBs+eD/Fk0xqjSabUpuU1ePW3KNbmprxbg1wC+kD+SwF+UcjNcjIj6/7nVMRp5f3d8yyR0pQRSz5l3SkTgstjiLwzfngj73eizXn6WRZuGdSbqdMLHsVKVViJRClggscn8OTNdmwbVFdsEFlOpXb2v/2yaBGiWdmSfM282c37fPM7mFxGFz7nHh990gSkLw3QBa12S3TSQVXrx9DJnpKUGaQZHEzYWjEXVBLkdRpTqcFOPjRAEJjpVi3clSiAkfCZcGKRp6Ugwf6/Bn1ngz9wERdjLlLlf56GNFhUM3DSSxmT1rpmA0JJwNkBaCImFPIWpwhftQbzuJ0xNmpZFm4Z1Jup0wsexUpVWIlKjQ4qbESycD7fe2p7W9blmGsYCOcJXtxHQzowIk4pxiNCX5GkrEOAa+Tyj/kRXYDPqFUiCjPAPYRKlflrVnZBC6xqRt6kt/5nduMKOipOenaaInvNpSjKYprFQPmwD1dZ7pCX+Qx6B2UO5yxznscSQuIyXjjKyf713dIpwHlagM8wfY2NHpTB+WIn1nG0fuvimBx5v4jbcpQrzV6KRls9SC95tjl931qXom3ADdeFuCuNxYc1rJR0S8gwngwSZ1FI75hKGF0dIn7F2DZltLlTXdbMBihFzRPf/3k++JlsfcGFRrhMFE91P5tMnxeMg/OjQl+RpKxDgGvk8o/5EV2AyKNGycHsftMAoUaAP02Lzv' where alias = 'taskListFiledConf';

-- 2022-06-17 jjx 修改领导秘书配置保存流程信息的字段长度
alter table bpm_secretary_manage alter column share_key_ type varchar(4000) using share_key_::varchar(4000);

-- 2022-06-23 wanghb 修改接口管理表创建时间和更新时间的类型
alter table portal_interface_manager alter column create_time_ type timestamp using create_time_::timestamp;
alter table portal_interface_manager alter column update_time_ type timestamp using update_time_::timestamp;


-- 2022-06-23 heyf 修改关联查询、对话框、外部系统调用日志表中header的长度为2000
alter table form_custom_query  alter column header_ type varchar(2000) using header_::varchar(2000);
alter table form_custom_dialog  alter column header_ type varchar(2000) using header_::varchar(2000);
alter table bpm_call_log  alter column header_ type varchar(2000) using header_::varchar(2000);

--2022-07-13 yijj 修改消息模版标题长度
alter table portal_sys_msg_tpl alter column subject_ type varchar(250) using subject_::varchar(250);


--2022-7-13  定时计划配置参数修改
UPDATE "qrtz_job_details" SET "job_data" = E'\\254\\355\\000\\005sr\\000\\025org.quartz.JobDataMap\\237\\260\\203\\350\\277\\251\\260\\313\\002\\000\\000xr\\000&org.quartz.utils.StringKeyDirtyFlagMap\\202\\010\\350\\303\\373\\305](\\002\\000\\001Z\\000\\023allowsTransientDataxr\\000\\035org.quartz.utils.DirtyFlagMap\\023\\346.\\255(v\\012\\316\\002\\000\\002Z\\000\\005dirtyL\\000\\003mapt\\000\\017Ljava/util/Map;xp\\000sr\\000\\021java.util.HashMap\\005\\007\\332\\301\\303\\026`\\321\\003\\000\\002F\\000\\012loadFactorI\\000\\011thresholdxp?@\\000\\000\\000\\000\\000\\020w\\010\\000\\000\\000\\020\\000\\000\\000\\000x\\000'::bytea WHERE "sched_name" = 'quartzScheduler' AND "job_name" = '流程定时启动任务类' AND "job_group" = '-1';
UPDATE "qrtz_job_details" SET  "job_data" = E'\\254\\355\\000\\005sr\\000\\025org.quartz.JobDataMap\\237\\260\\203\\350\\277\\251\\260\\313\\002\\000\\000xr\\000&org.quartz.utils.StringKeyDirtyFlagMap\\202\\010\\350\\303\\373\\305](\\002\\000\\001Z\\000\\023allowsTransientDataxr\\000\\035org.quartz.utils.DirtyFlagMap\\023\\346.\\255(v\\012\\316\\002\\000\\002Z\\000\\005dirtyL\\000\\003mapt\\000\\017Ljava/util/Map;xp\\000sr\\000\\021java.util.HashMap\\005\\007\\332\\301\\303\\026`\\321\\003\\000\\002F\\000\\012loadFactorI\\000\\011thresholdxp?@\\000\\000\\000\\000\\000\\020w\\010\\000\\000\\000\\020\\000\\000\\000\\000x\\000'::bytea WHERE "sched_name" = 'quartzScheduler' AND "job_name" = '任务催办定时计划' AND "job_group" = '-1';
