|
@@ -1,7 +1,5 @@
|
|
|
package cn.iocoder.yudao.module.infra.api.file;
|
|
|
|
|
|
-import cn.hutool.core.util.IdUtil;
|
|
|
-
|
|
|
/**
|
|
|
* 文件 API 接口
|
|
|
*
|
|
@@ -15,17 +13,29 @@ public interface FileApi {
|
|
|
* @param content 文件内容
|
|
|
* @return 文件路径
|
|
|
*/
|
|
|
- default String createFile(byte[] content) throws Exception {
|
|
|
- return createFile(IdUtil.fastUUID(), content);
|
|
|
- }
|
|
|
+ default String createFile(byte[] content) throws Exception {
|
|
|
+ return createFile(null, null, content);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存文件,并返回文件的访问路径
|
|
|
+ *
|
|
|
+ * @param path 文件路径
|
|
|
+ * @param content 文件内容
|
|
|
+ * @return 文件路径
|
|
|
+ */
|
|
|
+ default String createFile(String path, byte[] content) throws Exception {
|
|
|
+ return createFile(null, path, content);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 保存文件,并返回文件的访问路径
|
|
|
*
|
|
|
+ * @param name 原文件名称
|
|
|
* @param path 文件路径
|
|
|
* @param content 文件内容
|
|
|
* @return 文件路径
|
|
|
*/
|
|
|
- String createFile(String path, byte[] content) throws Exception;
|
|
|
+ String createFile(String name, String path, byte[] content) throws Exception;
|
|
|
|
|
|
}
|