using SqlSugar; namespace Model.Entity.System { /// /// 文件存储配置表(多 Provider 配置:Local/MinIO/OSS,仅 Local 落地,其它留扩展点) /// 一个 IsDefault=1 的配置为默认上传通道;AccessKey/SecretKey 对 Local 为空 /// [SugarTable("sys_file_storage")] public class FileStorageConfigEntity : BaseEntity { /// 存储 Provider(local/minio/oss) [SugarColumn(ColumnName = "Provider", ColumnDescription = "存储Provider(local/minio/oss)", Length = 20, IsNullable = false)] public string Provider { get; set; } /// 配置名称(如:本地存储 / MinIO测试) [SugarColumn(ColumnName = "Name", ColumnDescription = "配置名称", Length = 100, IsNullable = false)] public string Name { get; set; } /// 访问端点(Local 为 URL 前缀如 http://host/uploads 或 /uploads;MinIO 为 http://minio:9000) [SugarColumn(ColumnName = "Endpoint", ColumnDescription = "访问端点", Length = 255, IsNullable = true)] public string? Endpoint { get; set; } /// 访问 Key(Local 为空;MinIO/OSS 为 AccessKey。注:当前明文存储,接入 MinIO/OSS 时应改为 AES 加密) [SugarColumn(ColumnName = "AccessKey", ColumnDescription = "AccessKey(Local为空)", Length = 128, IsNullable = true)] public string? AccessKey { get; set; } /// 密钥(Local 为空;MinIO/OSS 为 SecretKey。注:当前明文存储,接入 MinIO/OSS 时应改为 AES 加密) [SugarColumn(ColumnName = "SecretKey", ColumnDescription = "SecretKey(Local为空)", Length = 255, IsNullable = true)] public string? SecretKey { get; set; } /// 桶名(Local 为 BasePath 下子目录;MinIO/OSS 为 bucket 名) [SugarColumn(ColumnName = "Bucket", ColumnDescription = "桶名", Length = 100, IsNullable = true)] public string? Bucket { get; set; } /// 区域(OSS 用,Local/MinIO 为空) [SugarColumn(ColumnName = "Region", ColumnDescription = "区域(OSS用)", Length = 50, IsNullable = true)] public string? Region { get; set; } /// 本地存储根路径(Local 专用,如 wwwroot/uploads;MinIO/OSS 为空) [SugarColumn(ColumnName = "BasePath", ColumnDescription = "本地存储根路径(Local专用)", Length = 255, IsNullable = true)] public string? BasePath { get; set; } /// 单个文件大小上限(MB) [SugarColumn(ColumnName = "MaxSizeMB", ColumnDescription = "单个文件大小上限(MB)", DefaultValue = "10")] public int MaxSizeMB { get; set; } = 10; /// 允许的扩展名(JSON 数组,如 [".jpg",".png"];为空表示不限制) [SugarColumn(ColumnName = "AllowedExts", ColumnDescription = "允许扩展名(JSON数组)", ColumnDataType = "text", IsNullable = true)] public string? AllowedExts { get; set; } /// 是否默认(1=默认上传通道,全局唯一) [SugarColumn(ColumnName = "IsDefault", ColumnDescription = "是否默认(1=默认,0=否)", ColumnDataType = "smallint", DefaultValue = "0")] public byte IsDefault { get; set; } /// 状态(1=启用,0=停用) [SugarColumn(ColumnName = "Status", ColumnDescription = "状态(1=启用,0=停用)", ColumnDataType = "smallint", DefaultValue = "1")] public byte Status { get; set; } = 1; /// 备注 [SugarColumn(ColumnName = "Remark", ColumnDescription = "备注", Length = 500, IsNullable = true)] public string? Remark { get; set; } } }