Files

51 lines
2.3 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Model;
using Model.Dto.System;
using SqlSugar;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace Service.Interface
{
/// <summary>
/// 文件存储管理 服务接口
/// 管理侧:存储配置 CRUD + 设默认 + 连接测试;上传侧:按默认配置上传,登记 sys_file_record
/// </summary>
public interface IFileStorageService
{
// ==================== 存储配置 ====================
/// <summary>分页查询存储配置(关键字匹配 Name/Provider</summary>
Task<Result<List<FileStorageConfigDto>>> GetListPagedAsync(int pageIndex, int pageSize, RefAsync<int> total, string? keyword = null);
/// <summary>存储配置详情</summary>
Task<Result<FileStorageConfigDto>> GetByIdAsync(long id);
/// <summary>新增存储配置(校验 Provider 支持范围;IsDefault=1 时清零其它默认)</summary>
Task<Result<FileStorageConfigDto>> AddAsync(FileStorageConfigDto dto);
/// <summary>修改存储配置(AccessKey/SecretKey 为掩码时保留原值)</summary>
Task<Result<FileStorageConfigDto>> UpdateAsync(FileStorageConfigDto dto);
/// <summary>删除存储配置(默认配置禁止删除)</summary>
Task<Result> DeleteAsync(long id);
/// <summary>设为默认(清零其它默认)</summary>
Task<Result> SetDefaultAsync(long id);
/// <summary>测试连接(按配置调用对应 Provider 的 TestConnectionAsync</summary>
Task<Result> TestAsync(long id);
// ==================== 文件上传/记录 ====================
/// <summary>上传文件(使用默认启用的存储配置;校验大小/扩展名;登记 sys_file_record</summary>
Task<Result<FileRecordDto>> UploadAsync(Stream stream, string originalName, long size, string? bizType = null, string? bizId = null, string? uploader = null);
/// <summary>文件记录分页查询(可按 BizType / 关键字过滤)</summary>
Task<Result<List<FileRecordDto>>> GetFileListPagedAsync(int pageIndex, int pageSize, RefAsync<int> total, string? keyword = null, string? bizType = null);
/// <summary>文件记录详情</summary>
Task<Result<FileRecordDto>> GetFileByIdAsync(long id);
}
}