Просмотр исходного кода

:heavy_plus_sign: 添加对象存储附件功能

smallchill 5 лет назад
Родитель
Сommit
d908d36c2a

+ 22 - 1
doc/sql/db/database-info.md

@@ -1,3 +1,23 @@
+Table: blade_attach(附件表)
+
+| Field         | Type          | Null | Key | Default | Remarks |
+| ------------- | ------------- | ---- | --- | ------- | ------- |
+| id            | BIGINT(19)    | NO   | PRI |         | 主键      |
+| tenant_id     | VARCHAR(12)   | YES  |     | 000000  | 租户ID    |
+| link          | VARCHAR(1000) | YES  |     |         | 附件地址    |
+| domain        | VARCHAR(500)  | YES  |     |         | 附件域名    |
+| name          | VARCHAR(500)  | YES  |     |         | 附件名称    |
+| original_name | VARCHAR(500)  | YES  |     |         | 附件原名    |
+| extension     | VARCHAR(12)   | YES  |     |         | 附件拓展名   |
+| attach_size   | BIGINT(19)    | YES  |     |         | 附件大小    |
+| create_user   | BIGINT(19)    | YES  |     |         | 创建人     |
+| create_dept   | BIGINT(19)    | YES  |     |         | 创建部门    |
+| create_time   | DATETIME(19)  | YES  |     |         | 创建时间    |
+| update_user   | BIGINT(19)    | YES  |     |         | 修改人     |
+| update_time   | DATETIME(19)  | YES  |     |         | 修改时间    |
+| status        | INT(10)       | YES  |     |         | 状态      |
+| is_deleted    | INT(10)       | YES  |     |         | 是否已删除   |
+
 Table: blade_client(客户端表)
 
 | Field                   | Type          | Null | Key | Default | Remarks |
@@ -493,7 +513,8 @@ Table: blade_user_oauth(用户第三方认证表)
 | --------- | ------------- | ---- | --- | ------- | ------- |
 | id        | BIGINT(19)    | NO   | PRI |         | 主键      |
 | tenant_id | VARCHAR(12)   | YES  |     |         | 租户ID    |
-| user_id   | BIGINT(19)    | YES  |     |         | 用户主键    |
+| uuid      | VARCHAR(64)   | YES  |     |         | 第三方系统用户ID|
+| user_id   | BIGINT(19)    | YES  |     |         | 用户ID    |
 | username  | VARCHAR(32)   | YES  |     |         | 账号      |
 | nickname  | VARCHAR(64)   | YES  |     |         | 用户名     |
 | avatar    | VARCHAR(1000) | YES  |     |         | 头像      |

Разница между файлами не показана из-за своего большого размера
+ 24 - 1
doc/sql/mysql/bladex-saber-mysql.sql


Разница между файлами не показана из-за своего большого размера
+ 24 - 1
doc/sql/mysql/bladex-sword-mysql.sql


Разница между файлами не показана из-за своего большого размера
+ 1656 - 1966
doc/sql/oracle/bladex-saber-oracle.sql


Разница между файлами не показана из-за своего большого размера
+ 1673 - 1983
doc/sql/oracle/bladex-sword-oracle.sql


+ 52 - 1
doc/sql/postgresql/bladex-saber-postgresql.sql

@@ -12,10 +12,48 @@
  Target Server Version : 110001
  File Encoding         : 65001
 
- Date: 12/05/2020 23:13:57
+ Date: 16/07/2020 09:51:00
 */
 
 
+-- ----------------------------
+-- Table structure for blade_attach
+-- ----------------------------
+DROP TABLE IF EXISTS "blade_attach";
+CREATE TABLE "blade_attach" (
+  "id" int8 NOT NULL,
+  "tenant_id" varchar(12) COLLATE "pg_catalog"."default",
+  "link" varchar(1000) COLLATE "pg_catalog"."default",
+  "domain" varchar(500) COLLATE "pg_catalog"."default",
+  "name" varchar(500) COLLATE "pg_catalog"."default",
+  "original_name" varchar(500) COLLATE "pg_catalog"."default",
+  "extension" varchar(12) COLLATE "pg_catalog"."default",
+  "attach_size" int8,
+  "create_user" int8,
+  "create_dept" int8,
+  "create_time" timestamp(6),
+  "update_user" int8,
+  "update_time" timestamp(6),
+  "status" int4,
+  "is_deleted" int4
+)
+;
+COMMENT ON COLUMN "blade_attach"."id" IS '主键';
+COMMENT ON COLUMN "blade_attach"."tenant_id" IS '租户ID';
+COMMENT ON COLUMN "blade_attach"."link" IS '附件地址';
+COMMENT ON COLUMN "blade_attach"."domain" IS '附件域名';
+COMMENT ON COLUMN "blade_attach"."name" IS '附件名称';
+COMMENT ON COLUMN "blade_attach"."original_name" IS '附件原名';
+COMMENT ON COLUMN "blade_attach"."extension" IS '附件拓展名';
+COMMENT ON COLUMN "blade_attach"."attach_size" IS '附件大小';
+COMMENT ON COLUMN "blade_attach"."create_user" IS '创建人';
+COMMENT ON COLUMN "blade_attach"."create_dept" IS '创建部门';
+COMMENT ON COLUMN "blade_attach"."create_time" IS '创建时间';
+COMMENT ON COLUMN "blade_attach"."update_user" IS '修改人';
+COMMENT ON COLUMN "blade_attach"."update_time" IS '修改时间';
+COMMENT ON COLUMN "blade_attach"."status" IS '状态';
+COMMENT ON COLUMN "blade_attach"."is_deleted" IS '是否已删除';
+
 -- ----------------------------
 -- Table structure for blade_client
 -- ----------------------------
@@ -649,6 +687,10 @@ INSERT INTO "blade_menu" VALUES (1164733399668962204, 1164733399668962202, 'regi
 INSERT INTO "blade_menu" VALUES (1164733399668962205, 1164733399668962202, 'region_import', '导入', 'import', '', '', 3, 2, 3, 1, NULL, 0);
 INSERT INTO "blade_menu" VALUES (1164733399668962206, 1164733399668962202, 'region_export', '导出', 'export', '', '', 4, 2, 2, 1, NULL, 0);
 INSERT INTO "blade_menu" VALUES (1164733399668962207, 1164733399668962202, 'region_debug', '调试', 'debug', '', '', 5, 2, 2, 1, NULL, 0);
+INSERT INTO "blade_menu" VALUES (1164733399669962201, 1123598815738675298, 'attach', '附件管理', 'menu', '/resource/attach', 'iconfont iconicon_ding', 1, 1, 0, 1, NULL, 0);
+INSERT INTO "blade_menu" VALUES (1164733399669962202, 1164733399669962201, 'attach_upload', '上传', 'add', '/resource/attach/upload', '', 1, 2, 1, 1, NULL, 0);
+INSERT INTO "blade_menu" VALUES (1164733399669962203, 1164733399669962201, 'attach_download', '下载', 'download', '/resource/attach/download', '', 2, 2, 2, 1, NULL, 0);
+INSERT INTO "blade_menu" VALUES (1164733399669962204, 1164733399669962201, 'attach_delete', '删除', 'delete', '/api/blade-resource/attach/remove', '', 3, 2, 3, 1, NULL, 0);
 COMMIT;
 
 -- ----------------------------
@@ -4461,6 +4503,10 @@ INSERT INTO "blade_role_menu" VALUES (1161272893875226004, 1164733399668962204,
 INSERT INTO "blade_role_menu" VALUES (1161272893875226005, 1164733399668962205, 1123598816738675201);
 INSERT INTO "blade_role_menu" VALUES (1161272893875226006, 1164733399668962206, 1123598816738675201);
 INSERT INTO "blade_role_menu" VALUES (1161272893875226007, 1164733399668962207, 1123598816738675201);
+INSERT INTO "blade_role_menu" VALUES (1161272893875227001, 1164733399669962201, 1123598816738675201);
+INSERT INTO "blade_role_menu" VALUES (1161272893875227002, 1164733399669962202, 1123598816738675201);
+INSERT INTO "blade_role_menu" VALUES (1161272893875227003, 1164733399669962203, 1123598816738675201);
+INSERT INTO "blade_role_menu" VALUES (1161272893875227004, 1164733399669962204, 1123598816738675201);
 COMMIT;
 
 -- ----------------------------
@@ -4830,6 +4876,11 @@ COMMENT ON COLUMN "blade_user_oauth"."gender" IS '性别';
 COMMENT ON COLUMN "blade_user_oauth"."source" IS '来源';
 COMMENT ON TABLE "blade_user_oauth" IS '用户第三方认证表';
 
+-- ----------------------------
+-- Primary Key structure for table blade_attach
+-- ----------------------------
+ALTER TABLE "blade_attach" ADD CONSTRAINT "blade_attach_pkey" PRIMARY KEY ("id");
+
 -- ----------------------------
 -- Primary Key structure for table blade_client
 -- ----------------------------

+ 52 - 1
doc/sql/postgresql/bladex-sword-postgresql.sql

@@ -12,10 +12,48 @@
  Target Server Version : 110001
  File Encoding         : 65001
 
- Date: 12/05/2020 23:18:33
+ Date: 16/07/2020 09:49:11
 */
 
 
+-- ----------------------------
+-- Table structure for blade_attach
+-- ----------------------------
+DROP TABLE IF EXISTS "blade_attach";
+CREATE TABLE "blade_attach" (
+  "id" int8 NOT NULL,
+  "tenant_id" varchar(12) COLLATE "pg_catalog"."default",
+  "link" varchar(1000) COLLATE "pg_catalog"."default",
+  "domain" varchar(500) COLLATE "pg_catalog"."default",
+  "name" varchar(500) COLLATE "pg_catalog"."default",
+  "original_name" varchar(500) COLLATE "pg_catalog"."default",
+  "extension" varchar(12) COLLATE "pg_catalog"."default",
+  "attach_size" int8,
+  "create_user" int8,
+  "create_dept" int8,
+  "create_time" timestamp(6),
+  "update_user" int8,
+  "update_time" timestamp(6),
+  "status" int4,
+  "is_deleted" int4
+)
+;
+COMMENT ON COLUMN "blade_attach"."id" IS '主键';
+COMMENT ON COLUMN "blade_attach"."tenant_id" IS '租户ID';
+COMMENT ON COLUMN "blade_attach"."link" IS '附件地址';
+COMMENT ON COLUMN "blade_attach"."domain" IS '附件域名';
+COMMENT ON COLUMN "blade_attach"."name" IS '附件名称';
+COMMENT ON COLUMN "blade_attach"."original_name" IS '附件原名';
+COMMENT ON COLUMN "blade_attach"."extension" IS '附件拓展名';
+COMMENT ON COLUMN "blade_attach"."attach_size" IS '附件大小';
+COMMENT ON COLUMN "blade_attach"."create_user" IS '创建人';
+COMMENT ON COLUMN "blade_attach"."create_dept" IS '创建部门';
+COMMENT ON COLUMN "blade_attach"."create_time" IS '创建时间';
+COMMENT ON COLUMN "blade_attach"."update_user" IS '修改人';
+COMMENT ON COLUMN "blade_attach"."update_time" IS '修改时间';
+COMMENT ON COLUMN "blade_attach"."status" IS '状态';
+COMMENT ON COLUMN "blade_attach"."is_deleted" IS '是否已删除';
+
 -- ----------------------------
 -- Table structure for blade_client
 -- ----------------------------
@@ -647,6 +685,10 @@ INSERT INTO "blade_menu" VALUES (1164733399668962204, 1164733399668962202, 'regi
 INSERT INTO "blade_menu" VALUES (1164733399668962205, 1164733399668962202, 'region_import', '导入', 'import', '', '', 3, 2, 3, 1, NULL, 0);
 INSERT INTO "blade_menu" VALUES (1164733399668962206, 1164733399668962202, 'region_export', '导出', 'export', '', '', 4, 2, 2, 1, NULL, 0);
 INSERT INTO "blade_menu" VALUES (1164733399668962207, 1164733399668962202, 'region_debug', '调试', 'debug', '', '', 5, 2, 2, 1, NULL, 0);
+INSERT INTO "blade_menu" VALUES (1164733399669962201, 1123598815738675298, 'attach', '附件管理', 'menu', '/resource/attach', '', 1, 1, 0, 1, NULL, 0);
+INSERT INTO "blade_menu" VALUES (1164733399669962202, 1164733399669962201, 'attach_upload', '上传', 'add', '/resource/attach/upload', '', 1, 2, 1, 1, NULL, 0);
+INSERT INTO "blade_menu" VALUES (1164733399669962203, 1164733399669962201, 'attach_download', '下载', 'download', '/resource/attach/download', '', 2, 2, 2, 1, NULL, 0);
+INSERT INTO "blade_menu" VALUES (1164733399669962204, 1164733399669962201, 'attach_delete', '删除', 'delete', '/api/blade-resource/attach/remove', '', 3, 2, 3, 1, NULL, 0);
 COMMIT;
 
 -- ----------------------------
@@ -4459,6 +4501,10 @@ INSERT INTO "blade_role_menu" VALUES (1161272893875226004, 1164733399668962204,
 INSERT INTO "blade_role_menu" VALUES (1161272893875226005, 1164733399668962205, 1123598816738675201);
 INSERT INTO "blade_role_menu" VALUES (1161272893875226006, 1164733399668962206, 1123598816738675201);
 INSERT INTO "blade_role_menu" VALUES (1161272893875226007, 1164733399668962207, 1123598816738675201);
+INSERT INTO "blade_role_menu" VALUES (1161272893875227001, 1164733399669962201, 1123598816738675201);
+INSERT INTO "blade_role_menu" VALUES (1161272893875227002, 1164733399669962202, 1123598816738675201);
+INSERT INTO "blade_role_menu" VALUES (1161272893875227003, 1164733399669962203, 1123598816738675201);
+INSERT INTO "blade_role_menu" VALUES (1161272893875227004, 1164733399669962204, 1123598816738675201);
 COMMIT;
 
 -- ----------------------------
@@ -4828,6 +4874,11 @@ COMMENT ON COLUMN "blade_user_oauth"."gender" IS '性别';
 COMMENT ON COLUMN "blade_user_oauth"."source" IS '来源';
 COMMENT ON TABLE "blade_user_oauth" IS '用户第三方认证表';
 
+-- ----------------------------
+-- Primary Key structure for table blade_attach
+-- ----------------------------
+ALTER TABLE "blade_attach" ADD CONSTRAINT "blade_attach_pkey" PRIMARY KEY ("id");
+
 -- ----------------------------
 -- Primary Key structure for table blade_client
 -- ----------------------------

+ 46 - 0
doc/sql/update/mysql-update-2.5.1~2.5.2.sql

@@ -3,3 +3,49 @@
 -- ----------------------------
 ALTER TABLE `blade_user_oauth`
     ADD COLUMN `uuid` varchar(64) NULL COMMENT '第三方系统用户ID' AFTER `tenant_id`;
+
+-- ----------------------------
+-- 附件表
+-- ----------------------------
+CREATE TABLE `blade_attach`  (
+  `id` bigint(64) NOT NULL COMMENT '主键',
+  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
+  `link` varchar(1000) NULL COMMENT '附件地址',
+  `domain` varchar(500) NULL COMMENT '附件域名',
+  `name` varchar(500) NULL COMMENT '附件名称',
+  `original_name` varchar(500) NULL COMMENT '附件原名',
+  `extension` varchar(12) NULL COMMENT '附件拓展名',
+  `attach_size` bigint(64) NULL DEFAULT NULL COMMENT '附件大小',
+  `create_user` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
+  `create_dept` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
+  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+  `update_user` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
+  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+  `status` int(2) NULL DEFAULT NULL COMMENT '状态',
+  `is_deleted` int(2) NULL DEFAULT NULL COMMENT '是否已删除',
+  PRIMARY KEY (`id`)
+) COMMENT = '附件表' ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci;
+
+-- ----------------------------
+-- 插入附件表菜单数据
+-- ----------------------------
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
+VALUES ('1164733399669962201', '1123598815738675298', 'attach', '附件管理', 'menu', '/resource/attach', 'iconfont iconicon_ding', 1, 1, 0, 1, NULL, 0);
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
+VALUES ('1164733399669962202', '1164733399669962201', 'attach_upload', '上传', 'add', '/resource/attach/upload', '', 1, 2, 1, 1, NULL, 0);
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
+VALUES ('1164733399669962203', '1164733399669962201', 'attach_download', '下载', 'download', '/resource/attach/download', '', 2, 2, 2, 1, NULL, 0);
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
+VALUES ('1164733399669962204', '1164733399669962201', 'attach_delete', '删除', 'delete', '/api/blade-resource/attach/remove', '', 3, 2, 3, 1, NULL, 0);
+
+-- ----------------------------
+-- 增加附件表菜单权限数据
+-- ----------------------------
+INSERT INTO `blade_role_menu`(`id`,`menu_id`,`role_id`)
+VALUES ('1161272893875227001', '1164733399669962201', '1123598816738675201');
+INSERT INTO `blade_role_menu`(`id`,`menu_id`,`role_id`)
+VALUES ('1161272893875227002', '1164733399669962202', '1123598816738675201');
+INSERT INTO `blade_role_menu`(`id`,`menu_id`,`role_id`)
+VALUES ('1161272893875227003', '1164733399669962203', '1123598816738675201');
+INSERT INTO `blade_role_menu`(`id`,`menu_id`,`role_id`)
+VALUES ('1161272893875227004', '1164733399669962204', '1123598816738675201');

+ 63 - 0
doc/sql/update/oracle-update-2.5.1~2.5.2.sql

@@ -4,3 +4,66 @@
 ALTER TABLE "BLADE_USER_OAUTH"
     ADD ("UUID" VARCHAR2(64) );
 COMMENT ON COLUMN "BLADE_USER_OAUTH"."UUID" IS '第三方系统用户ID';
+
+-- ----------------------------
+-- 附件表
+-- ----------------------------
+CREATE TABLE "BLADEX"."BLADE_ATTACH" (
+    "ID" NUMBER(20) NOT NULL ,
+    "TENANT_ID" NVARCHAR2(12) ,
+    "LINK" VARCHAR2(1000) ,
+    "DOMAIN" VARCHAR2(500) ,
+    "NAME" VARCHAR2(500) ,
+    "ORIGINAL_NAME" VARCHAR2(500) ,
+    "EXTENSION" VARCHAR2(12) ,
+    "ATTACH_SIZE" NUMBER(20) ,
+    "CREATE_USER" NUMBER(20) ,
+    "CREATE_DEPT" NUMBER(20) ,
+    "CREATE_TIME" DATE ,
+    "UPDATE_USER" NUMBER(20) ,
+    "UPDATE_TIME" DATE ,
+    "STATUS" NUMBER(11) ,
+    "IS_DELETED" NUMBER(11) ,
+    PRIMARY KEY ("ID")
+)
+;
+COMMENT ON COLUMN "BLADEX"."BLADE_ATTACH"."ID" IS '主键';
+COMMENT ON COLUMN "BLADEX"."BLADE_ATTACH"."TENANT_ID" IS '租户ID';
+COMMENT ON COLUMN "BLADEX"."BLADE_ATTACH"."LINK" IS '附件地址';
+COMMENT ON COLUMN "BLADEX"."BLADE_ATTACH"."DOMAIN" IS '附件域名';
+COMMENT ON COLUMN "BLADEX"."BLADE_ATTACH"."NAME" IS '附件名称';
+COMMENT ON COLUMN "BLADEX"."BLADE_ATTACH"."ORIGINAL_NAME" IS '附件原名';
+COMMENT ON COLUMN "BLADEX"."BLADE_ATTACH"."EXTENSION" IS '附件拓展名';
+COMMENT ON COLUMN "BLADEX"."BLADE_ATTACH"."ATTACH_SIZE" IS '附件大小';
+COMMENT ON COLUMN "BLADEX"."BLADE_ATTACH"."CREATE_USER" IS '创建人';
+COMMENT ON COLUMN "BLADEX"."BLADE_ATTACH"."CREATE_DEPT" IS '创建部门';
+COMMENT ON COLUMN "BLADEX"."BLADE_ATTACH"."CREATE_TIME" IS '创建时间';
+COMMENT ON COLUMN "BLADEX"."BLADE_ATTACH"."UPDATE_USER" IS '修改人';
+COMMENT ON COLUMN "BLADEX"."BLADE_ATTACH"."UPDATE_TIME" IS '修改时间';
+COMMENT ON COLUMN "BLADEX"."BLADE_ATTACH"."STATUS" IS '状态';
+COMMENT ON COLUMN "BLADEX"."BLADE_ATTACH"."IS_DELETED" IS '是否已删除';
+COMMENT ON TABLE "BLADEX"."BLADE_ATTACH" IS '附件表';
+
+-- ----------------------------
+-- 插入附件表菜单数据
+-- ----------------------------
+INSERT INTO "BLADEX"."BLADE_MENU"("ID", "PARENT_ID", "CODE", "NAME", "ALIAS", "PATH", "SOURCE", "SORT", "CATEGORY", "ACTION", "IS_OPEN", "REMARK", "IS_DELETED")
+VALUES ('1164733399669962201', '1123598815738675298', 'attach', '附件管理', 'menu', '/resource/attach', 'iconfont iconicon_ding', 1, 1, 0, 1, NULL, 0);
+INSERT INTO "BLADEX"."BLADE_MENU"("ID", "PARENT_ID", "CODE", "NAME", "ALIAS", "PATH", "SOURCE", "SORT", "CATEGORY", "ACTION", "IS_OPEN", "REMARK", "IS_DELETED")
+VALUES ('1164733399669962202', '1164733399669962201', 'attach_upload', '上传', 'add', '/resource/attach/upload', '', 1, 2, 1, 1, NULL, 0);
+INSERT INTO "BLADEX"."BLADE_MENU"("ID", "PARENT_ID", "CODE", "NAME", "ALIAS", "PATH", "SOURCE", "SORT", "CATEGORY", "ACTION", "IS_OPEN", "REMARK", "IS_DELETED")
+VALUES ('1164733399669962203', '1164733399669962201', 'attach_download', '下载', 'download', '/resource/attach/download', '', 2, 2, 2, 1, NULL, 0);
+INSERT INTO "BLADEX"."BLADE_MENU"("ID", "PARENT_ID", "CODE", "NAME", "ALIAS", "PATH", "SOURCE", "SORT", "CATEGORY", "ACTION", "IS_OPEN", "REMARK", "IS_DELETED")
+VALUES ('1164733399669962204', '1164733399669962201', 'attach_delete', '删除', 'delete', '/api/blade-resource/attach/remove', '', 3, 2, 3, 1, NULL, 0);
+
+-- ----------------------------
+-- 增加附件表菜单权限数据
+-- ----------------------------
+INSERT INTO "BLADEX"."BLADE_ROLE_MENU"("ID","MENU_ID","ROLE_ID")
+VALUES ('1161272893875227001', '1164733399669962201', '1123598816738675201');
+INSERT INTO "BLADEX"."BLADE_ROLE_MENU"("ID","MENU_ID","ROLE_ID")
+VALUES ('1161272893875227002', '1164733399669962202', '1123598816738675201');
+INSERT INTO "BLADEX"."BLADE_ROLE_MENU"("ID","MENU_ID","ROLE_ID")
+VALUES ('1161272893875227003', '1164733399669962203', '1123598816738675201');
+INSERT INTO "BLADEX"."BLADE_ROLE_MENU"("ID","MENU_ID","ROLE_ID")
+VALUES ('1161272893875227004', '1164733399669962204', '1123598816738675201');

+ 63 - 0
doc/sql/update/postgresql-update-2.5.1~2.5.2.sql

@@ -4,3 +4,66 @@
 ALTER TABLE "blade_user_oauth"
     ADD COLUMN "uuid" varchar(64) COLLATE "pg_catalog"."default";
 COMMENT ON COLUMN "blade_user_oauth"."uuid" IS '第三方系统用户ID';
+
+-- ----------------------------
+-- 附件表
+-- ----------------------------
+CREATE TABLE "blade_attach" (
+    "id" int8 NOT NULL,
+    "tenant_id" varchar(12) COLLATE "pg_catalog"."default",
+    "link" varchar(1000),
+    "domain" varchar(500),
+    "name" varchar(500),
+    "original_name" varchar(500),
+    "extension" varchar(12),
+    "attach_size" int8,
+    "create_user" int8,
+    "create_dept" int8,
+    "create_time" timestamp(6),
+    "update_user" int8,
+    "update_time" timestamp(6),
+    "status" int4,
+    "is_deleted" int4,
+    PRIMARY KEY ("id")
+)
+;
+COMMENT ON COLUMN "blade_attach"."id" IS '主键';
+COMMENT ON COLUMN "blade_attach"."tenant_id" IS '租户ID';
+COMMENT ON COLUMN "blade_attach"."link" IS '附件地址';
+COMMENT ON COLUMN "blade_attach"."domain" IS '附件域名';
+COMMENT ON COLUMN "blade_attach"."name" IS '附件名称';
+COMMENT ON COLUMN "blade_attach"."original_name" IS '附件原名';
+COMMENT ON COLUMN "blade_attach"."extension" IS '附件拓展名';
+COMMENT ON COLUMN "blade_attach"."attach_size" IS '附件大小';
+COMMENT ON COLUMN "blade_attach"."create_user" IS '创建人';
+COMMENT ON COLUMN "blade_attach"."create_dept" IS '创建部门';
+COMMENT ON COLUMN "blade_attach"."create_time" IS '创建时间';
+COMMENT ON COLUMN "blade_attach"."update_user" IS '修改人';
+COMMENT ON COLUMN "blade_attach"."update_time" IS '修改时间';
+COMMENT ON COLUMN "blade_attach"."status" IS '状态';
+COMMENT ON COLUMN "blade_attach"."is_deleted" IS '是否已删除';
+
+
+-- ----------------------------
+-- 插入附件表菜单数据
+-- ----------------------------
+INSERT INTO "blade_menu"("id", "parent_id", "code", "name", "alias", "path", "source", "sort", "category", "action", "is_open", "remark", "is_deleted")
+VALUES ('1164733399669962201', '1123598815738675298', 'attach', '附件管理', 'menu', '/resource/attach', 'iconfont iconicon_ding', 1, 1, 0, 1, NULL, 0);
+INSERT INTO "blade_menu"("id", "parent_id", "code", "name", "alias", "path", "source", "sort", "category", "action", "is_open", "remark", "is_deleted")
+VALUES ('1164733399669962202', '1164733399669962201', 'attach_upload', '上传', 'add', '/resource/attach/upload', '', 1, 2, 1, 1, NULL, 0);
+INSERT INTO "blade_menu"("id", "parent_id", "code", "name", "alias", "path", "source", "sort", "category", "action", "is_open", "remark", "is_deleted")
+VALUES ('1164733399669962203', '1164733399669962201', 'attach_download', '下载', 'download', '/resource/attach/download', '', 2, 2, 2, 1, NULL, 0);
+INSERT INTO "blade_menu"("id", "parent_id", "code", "name", "alias", "path", "source", "sort", "category", "action", "is_open", "remark", "is_deleted")
+VALUES ('1164733399669962204', '1164733399669962201', 'attach_delete', '删除', 'delete', '/api/blade-resource/attach/remove', '', 3, 2, 3, 1, NULL, 0);
+
+-- ----------------------------
+-- 增加附件表菜单权限数据
+-- ----------------------------
+INSERT INTO "blade_role_menu"("id","menu_id","role_id")
+VALUES ('1161272893875227001', '1164733399669962201', '1123598816738675201');
+INSERT INTO "blade_role_menu"("id","menu_id","role_id")
+VALUES ('1161272893875227002', '1164733399669962202', '1123598816738675201');
+INSERT INTO "blade_role_menu"("id","menu_id","role_id")
+VALUES ('1161272893875227003', '1164733399669962203', '1123598816738675201');
+INSERT INTO "blade_role_menu"("id","menu_id","role_id")
+VALUES ('1161272893875227004', '1164733399669962204', '1123598816738675201');

+ 126 - 0
src/main/java/org/springblade/modules/resource/controller/AttachController.java

@@ -0,0 +1,126 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.resource.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.launch.constant.AppConstant;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.resource.entity.Attach;
+import org.springblade.modules.resource.service.IAttachService;
+import org.springblade.modules.resource.vo.AttachVO;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ * 附件表 控制器
+ *
+ * @author Chill
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping(AppConstant.APPLICATION_RESOURCE_NAME + "/attach")
+@Api(value = "附件表", tags = "附件表接口")
+public class AttachController extends BladeController {
+
+	private final IAttachService attachService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入attach")
+	public R<Attach> detail(Attach attach) {
+		Attach detail = attachService.getOne(Condition.getQueryWrapper(attach));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 附件表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入attach")
+	public R<IPage<Attach>> list(Attach attach, Query query) {
+		IPage<Attach> pages = attachService.page(Condition.getPage(query), Condition.getQueryWrapper(attach));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 附件表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入attach")
+	public R<IPage<AttachVO>> page(AttachVO attach, Query query) {
+		IPage<AttachVO> pages = attachService.selectAttachPage(Condition.getPage(query), attach);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 附件表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入attach")
+	public R save(@Valid @RequestBody Attach attach) {
+		return R.status(attachService.save(attach));
+	}
+
+	/**
+	 * 修改 附件表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入attach")
+	public R update(@Valid @RequestBody Attach attach) {
+		return R.status(attachService.updateById(attach));
+	}
+
+	/**
+	 * 新增或修改 附件表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入attach")
+	public R submit(@Valid @RequestBody Attach attach) {
+		return R.status(attachService.saveOrUpdate(attach));
+	}
+
+
+	/**
+	 * 删除 附件表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(attachService.deleteLogic(Func.toLongList(ids)));
+	}
+
+
+}

+ 61 - 0
src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java

@@ -25,8 +25,11 @@ import org.springblade.core.oss.model.OssFile;
 import org.springblade.core.secure.annotation.PreAuth;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.constant.RoleConstant;
+import org.springblade.core.tool.utils.FileUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.modules.resource.builder.oss.OssBuilder;
+import org.springblade.modules.resource.entity.Attach;
+import org.springblade.modules.resource.service.IAttachService;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -46,6 +49,11 @@ public class OssEndpoint {
 	 */
 	private final OssBuilder ossBuilder;
 
+	/**
+	 * 附件表服务
+	 */
+	private final IAttachService attachService;
+
 	/**
 	 * 创建存储桶
 	 *
@@ -153,6 +161,59 @@ public class OssEndpoint {
 		return R.data(bladeFile);
 	}
 
+	/**
+	 * 上传文件并保存至附件表
+	 *
+	 * @param file 文件
+	 * @return ObjectStat
+	 */
+	@SneakyThrows
+	@PostMapping("/put-file-attach")
+	public R<BladeFile> putFileAttach(@RequestParam MultipartFile file) {
+		String fileName = file.getOriginalFilename();
+		BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
+		Long attachId = buildAttach(fileName, file.getSize(), bladeFile);
+		bladeFile.setAttachId(attachId);
+		return R.data(bladeFile);
+	}
+
+	/**
+	 * 上传文件并保存至附件表
+	 *
+	 * @param fileName 存储桶对象名称
+	 * @param file     文件
+	 * @return ObjectStat
+	 */
+	@SneakyThrows
+	@PostMapping("/put-file-attach-by-name")
+	public R<BladeFile> putFileAttach(@RequestParam String fileName, @RequestParam MultipartFile file) {
+		BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
+		Long attachId = buildAttach(fileName, file.getSize(), bladeFile);
+		bladeFile.setAttachId(attachId);
+		return R.data(bladeFile);
+	}
+
+	/**
+	 * 构建附件表
+	 *
+	 * @param fileName  文件名
+	 * @param fileSize  文件大小
+	 * @param bladeFile 对象存储文件
+	 * @return attachId
+	 */
+	private Long buildAttach(String fileName, Long fileSize, BladeFile bladeFile) {
+		String fileExtension = FileUtil.getFileExtension(fileName);
+		Attach attach = new Attach();
+		attach.setDomain(bladeFile.getDomain());
+		attach.setLink(bladeFile.getLink());
+		attach.setName(bladeFile.getName());
+		attach.setOriginalName(bladeFile.getOriginalName());
+		attach.setAttachSize(fileSize);
+		attach.setExtension(fileExtension);
+		attachService.save(attach);
+		return attach.getId();
+	}
+
 	/**
 	 * 删除文件
 	 *

+ 71 - 0
src/main/java/org/springblade/modules/resource/entity/Attach.java

@@ -0,0 +1,71 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.resource.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 附件表实体类
+ *
+ * @author Chill
+ */
+@Data
+@TableName("blade_attach")
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "Attach对象", description = "附件表")
+public class Attach extends BaseEntity {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 附件地址
+	 */
+	@ApiModelProperty(value = "附件地址")
+	private String link;
+	/**
+	 * 附件域名
+	 */
+	@ApiModelProperty(value = "附件域名")
+	private String domain;
+	/**
+	 * 附件名称
+	 */
+	@ApiModelProperty(value = "附件名称")
+	private String name;
+	/**
+	 * 附件原名
+	 */
+	@ApiModelProperty(value = "附件原名")
+	private String originalName;
+	/**
+	 * 附件拓展名
+	 */
+	@ApiModelProperty(value = "附件拓展名")
+	private String extension;
+	/**
+	 * 附件大小
+	 */
+	@ApiModelProperty(value = "附件大小")
+	private Long attachSize;
+
+
+}

+ 41 - 0
src/main/java/org/springblade/modules/resource/mapper/AttachMapper.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.resource.mapper;
+
+import org.springblade.modules.resource.entity.Attach;
+import org.springblade.modules.resource.vo.AttachVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 附件表 Mapper 接口
+ *
+ * @author Chill
+ */
+public interface AttachMapper extends BaseMapper<Attach> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param attach
+	 * @return
+	 */
+	List<AttachVO> selectAttachPage(IPage page, AttachVO attach);
+
+}

+ 28 - 0
src/main/java/org/springblade/modules/resource/mapper/AttachMapper.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.modules.resource.mapper.AttachMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="attachResultMap" type="org.springblade.modules.resource.entity.Attach">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="link" property="link"/>
+        <result column="domain" property="domain"/>
+        <result column="name" property="name"/>
+        <result column="original_name" property="originalName"/>
+        <result column="extension" property="extension"/>
+        <result column="attach_size" property="attachSize"/>
+    </resultMap>
+
+
+    <select id="selectAttachPage" resultMap="attachResultMap">
+        select * from blade_attach where is_deleted = 0
+    </select>
+
+</mapper>

+ 40 - 0
src/main/java/org/springblade/modules/resource/service/IAttachService.java

@@ -0,0 +1,40 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.resource.service;
+
+import org.springblade.modules.resource.entity.Attach;
+import org.springblade.modules.resource.vo.AttachVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 附件表 服务类
+ *
+ * @author Chill
+ */
+public interface IAttachService extends BaseService<Attach> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param attach
+	 * @return
+	 */
+	IPage<AttachVO> selectAttachPage(IPage<AttachVO> page, AttachVO attach);
+
+}

+ 40 - 0
src/main/java/org/springblade/modules/resource/service/impl/AttachServiceImpl.java

@@ -0,0 +1,40 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.resource.service.impl;
+
+import org.springblade.modules.resource.entity.Attach;
+import org.springblade.modules.resource.vo.AttachVO;
+import org.springblade.modules.resource.mapper.AttachMapper;
+import org.springblade.modules.resource.service.IAttachService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 附件表 服务实现类
+ *
+ * @author Chill
+ */
+@Service
+public class AttachServiceImpl extends BaseServiceImpl<AttachMapper, Attach> implements IAttachService {
+
+	@Override
+	public IPage<AttachVO> selectAttachPage(IPage<AttachVO> page, AttachVO attach) {
+		return page.setRecords(baseMapper.selectAttachPage(page, attach));
+	}
+
+}

+ 35 - 0
src/main/java/org/springblade/modules/resource/vo/AttachVO.java

@@ -0,0 +1,35 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.resource.vo;
+
+import org.springblade.modules.resource.entity.Attach;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 附件表视图实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "AttachVO对象", description = "附件表")
+public class AttachVO extends Attach {
+	private static final long serialVersionUID = 1L;
+
+}

Некоторые файлы не были показаны из-за большого количества измененных файлов