package cn.iocoder.yudao.module.system.service.storage; import cn.iocoder.yudao.module.system.controller.admin.storage.vo.SystemStorageBlobRespVO; import cn.iocoder.yudao.module.system.dal.dataobject.storage.SystemStorageBlobDO; import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.util.List; /** * 文件主表 Service 接口 * * @author 超级管理员 */ public interface SystemStorageBlobService { /** * 上传文件 * * @param files 文件列表 * @param isPublic 是否公共文件(true=永久有效,false=临时token控制) * @return 上传结果(含预览/下载地址) */ List upload(List files, Boolean isPublic); /** * 保存内存中的字节内容为一个文件(后端自己生成的文件走这个入口,如打印出的 PDF)。 *

* 不经过 HTTP 上传,因此不产生「上传者」概念;落盘与落库规则与 {@link #upload} 一致。 * * @param content 文件内容,不能为空 * @param originalFileName 原始文件名(下载时展示) * @param contentType 资源类型,如 application/pdf * @param isPublic 是否公共文件(true=永久有效,false=临时token控制) * @return 上传结果(含预览/下载地址) */ SystemStorageBlobRespVO saveBlob(byte[] content, String originalFileName, String contentType, Boolean isPublic); /** * 通过token获取文件 * * @param fileName 唯一文件名 * @param token JWT token * @return 文件对象 */ File getFileByToken(String fileName, String token); /** * 通过publicKey获取公共文件 * * @param fileName 唯一文件名 * @param publicKey 公共访问key * @return 文件对象 */ File getPublicFile(String fileName, String publicKey); /** * 获取下载时的原始文件名 * * @param fileName 唯一文件名 * @return 原始文件名 */ String getDownloadFileName(String fileName); /** * 获得文件 * * @param id 编号 * @return 文件 */ SystemStorageBlobDO getStorageBlob(Long id); /** * 批量删除文件 * * @param ids 编号列表 */ void deleteStorageBlobs(List ids); }