完善系统参数配置和数据字典管理模块
This commit is contained in:
@@ -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