提交代码
This commit is contained in:
parent
14ae1e1fb3
commit
b562b457a4
|
|
@ -209,4 +209,33 @@ public class MinioUtil {
|
|||
public String joinPath(String folderPath, String filename) {
|
||||
return folderPath.replaceAll("/+$", "") + "/" + filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件的临时访问 URL,指定过期时间
|
||||
* @param bucketName 存储桶名称
|
||||
* @param objectName 存储对象名称(文件名)
|
||||
* @param expiryTimeInSeconds URL 的有效时长(秒)
|
||||
* @return 文件的临时访问 URL
|
||||
* @throws Exception 若生成 URL 过程中发生异常
|
||||
*/
|
||||
public String getFileUrl(String bucketName, String objectName, int expiryTimeInSeconds) throws Exception {
|
||||
return minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder()
|
||||
.bucket(bucketName)
|
||||
.object(objectName)
|
||||
.expiry(expiryTimeInSeconds)
|
||||
.method(Method.GET)
|
||||
.build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件的临时访问 URL,默认过期时间为 7 天
|
||||
* @param bucketName 存储桶名称
|
||||
* @param objectName 存储对象名称(文件名)
|
||||
* @return 文件的临时访问 URL
|
||||
* @throws Exception 若生成 URL 过程中发生异常
|
||||
*/
|
||||
public String getFileUrl(String bucketName, String objectName) throws Exception {
|
||||
// 604800 秒 = 7 天
|
||||
return getFileUrl(bucketName, objectName, 604800);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,12 +27,13 @@
|
|||
</delete>
|
||||
|
||||
<!-- 删除数据集文件映射关系 -->
|
||||
<update id="deleteDatasetFiles">
|
||||
update FROM ai_dataset_file_map
|
||||
<delete id="deleteDatasetFiles" parameterType="String">
|
||||
delete from ai_dataset_file_map
|
||||
where dataset_id in
|
||||
<foreach collection="array" item="datasetId" open="(" separator="," close=")">
|
||||
#{datasetId}
|
||||
</foreach>
|
||||
</update>
|
||||
</delete>
|
||||
|
||||
<!-- <delete id="deleteDatasetFiles">-->
|
||||
<!-- DELETE FROM ai_dataset_file_map-->
|
||||
|
|
|
|||
Loading…
Reference in New Issue