-- 添加临时列
alter table "BLADEX"."BLADE_DICT" add TMP_DICT_KEY NVARCHAR2(255);
-- 将目标字段中数据加入到临时列中
update "BLADEX"."BLADE_DICT" set TMP_DICT_KEY = DICT_KEY ;
-- 将目标字段数据清空
update "BLADEX"."BLADE_DICT" set DICT_KEY = null;
-- 更改目标字段类型
alter table "BLADEX"."BLADE_DICT" modify ( DICT_KEY  NVARCHAR2(255));
-- 将临时列数据加回到目标字段中
update "BLADEX"."BLADE_DICT" set DICT_KEY = TMP_DICT_KEY;
-- 清除临时列
alter table "BLADEX"."BLADE_DICT" drop column TMP_DICT_KEY;

-- ----------------------------
-- 插入菜单数据
-- ----------------------------
INSERT INTO "BLADEX"."BLADE_MENU"("ID", "PARENT_ID", "CODE", "NAME", "ALIAS", "PATH", "SOURCE", "SORT", "CATEGORY", "ACTION", "IS_OPEN", "REMARK", "IS_DELETED")
VALUES ('1164733379658963251', '1123598815738675203', 'dictbiz', '业务字典', 'menu', '/system/dictbiz', 'iconfont iconicon_study', 3, 1, 0, 1, '', 0);
INSERT INTO "BLADEX"."BLADE_MENU"("ID", "PARENT_ID", "CODE", "NAME", "ALIAS", "PATH", "SOURCE", "SORT", "CATEGORY", "ACTION", "IS_OPEN", "REMARK", "IS_DELETED")
VALUES ('1164733379658963252', '1164733379658963251', 'dictbiz_add', '新增', 'add', '/system/dictbiz/add', 'plus', 1, 2, 1, 1, '', 0);
INSERT INTO "BLADEX"."BLADE_MENU"("ID", "PARENT_ID", "CODE", "NAME", "ALIAS", "PATH", "SOURCE", "SORT", "CATEGORY", "ACTION", "IS_OPEN", "REMARK", "IS_DELETED")
VALUES ('1164733379658963253', '1164733379658963251', 'dictbiz_edit', '修改', 'edit', '/system/dictbiz/edit', 'form', 2, 2, 2, 1, '', 0);
INSERT INTO "BLADEX"."BLADE_MENU"("ID", "PARENT_ID", "CODE", "NAME", "ALIAS", "PATH", "SOURCE", "SORT", "CATEGORY", "ACTION", "IS_OPEN", "REMARK", "IS_DELETED")
VALUES ('1164733379658963254', '1164733379658963251', 'dictbiz_delete', '删除', 'delete', '/api/blade-system/dict-biz/remove', 'delete', 3, 2, 3, 1, '', 0);
INSERT INTO "BLADEX"."BLADE_MENU"("ID", "PARENT_ID", "CODE", "NAME", "ALIAS", "PATH", "SOURCE", "SORT", "CATEGORY", "ACTION", "IS_OPEN", "REMARK", "IS_DELETED")
VALUES ('1164733379658963255', '1164733379658963251', 'dictbiz_view', '查看', 'view', '/system/dictbiz/view', 'file-text', 4, 2, 2, 1, '', 0);

-- ----------------------------
-- 插入数据源角色权限数据
-- ----------------------------
INSERT INTO "BLADEX"."BLADE_ROLE_MENU"(ID,MENU_ID,ROLE_ID)
VALUES ('1161272793873322991', '1164733379658963251', '1123598816738675201');
INSERT INTO "BLADEX"."BLADE_ROLE_MENU"(ID,MENU_ID,ROLE_ID)
VALUES ('1161272793873322992', '116473337658963252', '1123598816738675201');
INSERT INTO "BLADEX"."BLADE_ROLE_MENU"(ID,MENU_ID,ROLE_ID)
VALUES ('1161272793873322993', '1164733379658963253', '1123598816738675201');
INSERT INTO "BLADEX"."BLADE_ROLE_MENU"(ID,MENU_ID,ROLE_ID)
VALUES ('1161272793873322994', '1164733379658963254', '1123598816738675201');
INSERT INTO "BLADEX"."BLADE_ROLE_MENU"(ID,MENU_ID,ROLE_ID)
VALUES ('1161272793873322995', '1164733379658963255', '1123598816738675201');

-- ----------------------------
-- 创建业务字典表
-- ----------------------------
CREATE TABLE "BLADEX"."BLADE_DICT_BIZ" (
    "ID" NUMBER(20) NOT NULL ,
    "TENANT_ID" NVARCHAR2(12) ,
    "PARENT_ID" NUMBER(20) ,
    "CODE" NVARCHAR2(255) ,
    "DICT_KEY" NVARCHAR2(255) ,
    "DICT_VALUE" NVARCHAR2(255) ,
    "SORT" NUMBER(11) ,
    "REMARK" NVARCHAR2(255) ,
    "IS_SEALED" NUMBER(11) ,
    "IS_DELETED" NUMBER(11) ,
    PRIMARY KEY ("ID")
);
COMMENT ON COLUMN "BLADEX"."BLADE_DICT_BIZ"."ID" IS '主键';
COMMENT ON COLUMN "BLADEX"."BLADE_DICT_BIZ"."TENANT_ID" IS '租户ID';
COMMENT ON COLUMN "BLADEX"."BLADE_DICT_BIZ"."PARENT_ID" IS '父主键';
COMMENT ON COLUMN "BLADEX"."BLADE_DICT_BIZ"."CODE" IS '字典码';
COMMENT ON COLUMN "BLADEX"."BLADE_DICT_BIZ"."DICT_KEY" IS '字典值';
COMMENT ON COLUMN "BLADEX"."BLADE_DICT_BIZ"."DICT_VALUE" IS '字典名称';
COMMENT ON COLUMN "BLADEX"."BLADE_DICT_BIZ"."SORT" IS '排序';
COMMENT ON COLUMN "BLADEX"."BLADE_DICT_BIZ"."REMARK" IS '字典备注';
COMMENT ON COLUMN "BLADEX"."BLADE_DICT_BIZ"."IS_SEALED" IS '是否已封存';
COMMENT ON COLUMN "BLADEX"."BLADE_DICT_BIZ"."IS_DELETED" IS '是否已删除';
COMMENT ON TABLE "BLADEX"."BLADE_DICT_BIZ" IS '数据源配置表';

-- ----------------------------
-- 创建用户部门表
-- ----------------------------
CREATE TABLE "BLADEX"."BLADE_USER_DEPT" (
   "ID" NUMBER(20) NOT NULL ,
   "USER_ID" NUMBER(20) ,
   "DEPT_ID" NUMBER(20) ,
   PRIMARY KEY ("ID")
);
COMMENT ON COLUMN "BLADEX"."BLADE_USER_DEPT"."ID" IS '主键';
COMMENT ON COLUMN "BLADEX"."BLADE_USER_DEPT"."USER_ID" IS '用户ID';
COMMENT ON COLUMN "BLADEX"."BLADE_USER_DEPT"."DEPT_ID" IS '部门ID';
COMMENT ON TABLE "BLADEX"."BLADE_USER_DEPT" IS '用户部门表';

-- ----------------------------
-- 新增用户部门表数据
-- ----------------------------
INSERT INTO "BLADEX"."BLADE_USER_DEPT" VALUES (1203503640757788674, 1123598821738675201, 1123598813738675201);
INSERT INTO "BLADEX"."BLADE_USER_DEPT" VALUES (1203503653323923458, 1123598821738675202, 1123598813738675202);
INSERT INTO "BLADEX"."BLADE_USER_DEPT" VALUES (1203503663402835969, 1123598821738675203, 1123598813738675202);
INSERT INTO "BLADEX"."BLADE_USER_DEPT" VALUES (1203503672911323137, 1123598821738675204, 1123598813738675202);
