feat: 提交后端其余改动
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
using TakeoutSaaS.Domain.Dictionary.Enums;
|
||||
using TakeoutSaaS.Shared.Abstractions.Entities;
|
||||
|
||||
namespace TakeoutSaaS.Domain.Dictionary.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 字典标签覆盖配置。
|
||||
/// </summary>
|
||||
public sealed class DictionaryLabelOverride : EntityBase, IMultiTenantEntity, IAuditableEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 所属租户 ID(覆盖目标租户)。
|
||||
/// </summary>
|
||||
public long TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 被覆盖的字典项 ID。
|
||||
/// </summary>
|
||||
public long DictionaryItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 原始显示值(JSON 格式,多语言)。
|
||||
/// </summary>
|
||||
public string OriginalValue { get; set; } = "{}";
|
||||
|
||||
/// <summary>
|
||||
/// 覆盖后的显示值(JSON 格式,多语言)。
|
||||
/// </summary>
|
||||
public string OverrideValue { get; set; } = "{}";
|
||||
|
||||
/// <summary>
|
||||
/// 覆盖类型。
|
||||
/// </summary>
|
||||
public OverrideType OverrideType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 覆盖原因/备注。
|
||||
/// </summary>
|
||||
public string? Reason { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间(UTC)。
|
||||
/// </summary>
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最近更新时间(UTC)。
|
||||
/// </summary>
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除时间(UTC)。
|
||||
/// </summary>
|
||||
public DateTime? DeletedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人用户标识。
|
||||
/// </summary>
|
||||
public long? CreatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后更新人用户标识。
|
||||
/// </summary>
|
||||
public long? UpdatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除人用户标识。
|
||||
/// </summary>
|
||||
public long? DeletedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 导航属性:被覆盖的字典项。
|
||||
/// </summary>
|
||||
public DictionaryItem? DictionaryItem { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace TakeoutSaaS.Domain.Dictionary.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// 字典覆盖类型。
|
||||
/// </summary>
|
||||
public enum OverrideType
|
||||
{
|
||||
/// <summary>
|
||||
/// 租户定制:租户覆盖系统字典的显示值。
|
||||
/// </summary>
|
||||
TenantCustomization = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 平台强制:平台管理员强制修正租户字典的显示值。
|
||||
/// </summary>
|
||||
PlatformEnforcement = 2
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using TakeoutSaaS.Domain.Dictionary.Entities;
|
||||
using TakeoutSaaS.Domain.Dictionary.Enums;
|
||||
|
||||
namespace TakeoutSaaS.Domain.Dictionary.Repositories;
|
||||
|
||||
/// <summary>
|
||||
/// 字典标签覆盖仓储契约。
|
||||
/// </summary>
|
||||
public interface IDictionaryLabelOverrideRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据 ID 获取覆盖配置。
|
||||
/// </summary>
|
||||
Task<DictionaryLabelOverride?> GetByIdAsync(long id, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定字典项的覆盖配置。
|
||||
/// </summary>
|
||||
/// <param name="tenantId">租户 ID。</param>
|
||||
/// <param name="dictionaryItemId">字典项 ID。</param>
|
||||
/// <param name="cancellationToken">取消标记。</param>
|
||||
Task<DictionaryLabelOverride?> GetByItemIdAsync(long tenantId, long dictionaryItemId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 获取租户的所有覆盖配置。
|
||||
/// </summary>
|
||||
/// <param name="tenantId">租户 ID。</param>
|
||||
/// <param name="overrideType">可选的覆盖类型过滤。</param>
|
||||
/// <param name="cancellationToken">取消标记。</param>
|
||||
Task<IReadOnlyList<DictionaryLabelOverride>> ListByTenantAsync(
|
||||
long tenantId,
|
||||
OverrideType? overrideType = null,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 批量获取多个字典项的覆盖配置。
|
||||
/// </summary>
|
||||
/// <param name="tenantId">租户 ID。</param>
|
||||
/// <param name="dictionaryItemIds">字典项 ID 列表。</param>
|
||||
/// <param name="cancellationToken">取消标记。</param>
|
||||
Task<IReadOnlyList<DictionaryLabelOverride>> GetByItemIdsAsync(
|
||||
long tenantId,
|
||||
IEnumerable<long> dictionaryItemIds,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增覆盖配置。
|
||||
/// </summary>
|
||||
Task AddAsync(DictionaryLabelOverride entity, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 更新覆盖配置。
|
||||
/// </summary>
|
||||
Task UpdateAsync(DictionaryLabelOverride entity, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 删除覆盖配置。
|
||||
/// </summary>
|
||||
Task DeleteAsync(DictionaryLabelOverride entity, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 持久化更改。
|
||||
/// </summary>
|
||||
Task SaveChangesAsync(CancellationToken cancellationToken = default);
|
||||
}
|
||||
Reference in New Issue
Block a user