oss插件完善,代码生成器扫描数据库表名
parent
b7748c9606
commit
bf7239464e
|
@ -1,12 +0,0 @@
|
|||
package com.muyu.file.service;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* @author Eric
|
||||
* @create 2022-04-24 23:39
|
||||
*/
|
||||
public interface OssService {
|
||||
//上传头像到oss
|
||||
String uploadFileAvatar(MultipartFile file);
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
//package com.muyu.file.service;
|
||||
//
|
||||
//import com.aliyun.oss.OSS;
|
||||
//import com.aliyun.oss.OSSClientBuilder;
|
||||
//import com.muyu.file.utils.ConstantPropertiesUtil;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//import org.springframework.web.multipart.MultipartFile;
|
||||
//
|
||||
//import java.io.InputStream;
|
||||
//
|
||||
///**
|
||||
// * @author Eric
|
||||
// * @create 2022-04-24 23:40
|
||||
// */
|
||||
//@Service
|
||||
//public class OssServiceImpl implements OssService {
|
||||
//
|
||||
// //上传头像到oss
|
||||
// @Override
|
||||
// public String uploadFileAvatar(MultipartFile file) {
|
||||
//
|
||||
// //工具类获取值:分别是:地域节点、id、秘钥、项目名称
|
||||
// String endpoint = ConstantPropertiesUtil.END_POINT;
|
||||
// String accessKeyId = ConstantPropertiesUtil.ACCESS_KEY_ID;
|
||||
// String accessKeySecret = ConstantPropertiesUtil.ACCESS_KEY_SECRET;
|
||||
// String bucketName = ConstantPropertiesUtil.BUCKET_NAME;
|
||||
//
|
||||
// try {
|
||||
// // 创建OSS实例。
|
||||
// OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
|
||||
//
|
||||
// //获取上传文件输入流
|
||||
// InputStream inputStream = file.getInputStream();
|
||||
// //获取文件名称
|
||||
// String fileName = file.getOriginalFilename();
|
||||
//
|
||||
// //1、在文件名称里面添加随机唯一值(因为如果上传文件名称相同的话,后面的问价会将前面的文件给覆盖了)
|
||||
// String uuid = UUID.randomUUID().toString().replaceAll("-","");//因为生成后的值有横岗,我们就把它去除,不替换也可以,也没有错
|
||||
// fileName = uuid + fileName;
|
||||
//
|
||||
// //2、把文件安装日期进行分类: 2022/10/11/1.jpg
|
||||
// //获取当前日期
|
||||
// String datePath = new DateTime().toString("yyyy/MM/dd");//在依赖中引入了该工具类
|
||||
//
|
||||
// //拼接
|
||||
// fileName = datePath + "/" + fileName;
|
||||
//
|
||||
// //调用oss方法实现上传
|
||||
// //参数一:Bucket名称 参数二:上传到oss文件路径和文件名称 比如 /aa/bb/1.jpg 或者直接使用文件名称 参数三:上传文件的流
|
||||
// ossClient.putObject(bucketName,fileName,inputStream);
|
||||
//
|
||||
// //关闭OSSClient
|
||||
// ossClient.shutdown();
|
||||
//
|
||||
// //把上传之后的文件路径返回
|
||||
// //需要把上传到阿里云路径返回 https://edu-guli-eric.oss-cn-beijing.aliyuncs.com/1.jpg
|
||||
// String url = " https://"+bucketName+"."+endpoint+"/"+fileName;
|
||||
// return url;
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//}
|
|
@ -176,18 +176,18 @@ public class OSSCloudClient {
|
|||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
OSSCloudClient client = OSSCloudClient.getInstance();
|
||||
String filePath = client.uploadFile("读书记录封面.png", "1", "D:\\Pictures\\bookrecording\\读书记录封面.png");
|
||||
System.out.println(filePath);
|
||||
System.out.println(client.fileExist(filePath));
|
||||
List<String> list = client.listFiles("1/20220416/");
|
||||
for(String s : list) {
|
||||
System.out.println(s);
|
||||
client.deleteFile(s);
|
||||
}
|
||||
client.deleteFile("https://zhaohy-bucket.oss-cn-guangzhou.aliyuncs.com/static/images/1/20220415");
|
||||
}
|
||||
// public static void main(String[] args) throws Exception {
|
||||
// OSSCloudClient client = OSSCloudClient.getInstance();
|
||||
// String filePath = client.uploadFile("读书记录封面.png", "1", "C:\\Users\\墨白\\Desktop\\img\\nvpu.png");
|
||||
// System.out.println(filePath);
|
||||
// System.out.println(client.fileExist(filePath));
|
||||
// List<String> list = client.listFiles("1/20220416/");
|
||||
// for(String s : list) {
|
||||
// System.out.println(s);
|
||||
// client.deleteFile(s);
|
||||
// }
|
||||
// client.deleteFile("https://zhaohy-bucket.oss-cn-guangzhou.aliyuncs.com/static/images/1/20220415");
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -117,7 +117,9 @@
|
|||
|
||||
<select id="selectDbTableListByNames" resultMap="GenTableResult">
|
||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||
where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
|
||||
where table_name NOT LIKE 'qrtz_%'
|
||||
and table_name NOT LIKE 'gen_%'
|
||||
and (table_schema = (select database()) or table_schema = 'ten-product')
|
||||
and table_name in
|
||||
<foreach collection="array" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
|
|
Loading…
Reference in New Issue