完善系统参数配置和数据字典管理模块
This commit is contained in:
@@ -49,6 +49,12 @@ namespace Model.Dto.Asset
|
||||
/// <summary>二维码编号(一物一码)</summary>
|
||||
public string? QrCode { get; set; }
|
||||
|
||||
/// <summary>二维码扫码直达 URL(生成后写入,扫码跳转设备台账详情)</summary>
|
||||
public string? QrCodeUrl { get; set; }
|
||||
|
||||
/// <summary>RFID 编号(绑定时写入)</summary>
|
||||
public string? RfidCode { get; set; }
|
||||
|
||||
/// <summary>设备描述</summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
namespace Model.Dto.Asset
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备二维码信息(生成/列表/详情共用)
|
||||
/// </summary>
|
||||
public class QrCodeDto
|
||||
{
|
||||
/// <summary>设备 Id(long → string)</summary>
|
||||
public string EquipmentId { get; set; }
|
||||
/// <summary>设备编号</summary>
|
||||
public string? EquipmentCode { get; set; }
|
||||
/// <summary>设备名称</summary>
|
||||
public string? EquipmentName { get; set; }
|
||||
/// <summary>存放位置(打印标签用)</summary>
|
||||
public string? Location { get; set; }
|
||||
/// <summary>二维码编号(一物一码,人工可读)</summary>
|
||||
public string? QrCode { get; set; }
|
||||
/// <summary>扫码直达 URL(生成后写入;为空表示尚未生成)</summary>
|
||||
public string? QrCodeUrl { get; set; }
|
||||
/// <summary>RFID 编号(已绑定则有值)</summary>
|
||||
public string? RfidCode { get; set; }
|
||||
/// <summary>是否已生成二维码(QrCodeUrl 非空)</summary>
|
||||
public bool HasGenerated => !string.IsNullOrWhiteSpace(QrCodeUrl);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量生成结果
|
||||
/// </summary>
|
||||
public class QrCodeBatchResultDto
|
||||
{
|
||||
public string EquipmentId { get; set; }
|
||||
public string? EquipmentCode { get; set; }
|
||||
public string? EquipmentName { get; set; }
|
||||
public string? QrCodeUrl { get; set; }
|
||||
public bool Success { get; set; }
|
||||
public string? Message { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
namespace Model.Dto.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据字典分类 DTO
|
||||
/// </summary>
|
||||
public class DictTypeDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
public byte Status { get; set; }
|
||||
public int Sort { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public DateTime? CreateTime { get; set; }
|
||||
/// <summary>该分类下的字典项数量(列表展示用,由 Service 填充)</summary>
|
||||
public int ItemCount { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据字典项 DTO
|
||||
/// </summary>
|
||||
public class DictItemDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string TypeId { get; set; }
|
||||
public string Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int Sort { get; set; }
|
||||
public byte Status { get; set; }
|
||||
public byte IsDefault { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public DateTime? CreateTime { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字典项下拉选项(业务侧通过 typeCode 查询用:仅返回编码+文本+是否默认)
|
||||
/// </summary>
|
||||
public class DictOptionDto
|
||||
{
|
||||
public string Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
public bool IsDefault { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
namespace Model.Dto.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件存储配置 DTO
|
||||
/// </summary>
|
||||
public class FileStorageConfigDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Provider { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string? Endpoint { get; set; }
|
||||
/// <summary>回显时掩码(仅显示前后各 2 字符);写入时若为掩码样式则保留原值不变</summary>
|
||||
public string? AccessKey { get; set; }
|
||||
public string? SecretKey { get; set; }
|
||||
public string? Bucket { get; set; }
|
||||
public string? Region { get; set; }
|
||||
public string? BasePath { get; set; }
|
||||
public int MaxSizeMB { get; set; }
|
||||
public string? AllowedExts { get; set; }
|
||||
public byte IsDefault { get; set; }
|
||||
public byte Status { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public DateTime? CreateTime { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文件上传记录 DTO
|
||||
/// </summary>
|
||||
public class FileRecordDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string? OriginalName { get; set; }
|
||||
public string? Url { get; set; }
|
||||
public long Size { get; set; }
|
||||
public string? Ext { get; set; }
|
||||
public string? Provider { get; set; }
|
||||
public string StorageId { get; set; }
|
||||
public string? Uploader { get; set; }
|
||||
public string? BizType { get; set; }
|
||||
public string? BizId { get; set; }
|
||||
public DateTime? CreateTime { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传结果(Provider 返回,Service 写入 sys_file_record 时用)
|
||||
/// </summary>
|
||||
public class FileUploadResultDto
|
||||
{
|
||||
/// <summary>存储后的相对文件名(含路径,如 2026/09/18/snowflake.jpg)</summary>
|
||||
public string FileName { get; set; }
|
||||
/// <summary>访问 URL</summary>
|
||||
public string Url { get; set; }
|
||||
/// <summary>扩展名</summary>
|
||||
public string? Ext { get; set; }
|
||||
/// <summary>文件大小(字节)</summary>
|
||||
public long Size { get; set; }
|
||||
public string Provider { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
namespace Model.Dto.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统参数 DTO
|
||||
/// </summary>
|
||||
public class SystemParamDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string ParamKey { get; set; }
|
||||
public string ParamName { get; set; }
|
||||
public string? ParamValue { get; set; }
|
||||
/// <summary>值类型(0=int, 1=text, 2=enum, 3=json)</summary>
|
||||
public byte ParamType { get; set; }
|
||||
/// <summary>枚举选项(原始 JSON 字符串,由前端解析;仅 ParamType=enum 有值)</summary>
|
||||
public string? ParamOptions { get; set; }
|
||||
public string? Unit { get; set; }
|
||||
public string? Group { get; set; }
|
||||
public int Sort { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
/// <summary>是否系统内置(1=不可删,仅允许改 Value)</summary>
|
||||
public byte IsSystem { get; set; }
|
||||
public string? LastUpdateUser { get; set; }
|
||||
public DateTime? LastUpdateTime { get; set; }
|
||||
public DateTime? CreateTime { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 业务侧批量取值返回项
|
||||
/// </summary>
|
||||
public class SystemParamValueDto
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using SqlSugar;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Model.Entity.Asset
|
||||
{
|
||||
@@ -73,6 +73,19 @@ namespace Model.Entity.Asset
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? QrCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 二维码扫码直达 URL(生成二维码时写入,扫码后跳转设备台账详情)
|
||||
/// 形如 http://host/asset/ledger/equipment?id={Id};为空表示尚未生成二维码
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 500, IsNullable = true)]
|
||||
public string? QrCodeUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// RFID 编号(绑定时写入,用于 RFID 标签识别设备)
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 64, IsNullable = true)]
|
||||
public string? RfidCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备描述
|
||||
/// </summary>
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,8 @@ namespace Model.Mapper
|
||||
Supplier = entity.Supplier,
|
||||
ImageUrl = entity.ImageUrl,
|
||||
QrCode = entity.QrCode,
|
||||
QrCodeUrl = entity.QrCodeUrl,
|
||||
RfidCode = entity.RfidCode,
|
||||
Description = entity.Description,
|
||||
Department = entity.Department,
|
||||
Location = entity.Location,
|
||||
@@ -98,6 +100,8 @@ namespace Model.Mapper
|
||||
Supplier = dto.Supplier,
|
||||
ImageUrl = dto.ImageUrl,
|
||||
QrCode = dto.QrCode,
|
||||
QrCodeUrl = dto.QrCodeUrl,
|
||||
RfidCode = dto.RfidCode,
|
||||
Description = dto.Description,
|
||||
Department = dto.Department,
|
||||
Location = dto.Location,
|
||||
@@ -1242,5 +1246,205 @@ namespace Model.Mapper
|
||||
public static List<AuditLogDto> ToDtoList(this List<AuditLogEntity> entities)
|
||||
=> entities?.Select(e => e.ToDto()).ToList() ?? new List<AuditLogDto>();
|
||||
#endregion
|
||||
|
||||
#region 数据字典
|
||||
/// <summary>
|
||||
/// DictTypeEntity → DictTypeDto
|
||||
/// </summary>
|
||||
public static DictTypeDto ToDto(this DictTypeEntity entity)
|
||||
{
|
||||
if (entity == null) return null;
|
||||
return new DictTypeDto
|
||||
{
|
||||
Id = entity.Id.ToString(),
|
||||
Code = entity.Code,
|
||||
Name = entity.Name,
|
||||
Status = entity.Status,
|
||||
Sort = entity.Sort,
|
||||
Remark = entity.Remark,
|
||||
CreateTime = entity.CreateTime
|
||||
};
|
||||
}
|
||||
public static List<DictTypeDto> ToDtoList(this List<DictTypeEntity> entities)
|
||||
=> entities?.Select(e => e.ToDto()).ToList() ?? new List<DictTypeDto>();
|
||||
/// <summary>
|
||||
/// DictTypeDto → DictTypeEntity(入参映射,IsDel/CreateTime 不映射)
|
||||
/// </summary>
|
||||
public static DictTypeEntity ToEntity(this DictTypeDto dto)
|
||||
{
|
||||
if (dto == null) return null;
|
||||
return new DictTypeEntity
|
||||
{
|
||||
Id = ParseId(dto.Id),
|
||||
Code = dto.Code,
|
||||
Name = dto.Name,
|
||||
Status = dto.Status,
|
||||
Sort = dto.Sort,
|
||||
Remark = dto.Remark
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DictItemEntity → DictItemDto
|
||||
/// </summary>
|
||||
public static DictItemDto ToDto(this DictItemEntity entity)
|
||||
{
|
||||
if (entity == null) return null;
|
||||
return new DictItemDto
|
||||
{
|
||||
Id = entity.Id.ToString(),
|
||||
TypeId = entity.TypeId.ToString(),
|
||||
Code = entity.Code,
|
||||
Name = entity.Name,
|
||||
Sort = entity.Sort,
|
||||
Status = entity.Status,
|
||||
IsDefault = entity.IsDefault,
|
||||
Remark = entity.Remark,
|
||||
CreateTime = entity.CreateTime
|
||||
};
|
||||
}
|
||||
public static List<DictItemDto> ToDtoList(this List<DictItemEntity> entities)
|
||||
=> entities?.Select(e => e.ToDto()).ToList() ?? new List<DictItemDto>();
|
||||
/// <summary>
|
||||
/// DictItemDto → DictItemEntity(入参映射,CreateTime/IsDel 不映射;TypeId 由 Service 强制覆盖)
|
||||
/// </summary>
|
||||
public static DictItemEntity ToEntity(this DictItemDto dto)
|
||||
{
|
||||
if (dto == null) return null;
|
||||
return new DictItemEntity
|
||||
{
|
||||
Id = ParseId(dto.Id),
|
||||
TypeId = ParseId(dto.TypeId),
|
||||
Code = dto.Code,
|
||||
Name = dto.Name,
|
||||
Sort = dto.Sort,
|
||||
Status = dto.Status,
|
||||
IsDefault = dto.IsDefault,
|
||||
Remark = dto.Remark
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 系统参数
|
||||
/// <summary>
|
||||
/// SystemParamEntity → SystemParamDto
|
||||
/// </summary>
|
||||
public static SystemParamDto ToDto(this SystemParamEntity entity)
|
||||
{
|
||||
if (entity == null) return null;
|
||||
return new SystemParamDto
|
||||
{
|
||||
Id = entity.Id.ToString(),
|
||||
ParamKey = entity.ParamKey,
|
||||
ParamName = entity.ParamName,
|
||||
ParamValue = entity.ParamValue,
|
||||
ParamType = entity.ParamType,
|
||||
ParamOptions = entity.ParamOptions,
|
||||
Unit = entity.Unit,
|
||||
Group = entity.Group,
|
||||
Sort = entity.Sort,
|
||||
Remark = entity.Remark,
|
||||
IsSystem = entity.IsSystem,
|
||||
LastUpdateUser = entity.LastUpdateUser,
|
||||
LastUpdateTime = entity.LastUpdateTime,
|
||||
CreateTime = entity.CreateTime
|
||||
};
|
||||
}
|
||||
public static List<SystemParamDto> ToDtoList(this List<SystemParamEntity> entities)
|
||||
=> entities?.Select(e => e.ToDto()).ToList() ?? new List<SystemParamDto>();
|
||||
/// <summary>
|
||||
/// SystemParamDto → SystemParamEntity(入参映射,CreateTime/IsDel/LastUpdateUser/LastUpdateTime 不映射;由 Service 控管)
|
||||
/// </summary>
|
||||
public static SystemParamEntity ToEntity(this SystemParamDto dto)
|
||||
{
|
||||
if (dto == null) return null;
|
||||
return new SystemParamEntity
|
||||
{
|
||||
Id = ParseId(dto.Id),
|
||||
ParamKey = dto.ParamKey,
|
||||
ParamName = dto.ParamName,
|
||||
ParamValue = dto.ParamValue,
|
||||
ParamType = dto.ParamType,
|
||||
ParamOptions = dto.ParamOptions,
|
||||
Unit = dto.Unit,
|
||||
Group = dto.Group,
|
||||
Sort = dto.Sort,
|
||||
Remark = dto.Remark,
|
||||
IsSystem = dto.IsSystem
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 文件存储配置
|
||||
public static FileStorageConfigDto ToDto(this FileStorageConfigEntity entity)
|
||||
{
|
||||
if (entity == null) return null;
|
||||
return new FileStorageConfigDto
|
||||
{
|
||||
Id = entity.Id.ToString(),
|
||||
Provider = entity.Provider,
|
||||
Name = entity.Name,
|
||||
Endpoint = entity.Endpoint,
|
||||
AccessKey = entity.AccessKey,
|
||||
SecretKey = entity.SecretKey,
|
||||
Bucket = entity.Bucket,
|
||||
Region = entity.Region,
|
||||
BasePath = entity.BasePath,
|
||||
MaxSizeMB = entity.MaxSizeMB,
|
||||
AllowedExts = entity.AllowedExts,
|
||||
IsDefault = entity.IsDefault,
|
||||
Status = entity.Status,
|
||||
Remark = entity.Remark,
|
||||
CreateTime = entity.CreateTime
|
||||
};
|
||||
}
|
||||
public static List<FileStorageConfigDto> ToDtoList(this List<FileStorageConfigEntity> entities)
|
||||
=> entities?.Select(e => e.ToDto()).ToList() ?? new List<FileStorageConfigDto>();
|
||||
public static FileStorageConfigEntity ToEntity(this FileStorageConfigDto dto)
|
||||
{
|
||||
if (dto == null) return null;
|
||||
return new FileStorageConfigEntity
|
||||
{
|
||||
Id = ParseId(dto.Id),
|
||||
Provider = dto.Provider,
|
||||
Name = dto.Name,
|
||||
Endpoint = dto.Endpoint,
|
||||
AccessKey = dto.AccessKey,
|
||||
SecretKey = dto.SecretKey,
|
||||
Bucket = dto.Bucket,
|
||||
Region = dto.Region,
|
||||
BasePath = dto.BasePath,
|
||||
MaxSizeMB = dto.MaxSizeMB,
|
||||
AllowedExts = dto.AllowedExts,
|
||||
IsDefault = dto.IsDefault,
|
||||
Status = dto.Status,
|
||||
Remark = dto.Remark
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 文件上传记录
|
||||
public static FileRecordDto ToDto(this FileRecordEntity entity)
|
||||
{
|
||||
if (entity == null) return null;
|
||||
return new FileRecordDto
|
||||
{
|
||||
Id = entity.Id.ToString(),
|
||||
FileName = entity.FileName,
|
||||
OriginalName = entity.OriginalName,
|
||||
Url = entity.Url,
|
||||
Size = entity.Size,
|
||||
Ext = entity.Ext,
|
||||
Provider = entity.Provider,
|
||||
StorageId = entity.StorageId.ToString(),
|
||||
Uploader = entity.Uploader,
|
||||
BizType = entity.BizType,
|
||||
BizId = entity.BizId,
|
||||
CreateTime = entity.CreateTime
|
||||
};
|
||||
}
|
||||
public static List<FileRecordDto> ToDtoList(this List<FileRecordEntity> entities)
|
||||
=> entities?.Select(e => e.ToDto()).ToList() ?? new List<FileRecordDto>();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user