完善系统参数配置和数据字典管理模块
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace Model.Entity.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据字典项表(某分类下的具体枚举值)
|
||||
/// </summary>
|
||||
[SugarTable("sys_dict_item")]
|
||||
public class DictItemEntity : BaseEntity
|
||||
{
|
||||
[SugarColumn(ColumnName = "TypeId", ColumnDescription = "所属字典分类Id")]
|
||||
public long TypeId { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "Code", ColumnDescription = "字典项编码", Length = 64, IsNullable = false)]
|
||||
public string Code { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "Name", ColumnDescription = "字典项文本", Length = 100, IsNullable = false)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "Sort", ColumnDescription = "排序号", DefaultValue = "0")]
|
||||
public int Sort { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "Status", ColumnDescription = "状态(1=启用,0=停用)", ColumnDataType = "smallint", DefaultValue = "1")]
|
||||
public byte Status { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "IsDefault", ColumnDescription = "是否默认选中(同分类下唯一)", ColumnDataType = "smallint", DefaultValue = "0")]
|
||||
public byte IsDefault { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "Remark", ColumnDescription = "备注", Length = 500, IsNullable = true)]
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace Model.Entity.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据字典分类表(如:设备类型、故障类型、告警级别、工单优先级)
|
||||
/// </summary>
|
||||
[SugarTable("sys_dict_type")]
|
||||
public class DictTypeEntity : BaseEntity
|
||||
{
|
||||
[SugarColumn(ColumnName = "Code", ColumnDescription = "字典编码(唯一)", Length = 64, IsNullable = false)]
|
||||
public string Code { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "Name", ColumnDescription = "字典名称", Length = 100, IsNullable = false)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "Status", ColumnDescription = "状态(1=启用,0=停用)", ColumnDataType = "smallint", DefaultValue = "1")]
|
||||
public byte Status { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "Sort", ColumnDescription = "排序号", DefaultValue = "0")]
|
||||
public int Sort { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "Remark", ColumnDescription = "备注", Length = 500, IsNullable = true)]
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace Model.Entity.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件上传记录表(每次上传都登记:来源 Provider、业务类型、访问 URL)
|
||||
/// </summary>
|
||||
[SugarTable("sys_file_record")]
|
||||
public class FileRecordEntity : BaseEntity
|
||||
{
|
||||
/// <summary>存储后的文件名(含相对路径,如 2026/09/18/snowflake.jpg)</summary>
|
||||
[SugarColumn(ColumnName = "FileName", ColumnDescription = "存储文件名(含相对路径)", Length = 255, IsNullable = false)]
|
||||
public string FileName { get; set; }
|
||||
|
||||
/// <summary>原始文件名(用户上传时的文件名)</summary>
|
||||
[SugarColumn(ColumnName = "OriginalName", ColumnDescription = "原始文件名", Length = 255, IsNullable = true)]
|
||||
public string? OriginalName { get; set; }
|
||||
|
||||
/// <summary>访问 URL(Endpoint + 相对路径)</summary>
|
||||
[SugarColumn(ColumnName = "Url", ColumnDescription = "访问URL", Length = 500, IsNullable = true)]
|
||||
public string? Url { get; set; }
|
||||
|
||||
/// <summary>文件大小(字节)</summary>
|
||||
[SugarColumn(ColumnName = "Size", ColumnDescription = "文件大小(字节)")]
|
||||
public long Size { get; set; }
|
||||
|
||||
/// <summary>扩展名(含点,如 .jpg)</summary>
|
||||
[SugarColumn(ColumnName = "Ext", ColumnDescription = "扩展名", Length = 20, IsNullable = true)]
|
||||
public string? Ext { get; set; }
|
||||
|
||||
/// <summary>使用的存储 Provider(冗余,便于排查)</summary>
|
||||
[SugarColumn(ColumnName = "Provider", ColumnDescription = "存储Provider", Length = 20, IsNullable = true)]
|
||||
public string? Provider { get; set; }
|
||||
|
||||
/// <summary>使用的存储配置Id(关联 sys_file_storage.Id)</summary>
|
||||
public long StorageId { get; set; }
|
||||
|
||||
/// <summary>上传人</summary>
|
||||
[SugarColumn(ColumnName = "Uploader", ColumnDescription = "上传人", Length = 50, IsNullable = true)]
|
||||
public string? Uploader { get; set; }
|
||||
|
||||
/// <summary>业务类型(equipment_attachment/qrcode/generic 等,便于按业务查询)</summary>
|
||||
[SugarColumn(ColumnName = "BizType", ColumnDescription = "业务类型", Length = 50, IsNullable = true)]
|
||||
public string? BizType { get; set; }
|
||||
|
||||
/// <summary>业务Id(关联业务实体的 Id,可空)</summary>
|
||||
[SugarColumn(ColumnName = "BizId", ColumnDescription = "业务Id", Length = 64, IsNullable = true)]
|
||||
public string? BizId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
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>存储 Provider(local/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 或 /uploads;MinIO 为 http://minio:9000)</summary>
|
||||
[SugarColumn(ColumnName = "Endpoint", ColumnDescription = "访问端点", Length = 255, IsNullable = true)]
|
||||
public string? Endpoint { get; set; }
|
||||
|
||||
/// <summary>访问 Key(Local 为空;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/uploads;MinIO/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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace Model.Entity.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统参数配置表(键值对形式存储业务可调参数,按 Group 分组展示)
|
||||
/// 内置参数(IsSystem=1)禁止删除,仅允许修改 Value
|
||||
/// </summary>
|
||||
[SugarTable("sys_param")]
|
||||
public class SystemParamEntity : BaseEntity
|
||||
{
|
||||
/// <summary>参数键(唯一,业务侧按 Key 取值,如 data_collect_default_frequency)</summary>
|
||||
[SugarColumn(ColumnName = "ParamKey", ColumnDescription = "参数键(唯一)", Length = 64, IsNullable = false)]
|
||||
public string ParamKey { get; set; }
|
||||
|
||||
/// <summary>参数名称(中文展示名)</summary>
|
||||
[SugarColumn(ColumnName = "ParamName", ColumnDescription = "参数名称", Length = 100, IsNullable = false)]
|
||||
public string ParamName { get; set; }
|
||||
|
||||
/// <summary>参数值(统一字符串存储,业务侧按 ParamType 自行转换)</summary>
|
||||
[SugarColumn(ColumnName = "ParamValue", ColumnDescription = "参数值", ColumnDataType = "text", IsNullable = true)]
|
||||
public string? ParamValue { get; set; }
|
||||
|
||||
/// <summary>值类型(0=int, 1=text, 2=enum, 3=json)决定前端渲染控件</summary>
|
||||
[SugarColumn(ColumnName = "ParamType", ColumnDescription = "值类型(0=int,1=text,2=enum,3=json)", ColumnDataType = "smallint", DefaultValue = "1")]
|
||||
public byte ParamType { get; set; }
|
||||
|
||||
/// <summary>枚举选项(JSON 数组,如 [{"value":"feishu","label":"飞书"}];仅 ParamType=enum 使用)</summary>
|
||||
[SugarColumn(ColumnName = "ParamOptions", ColumnDescription = "枚举选项(JSON数组)", ColumnDataType = "text", IsNullable = true)]
|
||||
public string? ParamOptions { get; set; }
|
||||
|
||||
/// <summary>单位(如 秒/MB,前端展示用)</summary>
|
||||
[SugarColumn(ColumnName = "Unit", ColumnDescription = "单位", Length = 20, IsNullable = true)]
|
||||
public string? Unit { get; set; }
|
||||
|
||||
/// <summary>分组(如 数据采集/告警/工单/文件,前端按分组卡片展示)</summary>
|
||||
[SugarColumn(ColumnName = "Group", ColumnDescription = "分组", Length = 50, IsNullable = true)]
|
||||
public string? Group { get; set; }
|
||||
|
||||
/// <summary>排序号</summary>
|
||||
[SugarColumn(ColumnName = "Sort", ColumnDescription = "排序号", DefaultValue = "0")]
|
||||
public int Sort { get; set; }
|
||||
|
||||
/// <summary>备注(注释提示,如工单编号规则占位符说明)</summary>
|
||||
[SugarColumn(ColumnName = "Remark", ColumnDescription = "备注", Length = 500, IsNullable = true)]
|
||||
public string? Remark { get; set; }
|
||||
|
||||
/// <summary>是否系统内置(1=内置不可删,0=用户自定义)</summary>
|
||||
[SugarColumn(ColumnName = "IsSystem", ColumnDescription = "是否系统内置(1=不可删,0=可删)", ColumnDataType = "smallint", DefaultValue = "0")]
|
||||
public byte IsSystem { get; set; }
|
||||
|
||||
/// <summary>最后修改人</summary>
|
||||
[SugarColumn(ColumnName = "LastUpdateUser", ColumnDescription = "最后修改人", Length = 50, IsNullable = true)]
|
||||
public string? LastUpdateUser { get; set; }
|
||||
|
||||
/// <summary>最后修改时间</summary>
|
||||
[SugarColumn(ColumnName = "LastUpdateTime", ColumnDescription = "最后修改时间", IsNullable = true)]
|
||||
public DateTime? LastUpdateTime { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user