feat: 实现字典管理后端
This commit is contained in:
@@ -26,6 +26,11 @@ public sealed class CreateDictionaryGroupRequest
|
||||
[Required]
|
||||
public DictionaryScope Scope { get; set; } = DictionaryScope.Business;
|
||||
|
||||
/// <summary>
|
||||
/// 是否允许租户覆盖。
|
||||
/// </summary>
|
||||
public bool AllowOverride { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述信息。
|
||||
/// </summary>
|
||||
|
||||
@@ -19,14 +19,14 @@ public sealed class CreateDictionaryItemRequest
|
||||
/// <summary>
|
||||
/// 字典项键。
|
||||
/// </summary>
|
||||
[Required, MaxLength(64)]
|
||||
[Required, MaxLength(128)]
|
||||
public string Key { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 字典项值。
|
||||
/// </summary>
|
||||
[Required, MaxLength(256)]
|
||||
public string Value { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public Dictionary<string, string> Value { get; set; } = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// 是否默认项。
|
||||
|
||||
@@ -12,6 +12,36 @@ public sealed class DictionaryGroupQuery
|
||||
/// </summary>
|
||||
public DictionaryScope? Scope { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关键字(匹配编码或名称)。
|
||||
/// </summary>
|
||||
public string? Keyword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 启用状态过滤。
|
||||
/// </summary>
|
||||
public bool? IsEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分页页码。
|
||||
/// </summary>
|
||||
public int Page { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 分页大小。
|
||||
/// </summary>
|
||||
public int PageSize { get; set; } = 20;
|
||||
|
||||
/// <summary>
|
||||
/// 排序字段。
|
||||
/// </summary>
|
||||
public string? SortBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序方向(asc/desc)。
|
||||
/// </summary>
|
||||
public string? SortOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否包含字典项。
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using TakeoutSaaS.Domain.Dictionary.Enums;
|
||||
|
||||
namespace TakeoutSaaS.Application.Dictionary.Contracts;
|
||||
|
||||
/// <summary>
|
||||
/// 字典导入请求。
|
||||
/// </summary>
|
||||
public sealed class DictionaryImportRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 分组 ID。
|
||||
/// </summary>
|
||||
public long GroupId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件名称。
|
||||
/// </summary>
|
||||
public string FileName { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 文件大小(字节)。
|
||||
/// </summary>
|
||||
public long FileSize { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 冲突解决模式。
|
||||
/// </summary>
|
||||
public ConflictResolutionMode ConflictMode { get; init; } = ConflictResolutionMode.Skip;
|
||||
|
||||
/// <summary>
|
||||
/// 文件流。
|
||||
/// </summary>
|
||||
public Stream FileStream { get; init; } = Stream.Null;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace TakeoutSaaS.Application.Dictionary.Contracts;
|
||||
|
||||
/// <summary>
|
||||
/// 更新字典覆盖隐藏项请求。
|
||||
/// </summary>
|
||||
public sealed class DictionaryOverrideHiddenItemsRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 需要隐藏的系统字典项 ID 列表。
|
||||
/// </summary>
|
||||
[Required]
|
||||
public long[] HiddenItemIds { get; set; } = Array.Empty<long>();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace TakeoutSaaS.Application.Dictionary.Contracts;
|
||||
|
||||
/// <summary>
|
||||
/// 更新字典覆盖排序请求。
|
||||
/// </summary>
|
||||
public sealed class DictionaryOverrideSortOrderRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 排序配置(字典项 ID -> 排序值)。
|
||||
/// </summary>
|
||||
[Required]
|
||||
public Dictionary<long, int> SortOrder { get; set; } = new();
|
||||
}
|
||||
@@ -19,8 +19,18 @@ public sealed class UpdateDictionaryGroupRequest
|
||||
[MaxLength(512)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否允许租户覆盖。
|
||||
/// </summary>
|
||||
public bool AllowOverride { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用。
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 行版本,用于并发控制。
|
||||
/// </summary>
|
||||
public byte[]? RowVersion { get; set; }
|
||||
}
|
||||
|
||||
@@ -7,11 +7,17 @@ namespace TakeoutSaaS.Application.Dictionary.Contracts;
|
||||
/// </summary>
|
||||
public sealed class UpdateDictionaryItemRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 字典项键。
|
||||
/// </summary>
|
||||
[Required, MaxLength(128)]
|
||||
public string Key { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 字典项值。
|
||||
/// </summary>
|
||||
[Required, MaxLength(256)]
|
||||
public string Value { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public Dictionary<string, string> Value { get; set; } = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// 是否默认项。
|
||||
@@ -33,4 +39,9 @@ public sealed class UpdateDictionaryItemRequest
|
||||
/// </summary>
|
||||
[MaxLength(512)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 行版本,用于并发控制。
|
||||
/// </summary>
|
||||
public byte[]? RowVersion { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user