Files
IOT_API/Model/Entity/System/FileStorageConfigEntity.cs
T

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