list = baseMapper.selectBatchIds(ids);
for (SysOss sysOss : list) {
- IOssStrategy storage = OssFactory.instance(sysOss.getService());
+ OssClient storage = OssFactory.instance(sysOss.getService());
storage.delete(sysOss.getUrl());
}
return baseMapper.deleteBatchIds(ids) > 0;
diff --git a/ruoyi-ui/src/views/system/oss/config.vue b/ruoyi-ui/src/views/system/oss/config.vue
index 152727efd..54ad98cb1 100644
--- a/ruoyi-ui/src/views/system/oss/config.vue
+++ b/ruoyi-ui/src/views/system/oss/config.vue
@@ -2,14 +2,13 @@
-
-
-
+
+
@@ -122,18 +122,14 @@
-
-
-
+
+
+
+
@@ -204,14 +200,6 @@ export default {
total: 0,
// 对象存储配置表格数据
ossConfigList: [],
- // configKeyOptions
- configKeyOptions: [],
- configKeyDatas: [
- { configKey: "minio", label: "Minio" },
- { configKey: "qiniu", label: "七牛云" },
- { configKey: "aliyun", label: "阿里云" },
- { configKey: "qcloud", label: "腾讯云" },
- ],
// 弹出层标题
title: "",
// 是否显示弹出层
@@ -276,7 +264,6 @@ export default {
},
created() {
this.getList();
- this.configKeyOptions = this.configKeyDatas;
},
methods: {
/** 查询对象存储配置列表 */
@@ -303,6 +290,7 @@ export default {
bucketName: undefined,
prefix: undefined,
endpoint: undefined,
+ domain: undefined,
isHttps: "N",
region: undefined,
status: "1",
diff --git a/script/sql/oracle/oracle_ry_vue_4.X.sql b/script/sql/oracle/oracle_ry_vue_4.X.sql
index 68b29e998..d2dffe956 100644
--- a/script/sql/oracle/oracle_ry_vue_4.X.sql
+++ b/script/sql/oracle/oracle_ry_vue_4.X.sql
@@ -904,6 +904,7 @@ create table sys_oss_config (
bucket_name varchar(255) default '',
prefix varchar(255) default '',
endpoint varchar(255) default '',
+ domain varchar(255) default '',
is_https char(1) default 'N',
region varchar(255) default '',
status char(1) default '1',
@@ -925,6 +926,7 @@ comment on column sys_oss_config.secret_key is '秘钥';
comment on column sys_oss_config.bucket_name is '桶名称';
comment on column sys_oss_config.prefix is '前缀';
comment on column sys_oss_config.endpoint is '访问站点';
+comment on column sys_oss_config.domain is '自定义域名';
comment on column sys_oss_config.is_https is '是否https(Y=是,N=否)';
comment on column sys_oss_config.region is '域';
comment on column sys_oss_config.status is '状态(0=正常,1=停用)';
@@ -935,10 +937,10 @@ comment on column sys_oss_config.create_time is '创建时间';
comment on column sys_oss_config.update_by is '更新者';
comment on column sys_oss_config.update_time is '更新时间';
-insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'http://localhost:9000', 'N', '', '0', '', NULL, 'admin', sysdate, 'admin', sysdate);
-insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'http://XXX.XXXX.com', 'N', 'z0', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
-insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'http://oss-cn-beijing.aliyuncs.com', 'N', '', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
-insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', 'http://cos.ap-beijing.myqcloud.com', 'N', 'ap-beijing', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
+insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'localhost:9000/<桶名>', '','N', '', '0', '', NULL, 'admin', sysdate, 'admin', sysdate);
+insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
+insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', '<桶名>.oss-cn-beijing.aliyuncs.com', '','N', '', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
+insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', '<桶名>.cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
-- ----------------------------
-- 钩子 ,用于session连接之后 自动设置默认的date类型格式化 简化时间查询
diff --git a/script/sql/postgres/postgres_ry_vue_4.X.sql b/script/sql/postgres/postgres_ry_vue_4.X.sql
index 850491fc6..2bcfc8b9c 100644
--- a/script/sql/postgres/postgres_ry_vue_4.X.sql
+++ b/script/sql/postgres/postgres_ry_vue_4.X.sql
@@ -917,6 +917,7 @@ create table if not exists sys_oss_config
bucket_name varchar(255) default ''::varchar,
prefix varchar(255) default ''::varchar,
endpoint varchar(255) default ''::varchar,
+ domain varchar(255) default ''::varchar,
is_https char default 'N'::bpchar,
region varchar(255) default ''::varchar,
status char default '1'::bpchar,
@@ -937,6 +938,7 @@ comment on column sys_oss_config.secret_key is '秘钥';
comment on column sys_oss_config.bucket_name is '桶名称';
comment on column sys_oss_config.prefix is '前缀';
comment on column sys_oss_config.endpoint is '访问站点';
+comment on column sys_oss_config.domain is '自定义域名';
comment on column sys_oss_config.is_https is '是否https(Y=是,N=否)';
comment on column sys_oss_config.region is '域';
comment on column sys_oss_config.status is '状态(0=正常,1=停用)';
@@ -947,7 +949,7 @@ comment on column sys_oss_config.update_by is '更新者';
comment on column sys_oss_config.update_time is '更新时间';
comment on column sys_oss_config.remark is '备注';
-insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'http://localhost:9000', 'N', '', '0', '', 'admin', now(), 'admin', now(), null);
-insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'http://XXX.XXXX.com', 'N', 'z0', '1', '', 'admin', now(), 'admin', now(), null);
-insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'http://oss-cn-beijing.aliyuncs.com', 'N', '', '1', '', 'admin', now(), 'admin', now(), null);
-insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', 'http://cos.ap-beijing.myqcloud.com', 'N', 'ap-beijing', '1', '', 'admin', now(), 'admin', now(), null);
+insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'localhost:9000/<桶名>', '','N', '', '0', '', 'admin', now(), 'admin', now(), null);
+insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '', 'admin', now(), 'admin', now(), null);
+insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', '<桶名>.oss-cn-beijing.aliyuncs.com', '','N', '', '1', '', 'admin', now(), 'admin', now(), null);
+insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', '<桶名>.cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', 'admin', now(), 'admin', now(), null);
diff --git a/script/sql/ry_vue_4.X.sql b/script/sql/ry_vue_4.X.sql
index e190186ba..c5033ef00 100644
--- a/script/sql/ry_vue_4.X.sql
+++ b/script/sql/ry_vue_4.X.sql
@@ -668,6 +668,7 @@ create table sys_oss_config (
bucket_name varchar(255) default '' comment '桶名称',
prefix varchar(255) default '' comment '前缀',
endpoint varchar(255) default '' comment '访问站点',
+ domain varchar(255) default '' comment '自定义域名',
is_https char(1) default 'N' comment '是否https(Y=是,N=否)',
region varchar(255) default '' comment '域',
status char(1) default '1' comment '状态(0=正常,1=停用)',
@@ -680,7 +681,7 @@ create table sys_oss_config (
primary key (oss_config_id)
) engine=innodb comment='对象存储配置表';
-insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'http://localhost:9000', 'N', '', '0', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
-insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'http://XXX.XXXX.com', 'N', 'z0', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
-insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'http://oss-cn-beijing.aliyuncs.com', 'N', '', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
-insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', 'http://cos.ap-beijing.myqcloud.com', 'N', 'ap-beijing', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
+insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'localhost:9000/<桶名>', '','N', '', '0', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
+insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
+insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', '<桶名>.oss-cn-beijing.aliyuncs.com', '','N', '', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
+insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', '<桶名>.cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
diff --git a/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql b/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql
index d37f1b40e..45f300219 100644
--- a/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql
+++ b/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql
@@ -2193,6 +2193,7 @@ CREATE TABLE [sys_oss_config]
[bucket_name] nvarchar(255) DEFAULT '' NULL,
[prefix] nvarchar(255) DEFAULT '' NULL,
[endpoint] nvarchar(255) DEFAULT '' NULL,
+ [domain] nvarchar(255) DEFAULT '' NULL,
[is_https] nchar(1) DEFAULT ('N') NULL,
[region] nvarchar(255) DEFAULT '' NULL,
[status] nchar(1) DEFAULT ('1') NULL,
@@ -2251,6 +2252,12 @@ EXEC sp_addextendedproperty
'TABLE', N'sys_oss_config',
'COLUMN', N'endpoint'
GO
+EXEC sp_addextendedproperty
+ 'MS_Description', N'自定义域名',
+ 'SCHEMA', N'dbo',
+ 'TABLE', N'sys_oss_config',
+ 'COLUMN', N'domain'
+GO
EXEC sp_addextendedproperty
'MS_Description', N'是否https(Y=是,N=否)',
'SCHEMA', N'dbo',
@@ -2311,11 +2318,11 @@ EXEC sp_addextendedproperty
'TABLE', N'sys_oss_config'
GO
-INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'1', N'minio', N'lihongbo', N'lihongbo.123', N'ruoyi', N'', N'http://81.70.150.73:9000', N'N', N'', N'0', N'', N'admin', getdate(), N'admin', getdate(), NULL)
+INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [domain], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'1', N'minio', N'ruoyi', N'ruoyi123', N'ruoyi', N'', N'localhost:9000/<桶名>', N'',N'N', N'', N'0', N'', N'admin', getdate(), N'admin', getdate(), NULL)
GO
-INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'2', N'qiniu', N'XXXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi', N'', N'http://XXX.XXXX.com', N'N', N'z0', N'1', N'', N'admin', getdate(), N'admin', getdate(), NULL)
+INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [domain], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'2', N'qiniu', N'XXXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi', N'', N's3-cn-north-1.qiniucs.com', N'',N'N', N'', N'1', N'', N'admin', getdate(), N'admin', getdate(), NULL)
GO
-INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'3', N'aliyun', N'XXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi', N'', N'http://oss-cn-beijing.aliyuncs.com', N'N', N'', N'1', N'', N'admin', getdate(), N'admin', getdate(), NULL)
+INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [domain], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'3', N'aliyun', N'XXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi', N'', N'<桶名>.oss-cn-beijing.aliyuncs.com', N'',N'N', N'', N'1', N'', N'admin', getdate(), N'admin', getdate(), NULL)
GO
-INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'4', N'qcloud', N'XXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi-1250000000', N'', N'http://cos.ap-beijing.myqcloud.com', N'N', N'ap-beijing', N'1', N'', N'admin', getdate(), N'admin', getdate(), NULL)
+INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [domain], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'4', N'qcloud', N'XXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi-1250000000', N'', N'<桶名>.cos.ap-beijing.myqcloud.com', N'',N'N', N'ap-beijing', N'1', N'', N'admin', getdate(), N'admin', getdate(), NULL)
GO
diff --git a/script/sql/update/oracle/update-4.1-4.2.sql b/script/sql/update/oracle/update-4.1-4.2.sql
new file mode 100644
index 000000000..2c812243c
--- /dev/null
+++ b/script/sql/update/oracle/update-4.1-4.2.sql
@@ -0,0 +1,8 @@
+ALTER TABLE "SYS_OSS_CONFIG" ADD ("DOMAIN" VARCHAR2(255));
+
+COMMENT ON COLUMN "SYS_OSS_CONFIG"."DOMAIN" IS '自定义域名';
+
+update sys_oss_config set endpoint = 'localhost:9000/<桶名>' where oss_config_id = 1;
+update sys_oss_config set endpoint = 's3-cn-north-1.qiniucs.com', region = '' where oss_config_id = 2;
+update sys_oss_config set endpoint = '<桶名>.oss-cn-beijing.aliyuncs.com' where oss_config_id = 3;
+update sys_oss_config set endpoint = '<桶名>.cos.ap-beijing.myqcloud.com' where oss_config_id = 4;
diff --git a/script/sql/update/postgres/update-4.1-4.2.sql b/script/sql/update/postgres/update-4.1-4.2.sql
new file mode 100644
index 000000000..0520cab94
--- /dev/null
+++ b/script/sql/update/postgres/update-4.1-4.2.sql
@@ -0,0 +1,8 @@
+ALTER TABLE "sys_oss_config" ADD COLUMN "domain" varchar(255);
+
+COMMENT ON COLUMN "sys_oss_config"."domain" IS '自定义域名';
+
+update sys_oss_config set endpoint = 'localhost:9000/<桶名>' where oss_config_id = 1;
+update sys_oss_config set endpoint = 's3-cn-north-1.qiniucs.com', region = '' where oss_config_id = 2;
+update sys_oss_config set endpoint = '<桶名>.oss-cn-beijing.aliyuncs.com' where oss_config_id = 3;
+update sys_oss_config set endpoint = '<桶名>.cos.ap-beijing.myqcloud.com' where oss_config_id = 4;
diff --git a/script/sql/update/sqlserver/update-4.1-4.2.sql b/script/sql/update/sqlserver/update-4.1-4.2.sql
new file mode 100644
index 000000000..e9f23b6dd
--- /dev/null
+++ b/script/sql/update/sqlserver/update-4.1-4.2.sql
@@ -0,0 +1,21 @@
+ALTER TABLE [sys_oss_config] ADD [domain] nvarchar(255) DEFAULT '' NULL
+GO
+
+EXEC sp_addextendedproperty
+'MS_Description', N'自定义域名',
+'SCHEMA', N'dbo',
+'TABLE', N'sys_oss_config',
+'COLUMN', N'domain'
+GO
+
+UPDATE [sys_oss_config] SET [access_key] = N'ruoyi', [secret_key] = N'ruoyi123', [endpoint] = N'localhost:9000/<桶名>' WHERE [oss_config_id] = 1
+GO
+
+UPDATE [sys_oss_config] SET [endpoint] = N's3-cn-north-1.qiniucs.com' WHERE [oss_config_id] = 2
+GO
+
+UPDATE [sys_oss_config] SET [endpoint] = N'<桶名>.oss-cn-beijing.aliyuncs.com' WHERE [oss_config_id] = 3
+GO
+
+UPDATE [sys_oss_config] SET [endpoint] = N'<桶名>.cos.ap-beijing.myqcloud.com' WHERE [oss_config_id] = 4
+GO
diff --git a/script/sql/update/update-4.1-4.2.sql b/script/sql/update/update-4.1-4.2.sql
new file mode 100644
index 000000000..487e3d084
--- /dev/null
+++ b/script/sql/update/update-4.1-4.2.sql
@@ -0,0 +1,6 @@
+alter table sys_oss_config add column domain varchar(255) null default '' COMMENT '自定义域名';
+
+update sys_oss_config set endpoint = 'localhost:9000/<桶名>' where oss_config_id = 1;
+update sys_oss_config set endpoint = 's3-cn-north-1.qiniucs.com', region = '' where oss_config_id = 2;
+update sys_oss_config set endpoint = '<桶名>.oss-cn-beijing.aliyuncs.com' where oss_config_id = 3;
+update sys_oss_config set endpoint = '<桶名>.cos.ap-beijing.myqcloud.com' where oss_config_id = 4;
From 5cb963bd344c25154409eb9769590fc682b39e63 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?=
<15040126243@163.com>
Date: Mon, 9 May 2022 23:56:01 +0800
Subject: [PATCH 2/4] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?=
=?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=AF=BC=E8=87=B4=E7=9A=84minio=E6=97=A0?=
=?UTF-8?q?=E6=B3=95=E9=A2=84=E8=A7=88=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/ruoyi/oss/constant/OssConstant.java | 5 ++
.../java/com/ruoyi/oss/core/OssClient.java | 59 ++++++++++++++++++-
.../java/com/ruoyi/oss/enumd/PolicyType.java | 35 +++++++++++
script/sql/oracle/oracle_ry_vue_4.X.sql | 2 +-
script/sql/postgres/postgres_ry_vue_4.X.sql | 2 +-
script/sql/ry_vue_4.X.sql | 2 +-
script/sql/sqlserver/sqlserver_ry_vue_4.X.sql | 2 +-
script/sql/update/oracle/update-4.1-4.2.sql | 2 +-
script/sql/update/postgres/update-4.1-4.2.sql | 2 +-
.../sql/update/sqlserver/update-4.1-4.2.sql | 2 +-
script/sql/update/update-4.1-4.2.sql | 2 +-
11 files changed, 104 insertions(+), 11 deletions(-)
create mode 100644 ruoyi-oss/src/main/java/com/ruoyi/oss/enumd/PolicyType.java
diff --git a/ruoyi-oss/src/main/java/com/ruoyi/oss/constant/OssConstant.java b/ruoyi-oss/src/main/java/com/ruoyi/oss/constant/OssConstant.java
index 6c00cd8db..1d1a77708 100644
--- a/ruoyi-oss/src/main/java/com/ruoyi/oss/constant/OssConstant.java
+++ b/ruoyi-oss/src/main/java/com/ruoyi/oss/constant/OssConstant.java
@@ -35,6 +35,11 @@ public interface OssConstant {
*/
List SYSTEM_DATA_IDS = Arrays.asList(1, 2, 3, 4);
+ /**
+ * 云服务商
+ */
+ String[] CLOUD_SERVICE = new String[] {"aliyun", "qcloud", "qiniu"};
+
/**
* https 状态
*/
diff --git a/ruoyi-oss/src/main/java/com/ruoyi/oss/core/OssClient.java b/ruoyi-oss/src/main/java/com/ruoyi/oss/core/OssClient.java
index 0baa90d98..2866b753d 100644
--- a/ruoyi-oss/src/main/java/com/ruoyi/oss/core/OssClient.java
+++ b/ruoyi-oss/src/main/java/com/ruoyi/oss/core/OssClient.java
@@ -10,11 +10,15 @@ import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
-import com.amazonaws.services.s3.model.*;
+import com.amazonaws.services.s3.model.CannedAccessControlList;
+import com.amazonaws.services.s3.model.CreateBucketRequest;
+import com.amazonaws.services.s3.model.ObjectMetadata;
+import com.amazonaws.services.s3.model.PutObjectRequest;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.oss.constant.OssConstant;
import com.ruoyi.oss.entity.UploadResult;
+import com.ruoyi.oss.enumd.PolicyType;
import com.ruoyi.oss.exception.OssException;
import com.ruoyi.oss.properties.OssProperties;
@@ -23,7 +27,7 @@ import java.io.InputStream;
/**
* S3 存储协议 所有兼容S3协议的云厂商均支持
- * 阿里云 腾讯云 华为云 七牛云 minio
+ * 阿里云 腾讯云 七牛云 minio
*
* @author Lion Li
*/
@@ -75,6 +79,7 @@ public class OssClient {
CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName);
createBucketRequest.setCannedAcl(CannedAccessControlList.PublicRead);
client.createBucket(createBucketRequest);
+ client.setBucketPolicy(bucketName, getPolicy(bucketName, PolicyType.READ));
} catch (Exception e) {
throw new OssException("创建Bucket失败, 请核对配置信息:[" + e.getMessage() + "]");
}
@@ -88,6 +93,7 @@ public class OssClient {
try {
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentType(contentType);
+ metadata.setContentLength(inputStream.available());
client.putObject(new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata));
} catch (Exception e) {
throw new OssException("上传文件失败,请检查配置信息:[" + e.getMessage() + "]");
@@ -117,7 +123,18 @@ public class OssClient {
if (StringUtils.isNotBlank(domain)) {
return domain;
}
- return properties.getEndpoint();
+ String endpoint = properties.getEndpoint();
+ if (OssConstant.IS_HTTPS.equals(properties.getIsHttps())) {
+ endpoint = "https://" + endpoint;
+ } else {
+ endpoint = "http://" + endpoint;
+ }
+ // 云服务商直接返回
+ if (StringUtils.containsAny(endpoint, OssConstant.CLOUD_SERVICE)){
+ return endpoint;
+ }
+ // minio 单独处理
+ return endpoint + "/" + properties.getBucketName();
}
public String getPath(String prefix, String suffix) {
@@ -136,4 +153,40 @@ public class OssClient {
return configKey;
}
+ private static String getPolicy(String bucketName, PolicyType policyType) {
+ StringBuilder builder = new StringBuilder();
+ builder.append("{\n\"Statement\": [\n{\n\"Action\": [\n");
+ if (policyType == PolicyType.WRITE) {
+ builder.append("\"s3:GetBucketLocation\",\n\"s3:ListBucketMultipartUploads\"\n");
+ } else if (policyType == PolicyType.READ_WRITE) {
+ builder.append("\"s3:GetBucketLocation\",\n\"s3:ListBucket\",\n\"s3:ListBucketMultipartUploads\"\n");
+ } else {
+ builder.append("\"s3:GetBucketLocation\"\n");
+ }
+ builder.append("],\n\"Effect\": \"Allow\",\n\"Principal\": \"*\",\n\"Resource\": \"arn:aws:s3:::");
+ builder.append(bucketName);
+ builder.append("\"\n},\n");
+ if (policyType == PolicyType.READ) {
+ builder.append("{\n\"Action\": [\n\"s3:ListBucket\"\n],\n\"Effect\": \"Deny\",\n\"Principal\": \"*\",\n\"Resource\": \"arn:aws:s3:::");
+ builder.append(bucketName);
+ builder.append("\"\n},\n");
+ }
+ builder.append("{\n\"Action\": ");
+ switch (policyType) {
+ case WRITE:
+ builder.append("[\n\"s3:AbortMultipartUpload\",\n\"s3:DeleteObject\",\n\"s3:ListMultipartUploadParts\",\n\"s3:PutObject\"\n],\n");
+ break;
+ case READ_WRITE:
+ builder.append("[\n\"s3:AbortMultipartUpload\",\n\"s3:DeleteObject\",\n\"s3:GetObject\",\n\"s3:ListMultipartUploadParts\",\n\"s3:PutObject\"\n],\n");
+ break;
+ default:
+ builder.append("\"s3:GetObject\",\n");
+ break;
+ }
+ builder.append("\"Effect\": \"Allow\",\n\"Principal\": \"*\",\n\"Resource\": \"arn:aws:s3:::");
+ builder.append(bucketName);
+ builder.append("/*\"\n}\n],\n\"Version\": \"2012-10-17\"\n}\n");
+ return builder.toString();
+ }
+
}
diff --git a/ruoyi-oss/src/main/java/com/ruoyi/oss/enumd/PolicyType.java b/ruoyi-oss/src/main/java/com/ruoyi/oss/enumd/PolicyType.java
new file mode 100644
index 000000000..606f0f484
--- /dev/null
+++ b/ruoyi-oss/src/main/java/com/ruoyi/oss/enumd/PolicyType.java
@@ -0,0 +1,35 @@
+package com.ruoyi.oss.enumd;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * minio策略配置
+ *
+ * @author Lion Li
+ */
+@Getter
+@AllArgsConstructor
+public enum PolicyType {
+
+ /**
+ * 只读
+ */
+ READ("read-only"),
+
+ /**
+ * 只写
+ */
+ WRITE("write-only"),
+
+ /**
+ * 读写
+ */
+ READ_WRITE("read-write");
+
+ /**
+ * 类型
+ */
+ private final String type;
+
+}
diff --git a/script/sql/oracle/oracle_ry_vue_4.X.sql b/script/sql/oracle/oracle_ry_vue_4.X.sql
index d2dffe956..e57adb06d 100644
--- a/script/sql/oracle/oracle_ry_vue_4.X.sql
+++ b/script/sql/oracle/oracle_ry_vue_4.X.sql
@@ -937,7 +937,7 @@ comment on column sys_oss_config.create_time is '创建时间';
comment on column sys_oss_config.update_by is '更新者';
comment on column sys_oss_config.update_time is '更新时间';
-insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'localhost:9000/<桶名>', '','N', '', '0', '', NULL, 'admin', sysdate, 'admin', sysdate);
+insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'localhost:9000', '','N', '', '0', '', NULL, 'admin', sysdate, 'admin', sysdate);
insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', '<桶名>.oss-cn-beijing.aliyuncs.com', '','N', '', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', '<桶名>.cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
diff --git a/script/sql/postgres/postgres_ry_vue_4.X.sql b/script/sql/postgres/postgres_ry_vue_4.X.sql
index 2bcfc8b9c..4f90462f1 100644
--- a/script/sql/postgres/postgres_ry_vue_4.X.sql
+++ b/script/sql/postgres/postgres_ry_vue_4.X.sql
@@ -949,7 +949,7 @@ comment on column sys_oss_config.update_by is '更新者';
comment on column sys_oss_config.update_time is '更新时间';
comment on column sys_oss_config.remark is '备注';
-insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'localhost:9000/<桶名>', '','N', '', '0', '', 'admin', now(), 'admin', now(), null);
+insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'localhost:9000', '','N', '', '0', '', 'admin', now(), 'admin', now(), null);
insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '', 'admin', now(), 'admin', now(), null);
insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', '<桶名>.oss-cn-beijing.aliyuncs.com', '','N', '', '1', '', 'admin', now(), 'admin', now(), null);
insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', '<桶名>.cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', 'admin', now(), 'admin', now(), null);
diff --git a/script/sql/ry_vue_4.X.sql b/script/sql/ry_vue_4.X.sql
index c5033ef00..f802a5976 100644
--- a/script/sql/ry_vue_4.X.sql
+++ b/script/sql/ry_vue_4.X.sql
@@ -681,7 +681,7 @@ create table sys_oss_config (
primary key (oss_config_id)
) engine=innodb comment='对象存储配置表';
-insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'localhost:9000/<桶名>', '','N', '', '0', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
+insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'localhost:9000', '','N', '', '0', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', '<桶名>.oss-cn-beijing.aliyuncs.com', '','N', '', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', '<桶名>.cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
diff --git a/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql b/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql
index 45f300219..14c1f3b56 100644
--- a/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql
+++ b/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql
@@ -2318,7 +2318,7 @@ EXEC sp_addextendedproperty
'TABLE', N'sys_oss_config'
GO
-INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [domain], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'1', N'minio', N'ruoyi', N'ruoyi123', N'ruoyi', N'', N'localhost:9000/<桶名>', N'',N'N', N'', N'0', N'', N'admin', getdate(), N'admin', getdate(), NULL)
+INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [domain], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'1', N'minio', N'ruoyi', N'ruoyi123', N'ruoyi', N'', N'localhost:9000', N'',N'N', N'', N'0', N'', N'admin', getdate(), N'admin', getdate(), NULL)
GO
INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [domain], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'2', N'qiniu', N'XXXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi', N'', N's3-cn-north-1.qiniucs.com', N'',N'N', N'', N'1', N'', N'admin', getdate(), N'admin', getdate(), NULL)
GO
diff --git a/script/sql/update/oracle/update-4.1-4.2.sql b/script/sql/update/oracle/update-4.1-4.2.sql
index 2c812243c..9191a1f60 100644
--- a/script/sql/update/oracle/update-4.1-4.2.sql
+++ b/script/sql/update/oracle/update-4.1-4.2.sql
@@ -2,7 +2,7 @@ ALTER TABLE "SYS_OSS_CONFIG" ADD ("DOMAIN" VARCHAR2(255));
COMMENT ON COLUMN "SYS_OSS_CONFIG"."DOMAIN" IS '自定义域名';
-update sys_oss_config set endpoint = 'localhost:9000/<桶名>' where oss_config_id = 1;
+update sys_oss_config set endpoint = 'localhost:9000' where oss_config_id = 1;
update sys_oss_config set endpoint = 's3-cn-north-1.qiniucs.com', region = '' where oss_config_id = 2;
update sys_oss_config set endpoint = '<桶名>.oss-cn-beijing.aliyuncs.com' where oss_config_id = 3;
update sys_oss_config set endpoint = '<桶名>.cos.ap-beijing.myqcloud.com' where oss_config_id = 4;
diff --git a/script/sql/update/postgres/update-4.1-4.2.sql b/script/sql/update/postgres/update-4.1-4.2.sql
index 0520cab94..d2d0faf4e 100644
--- a/script/sql/update/postgres/update-4.1-4.2.sql
+++ b/script/sql/update/postgres/update-4.1-4.2.sql
@@ -2,7 +2,7 @@ ALTER TABLE "sys_oss_config" ADD COLUMN "domain" varchar(255);
COMMENT ON COLUMN "sys_oss_config"."domain" IS '自定义域名';
-update sys_oss_config set endpoint = 'localhost:9000/<桶名>' where oss_config_id = 1;
+update sys_oss_config set endpoint = 'localhost:9000' where oss_config_id = 1;
update sys_oss_config set endpoint = 's3-cn-north-1.qiniucs.com', region = '' where oss_config_id = 2;
update sys_oss_config set endpoint = '<桶名>.oss-cn-beijing.aliyuncs.com' where oss_config_id = 3;
update sys_oss_config set endpoint = '<桶名>.cos.ap-beijing.myqcloud.com' where oss_config_id = 4;
diff --git a/script/sql/update/sqlserver/update-4.1-4.2.sql b/script/sql/update/sqlserver/update-4.1-4.2.sql
index e9f23b6dd..0f31d00f6 100644
--- a/script/sql/update/sqlserver/update-4.1-4.2.sql
+++ b/script/sql/update/sqlserver/update-4.1-4.2.sql
@@ -8,7 +8,7 @@ EXEC sp_addextendedproperty
'COLUMN', N'domain'
GO
-UPDATE [sys_oss_config] SET [access_key] = N'ruoyi', [secret_key] = N'ruoyi123', [endpoint] = N'localhost:9000/<桶名>' WHERE [oss_config_id] = 1
+UPDATE [sys_oss_config] SET [access_key] = N'ruoyi', [secret_key] = N'ruoyi123', [endpoint] = N'localhost:9000' WHERE [oss_config_id] = 1
GO
UPDATE [sys_oss_config] SET [endpoint] = N's3-cn-north-1.qiniucs.com' WHERE [oss_config_id] = 2
diff --git a/script/sql/update/update-4.1-4.2.sql b/script/sql/update/update-4.1-4.2.sql
index 487e3d084..69397acd3 100644
--- a/script/sql/update/update-4.1-4.2.sql
+++ b/script/sql/update/update-4.1-4.2.sql
@@ -1,6 +1,6 @@
alter table sys_oss_config add column domain varchar(255) null default '' COMMENT '自定义域名';
-update sys_oss_config set endpoint = 'localhost:9000/<桶名>' where oss_config_id = 1;
+update sys_oss_config set endpoint = 'localhost:9000' where oss_config_id = 1;
update sys_oss_config set endpoint = 's3-cn-north-1.qiniucs.com', region = '' where oss_config_id = 2;
update sys_oss_config set endpoint = '<桶名>.oss-cn-beijing.aliyuncs.com' where oss_config_id = 3;
update sys_oss_config set endpoint = '<桶名>.cos.ap-beijing.myqcloud.com' where oss_config_id = 4;
From 689fa50e18718c4cb105b45b17fd457c6ff46208 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?=
<15040126243@163.com>
Date: Tue, 10 May 2022 00:31:03 +0800
Subject: [PATCH 3/4] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?=
=?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=AF=BC=E8=87=B4=E7=9A=84=20=E9=98=BF?=
=?UTF-8?q?=E9=87=8C=E4=BA=91=E5=92=8C=E8=85=BE=E8=AE=AF=E4=BA=91=20?=
=?UTF-8?q?=E6=97=A0=E6=B3=95=E9=A2=84=E8=A7=88=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/main/java/com/ruoyi/oss/core/OssClient.java | 10 +++-------
script/sql/oracle/oracle_ry_vue_4.X.sql | 8 ++++----
script/sql/postgres/postgres_ry_vue_4.X.sql | 4 ++--
script/sql/ry_vue_4.X.sql | 6 +++---
script/sql/sqlserver/sqlserver_ry_vue_4.X.sql | 4 ++--
script/sql/update/oracle/update-4.1-4.2.sql | 4 ++--
script/sql/update/postgres/update-4.1-4.2.sql | 4 ++--
script/sql/update/sqlserver/update-4.1-4.2.sql | 4 ++--
script/sql/update/update-4.1-4.2.sql | 4 ++--
9 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/ruoyi-oss/src/main/java/com/ruoyi/oss/core/OssClient.java b/ruoyi-oss/src/main/java/com/ruoyi/oss/core/OssClient.java
index 2866b753d..6f6be8f8c 100644
--- a/ruoyi-oss/src/main/java/com/ruoyi/oss/core/OssClient.java
+++ b/ruoyi-oss/src/main/java/com/ruoyi/oss/core/OssClient.java
@@ -124,17 +124,13 @@ public class OssClient {
return domain;
}
String endpoint = properties.getEndpoint();
- if (OssConstant.IS_HTTPS.equals(properties.getIsHttps())) {
- endpoint = "https://" + endpoint;
- } else {
- endpoint = "http://" + endpoint;
- }
+ String header = OssConstant.IS_HTTPS.equals(properties.getIsHttps()) ? "https://" : "http://";
// 云服务商直接返回
if (StringUtils.containsAny(endpoint, OssConstant.CLOUD_SERVICE)){
- return endpoint;
+ return header + properties.getBucketName() + "." + endpoint;
}
// minio 单独处理
- return endpoint + "/" + properties.getBucketName();
+ return header + endpoint + "/" + properties.getBucketName();
}
public String getPath(String prefix, String suffix) {
diff --git a/script/sql/oracle/oracle_ry_vue_4.X.sql b/script/sql/oracle/oracle_ry_vue_4.X.sql
index e57adb06d..c89d70377 100644
--- a/script/sql/oracle/oracle_ry_vue_4.X.sql
+++ b/script/sql/oracle/oracle_ry_vue_4.X.sql
@@ -937,10 +937,10 @@ comment on column sys_oss_config.create_time is '创建时间';
comment on column sys_oss_config.update_by is '更新者';
comment on column sys_oss_config.update_time is '更新时间';
-insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'localhost:9000', '','N', '', '0', '', NULL, 'admin', sysdate, 'admin', sysdate);
-insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
-insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', '<桶名>.oss-cn-beijing.aliyuncs.com', '','N', '', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
-insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', '<桶名>.cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
+insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'localhost:9000', '','N', '', '0', '', NULL, 'admin', sysdate, 'admin', sysdate);
+insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
+insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'oss-cn-beijing.aliyuncs.com', '','N', '', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
+insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', 'cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
-- ----------------------------
-- 钩子 ,用于session连接之后 自动设置默认的date类型格式化 简化时间查询
diff --git a/script/sql/postgres/postgres_ry_vue_4.X.sql b/script/sql/postgres/postgres_ry_vue_4.X.sql
index 4f90462f1..aa7fac403 100644
--- a/script/sql/postgres/postgres_ry_vue_4.X.sql
+++ b/script/sql/postgres/postgres_ry_vue_4.X.sql
@@ -951,5 +951,5 @@ comment on column sys_oss_config.remark is '备注';
insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'localhost:9000', '','N', '', '0', '', 'admin', now(), 'admin', now(), null);
insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '', 'admin', now(), 'admin', now(), null);
-insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', '<桶名>.oss-cn-beijing.aliyuncs.com', '','N', '', '1', '', 'admin', now(), 'admin', now(), null);
-insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', '<桶名>.cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', 'admin', now(), 'admin', now(), null);
+insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'oss-cn-beijing.aliyuncs.com', '','N', '', '1', '', 'admin', now(), 'admin', now(), null);
+insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', 'cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', 'admin', now(), 'admin', now(), null);
diff --git a/script/sql/ry_vue_4.X.sql b/script/sql/ry_vue_4.X.sql
index f802a5976..8fd133d22 100644
--- a/script/sql/ry_vue_4.X.sql
+++ b/script/sql/ry_vue_4.X.sql
@@ -682,6 +682,6 @@ create table sys_oss_config (
) engine=innodb comment='对象存储配置表';
insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123', 'ruoyi', '', 'localhost:9000', '','N', '', '0', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
-insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
-insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', '<桶名>.oss-cn-beijing.aliyuncs.com', '','N', '', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
-insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', '<桶名>.cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
+insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
+insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'oss-cn-beijing.aliyuncs.com', '','N', '', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
+insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', 'cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
diff --git a/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql b/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql
index 14c1f3b56..581a11abe 100644
--- a/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql
+++ b/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql
@@ -2322,7 +2322,7 @@ INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secr
GO
INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [domain], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'2', N'qiniu', N'XXXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi', N'', N's3-cn-north-1.qiniucs.com', N'',N'N', N'', N'1', N'', N'admin', getdate(), N'admin', getdate(), NULL)
GO
-INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [domain], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'3', N'aliyun', N'XXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi', N'', N'<桶名>.oss-cn-beijing.aliyuncs.com', N'',N'N', N'', N'1', N'', N'admin', getdate(), N'admin', getdate(), NULL)
+INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [domain], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'3', N'aliyun', N'XXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi', N'', N'oss-cn-beijing.aliyuncs.com', N'',N'N', N'', N'1', N'', N'admin', getdate(), N'admin', getdate(), NULL)
GO
-INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [domain], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'4', N'qcloud', N'XXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi-1250000000', N'', N'<桶名>.cos.ap-beijing.myqcloud.com', N'',N'N', N'ap-beijing', N'1', N'', N'admin', getdate(), N'admin', getdate(), NULL)
+INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [domain], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'4', N'qcloud', N'XXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi-1250000000', N'', N'cos.ap-beijing.myqcloud.com', N'',N'N', N'ap-beijing', N'1', N'', N'admin', getdate(), N'admin', getdate(), NULL)
GO
diff --git a/script/sql/update/oracle/update-4.1-4.2.sql b/script/sql/update/oracle/update-4.1-4.2.sql
index 9191a1f60..e8301c992 100644
--- a/script/sql/update/oracle/update-4.1-4.2.sql
+++ b/script/sql/update/oracle/update-4.1-4.2.sql
@@ -4,5 +4,5 @@ COMMENT ON COLUMN "SYS_OSS_CONFIG"."DOMAIN" IS '自定义域名';
update sys_oss_config set endpoint = 'localhost:9000' where oss_config_id = 1;
update sys_oss_config set endpoint = 's3-cn-north-1.qiniucs.com', region = '' where oss_config_id = 2;
-update sys_oss_config set endpoint = '<桶名>.oss-cn-beijing.aliyuncs.com' where oss_config_id = 3;
-update sys_oss_config set endpoint = '<桶名>.cos.ap-beijing.myqcloud.com' where oss_config_id = 4;
+update sys_oss_config set endpoint = 'oss-cn-beijing.aliyuncs.com' where oss_config_id = 3;
+update sys_oss_config set endpoint = 'cos.ap-beijing.myqcloud.com' where oss_config_id = 4;
diff --git a/script/sql/update/postgres/update-4.1-4.2.sql b/script/sql/update/postgres/update-4.1-4.2.sql
index d2d0faf4e..6e9ec398a 100644
--- a/script/sql/update/postgres/update-4.1-4.2.sql
+++ b/script/sql/update/postgres/update-4.1-4.2.sql
@@ -4,5 +4,5 @@ COMMENT ON COLUMN "sys_oss_config"."domain" IS '自定义域名';
update sys_oss_config set endpoint = 'localhost:9000' where oss_config_id = 1;
update sys_oss_config set endpoint = 's3-cn-north-1.qiniucs.com', region = '' where oss_config_id = 2;
-update sys_oss_config set endpoint = '<桶名>.oss-cn-beijing.aliyuncs.com' where oss_config_id = 3;
-update sys_oss_config set endpoint = '<桶名>.cos.ap-beijing.myqcloud.com' where oss_config_id = 4;
+update sys_oss_config set endpoint = 'oss-cn-beijing.aliyuncs.com' where oss_config_id = 3;
+update sys_oss_config set endpoint = 'cos.ap-beijing.myqcloud.com' where oss_config_id = 4;
diff --git a/script/sql/update/sqlserver/update-4.1-4.2.sql b/script/sql/update/sqlserver/update-4.1-4.2.sql
index 0f31d00f6..3f6dc78f8 100644
--- a/script/sql/update/sqlserver/update-4.1-4.2.sql
+++ b/script/sql/update/sqlserver/update-4.1-4.2.sql
@@ -14,8 +14,8 @@ GO
UPDATE [sys_oss_config] SET [endpoint] = N's3-cn-north-1.qiniucs.com' WHERE [oss_config_id] = 2
GO
-UPDATE [sys_oss_config] SET [endpoint] = N'<桶名>.oss-cn-beijing.aliyuncs.com' WHERE [oss_config_id] = 3
+UPDATE [sys_oss_config] SET [endpoint] = N'oss-cn-beijing.aliyuncs.com' WHERE [oss_config_id] = 3
GO
-UPDATE [sys_oss_config] SET [endpoint] = N'<桶名>.cos.ap-beijing.myqcloud.com' WHERE [oss_config_id] = 4
+UPDATE [sys_oss_config] SET [endpoint] = N'cos.ap-beijing.myqcloud.com' WHERE [oss_config_id] = 4
GO
diff --git a/script/sql/update/update-4.1-4.2.sql b/script/sql/update/update-4.1-4.2.sql
index 69397acd3..ade14471b 100644
--- a/script/sql/update/update-4.1-4.2.sql
+++ b/script/sql/update/update-4.1-4.2.sql
@@ -2,5 +2,5 @@ alter table sys_oss_config add column domain varchar(255) null default '' COMMEN
update sys_oss_config set endpoint = 'localhost:9000' where oss_config_id = 1;
update sys_oss_config set endpoint = 's3-cn-north-1.qiniucs.com', region = '' where oss_config_id = 2;
-update sys_oss_config set endpoint = '<桶名>.oss-cn-beijing.aliyuncs.com' where oss_config_id = 3;
-update sys_oss_config set endpoint = '<桶名>.cos.ap-beijing.myqcloud.com' where oss_config_id = 4;
+update sys_oss_config set endpoint = 'oss-cn-beijing.aliyuncs.com' where oss_config_id = 3;
+update sys_oss_config set endpoint = 'cos.ap-beijing.myqcloud.com' where oss_config_id = 4;
From 82ea39be591e9e4f672ad47287420d04a6b9401c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?=
<15040126243@163.com>
Date: Tue, 10 May 2022 09:29:15 +0800
Subject: [PATCH 4/4] =?UTF-8?q?add=20=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=AE=9A?=
=?UTF-8?q?=E4=B9=89=20oss=5Fconfig=20=E7=A4=BA=E4=BE=8B=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
script/sql/oracle/oracle_ry_vue_4.X.sql | 2 ++
script/sql/postgres/postgres_ry_vue_4.X.sql | 2 ++
script/sql/ry_vue_4.X.sql | 2 ++
script/sql/sqlserver/sqlserver_ry_vue_4.X.sql | 2 ++
script/sql/update/oracle/update-4.1-4.2.sql | 2 ++
script/sql/update/postgres/update-4.1-4.2.sql | 3 +++
script/sql/update/sqlserver/update-4.1-4.2.sql | 3 +++
script/sql/update/update-4.1-4.2.sql | 3 +++
8 files changed, 19 insertions(+)
diff --git a/script/sql/oracle/oracle_ry_vue_4.X.sql b/script/sql/oracle/oracle_ry_vue_4.X.sql
index c89d70377..583f52692 100644
--- a/script/sql/oracle/oracle_ry_vue_4.X.sql
+++ b/script/sql/oracle/oracle_ry_vue_4.X.sql
@@ -941,6 +941,8 @@ insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123',
insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'oss-cn-beijing.aliyuncs.com', '','N', '', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', 'cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
+insert into sys_oss_config values (5, 'image', 'ruoyi', 'ruoyi123', 'ruoyi', 'image', 'localhost:9000', '','N', '', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
+
-- ----------------------------
-- 钩子 ,用于session连接之后 自动设置默认的date类型格式化 简化时间查询
diff --git a/script/sql/postgres/postgres_ry_vue_4.X.sql b/script/sql/postgres/postgres_ry_vue_4.X.sql
index aa7fac403..f4e3026ad 100644
--- a/script/sql/postgres/postgres_ry_vue_4.X.sql
+++ b/script/sql/postgres/postgres_ry_vue_4.X.sql
@@ -953,3 +953,5 @@ insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123',
insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '', 'admin', now(), 'admin', now(), null);
insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'oss-cn-beijing.aliyuncs.com', '','N', '', '1', '', 'admin', now(), 'admin', now(), null);
insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', 'cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', 'admin', now(), 'admin', now(), null);
+insert into sys_oss_config values (5, 'image', 'ruoyi', 'ruoyi123', 'ruoyi', 'image', 'localhost:9000', '','N', '', '1', '', 'admin', now(), 'admin', now(), NULL);
+
diff --git a/script/sql/ry_vue_4.X.sql b/script/sql/ry_vue_4.X.sql
index 8fd133d22..2384b1452 100644
--- a/script/sql/ry_vue_4.X.sql
+++ b/script/sql/ry_vue_4.X.sql
@@ -685,3 +685,5 @@ insert into sys_oss_config values (1, 'minio', 'ruoyi', 'ruoyi123',
insert into sys_oss_config values (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '','N', '', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 'oss-cn-beijing.aliyuncs.com', '','N', '', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', 'cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
+insert into sys_oss_config values (5, 'image', 'ruoyi', 'ruoyi123', 'ruoyi', 'image', 'localhost:9000', '','N', '', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
+
diff --git a/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql b/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql
index 581a11abe..2bf4b5192 100644
--- a/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql
+++ b/script/sql/sqlserver/sqlserver_ry_vue_4.X.sql
@@ -2326,3 +2326,5 @@ INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secr
GO
INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [domain], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'4', N'qcloud', N'XXXXXXXXXXXXXXX', N'XXXXXXXXXXXXXXX', N'ruoyi-1250000000', N'', N'cos.ap-beijing.myqcloud.com', N'',N'N', N'ap-beijing', N'1', N'', N'admin', getdate(), N'admin', getdate(), NULL)
GO
+INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [domain], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'4', N'image', N'ruoyi', N'ruoyi123', N'ruoyi', N'image', N'localhost:9000', N'',N'N', N'', N'1', N'', N'admin', getdate(), N'admin', getdate(), NULL)
+GO
diff --git a/script/sql/update/oracle/update-4.1-4.2.sql b/script/sql/update/oracle/update-4.1-4.2.sql
index e8301c992..a4b52fdf3 100644
--- a/script/sql/update/oracle/update-4.1-4.2.sql
+++ b/script/sql/update/oracle/update-4.1-4.2.sql
@@ -6,3 +6,5 @@ update sys_oss_config set endpoint = 'localhost:9000' where oss_config_id = 1;
update sys_oss_config set endpoint = 's3-cn-north-1.qiniucs.com', region = '' where oss_config_id = 2;
update sys_oss_config set endpoint = 'oss-cn-beijing.aliyuncs.com' where oss_config_id = 3;
update sys_oss_config set endpoint = 'cos.ap-beijing.myqcloud.com' where oss_config_id = 4;
+
+insert into sys_oss_config values (5, 'image', 'ruoyi', 'ruoyi123', 'ruoyi', 'image', 'localhost:9000', '','N', '', '1', '', NULL, 'admin', sysdate, 'admin', sysdate);
diff --git a/script/sql/update/postgres/update-4.1-4.2.sql b/script/sql/update/postgres/update-4.1-4.2.sql
index 6e9ec398a..435dd3919 100644
--- a/script/sql/update/postgres/update-4.1-4.2.sql
+++ b/script/sql/update/postgres/update-4.1-4.2.sql
@@ -6,3 +6,6 @@ update sys_oss_config set endpoint = 'localhost:9000' where oss_config_id = 1;
update sys_oss_config set endpoint = 's3-cn-north-1.qiniucs.com', region = '' where oss_config_id = 2;
update sys_oss_config set endpoint = 'oss-cn-beijing.aliyuncs.com' where oss_config_id = 3;
update sys_oss_config set endpoint = 'cos.ap-beijing.myqcloud.com' where oss_config_id = 4;
+
+insert into sys_oss_config values (5, 'image', 'ruoyi', 'ruoyi123', 'ruoyi', 'image', 'localhost:9000', '','N', '', '1', '', 'admin', now(), 'admin', now(), NULL);
+
diff --git a/script/sql/update/sqlserver/update-4.1-4.2.sql b/script/sql/update/sqlserver/update-4.1-4.2.sql
index 3f6dc78f8..4a07d51aa 100644
--- a/script/sql/update/sqlserver/update-4.1-4.2.sql
+++ b/script/sql/update/sqlserver/update-4.1-4.2.sql
@@ -19,3 +19,6 @@ GO
UPDATE [sys_oss_config] SET [endpoint] = N'cos.ap-beijing.myqcloud.com' WHERE [oss_config_id] = 4
GO
+
+INSERT INTO [sys_oss_config] ([oss_config_id], [config_key], [access_key], [secret_key], [bucket_name], [prefix], [endpoint], [domain], [is_https], [region], [status], [ext1], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (N'4', N'image', N'ruoyi', N'ruoyi123', N'ruoyi', N'image', N'localhost:9000', N'',N'N', N'', N'1', N'', N'admin', getdate(), N'admin', getdate(), NULL)
+GO
diff --git a/script/sql/update/update-4.1-4.2.sql b/script/sql/update/update-4.1-4.2.sql
index ade14471b..28a9ad7eb 100644
--- a/script/sql/update/update-4.1-4.2.sql
+++ b/script/sql/update/update-4.1-4.2.sql
@@ -4,3 +4,6 @@ update sys_oss_config set endpoint = 'localhost:9000' where oss_config_id = 1;
update sys_oss_config set endpoint = 's3-cn-north-1.qiniucs.com', region = '' where oss_config_id = 2;
update sys_oss_config set endpoint = 'oss-cn-beijing.aliyuncs.com' where oss_config_id = 3;
update sys_oss_config set endpoint = 'cos.ap-beijing.myqcloud.com' where oss_config_id = 4;
+
+insert into sys_oss_config values (5, 'image', 'ruoyi', 'ruoyi123', 'ruoyi', 'image', 'localhost:9000', '','N', '', '1', '', 'admin', sysdate(), 'admin', sysdate(), NULL);
+