初始化
This commit is contained in:
49
_backup_20260613/FileService.java
Normal file
49
_backup_20260613/FileService.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package com.mokee.admin.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.mokee.common.entity.SysFile;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文件服务接口
|
||||
* <p>
|
||||
* 文件二进制数据存储于本地磁盘,数据库仅保存元信息。
|
||||
*
|
||||
* @author mokee
|
||||
*/
|
||||
public interface FileService {
|
||||
|
||||
/**
|
||||
* 上传文件 — 写入磁盘 + 存元信息到 DB
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @param fileType 文件类型
|
||||
* @param systemId 所属系统ID(可选)
|
||||
* @param userId 上传用户ID(可选,管理后台上传时传入)
|
||||
* @param uploadUserName 上传者显示名(用户姓名或系统名称)
|
||||
*/
|
||||
SysFile upload(MultipartFile file, String fileType, String systemId,
|
||||
String userId, String uploadUserName) throws IOException;
|
||||
|
||||
/** 分页查询(不含 file_data),支持 fileName/uploadUserName 模糊搜索 */
|
||||
IPage<SysFile> page(Integer page, Integer size, String fileType, String fileName, String uploadUserName, String systemId);
|
||||
|
||||
/** 列表查询(不含 file_data) */
|
||||
List<SysFile> list(String fileType, String systemId);
|
||||
|
||||
/** 查询完整记录(含 file_data 兜底,用于下载/预览) */
|
||||
SysFile getById(String id);
|
||||
|
||||
/** 查询元信息(不含 file_data) */
|
||||
SysFile getMetaById(String id);
|
||||
|
||||
/** 获取文件在磁盘上的存储路径 */
|
||||
Path getDiskPath(SysFile sf);
|
||||
|
||||
/** 删除文件 — 删磁盘文件 + DB 记录 */
|
||||
void delete(String id) throws IOException;
|
||||
}
|
||||
Reference in New Issue
Block a user