AdoS8NotificationLayer.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. namespace Admin.NET.Plugin.AiDOP.Entity.S8;
  2. // S8-NOTIFY-RECIPIENT-1:本表自 1.0.500 起降级为 LEGACY fallback。
  3. // CURRENT AUTHORITY 是 ado_s8_notification_recipient(按 规则 + 事件 组织)。
  4. // 标记写在这里而不是只写进 migration —— CodeFirst 的 InitTables 会在启动时按实体描述
  5. // 回写表注释,迁移里的 ALTER ... COMMENT 会被它覆盖(本地实测:1.0.500 执行成功,
  6. // 但重启后注释仍是旧文案)。
  7. [SugarTable("ado_s8_notification_layer", "[LEGACY] S8 通知分层(CURRENT AUTHORITY = ado_s8_notification_recipient;仅在新表无配置时 fallback)")]
  8. public class AdoS8NotificationLayer
  9. {
  10. [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
  11. public long Id { get; set; }
  12. [SugarColumn(ColumnName = "tenant_id", ColumnDataType = "bigint")]
  13. public long TenantId { get; set; }
  14. [SugarColumn(ColumnName = "factory_id", ColumnDataType = "bigint")]
  15. public long FactoryId { get; set; }
  16. [SugarColumn(ColumnName = "scene_code", Length = 64)]
  17. public string SceneCode { get; set; } = string.Empty;
  18. /// <summary>S8 业务枚举 FOLLOW(关注)/ SERIOUS(严重)。</summary>
  19. [SugarColumn(ColumnName = "severity", Length = 32)]
  20. public string Severity { get; set; } = "FOLLOW";
  21. [SugarColumn(ColumnName = "level_code", Length = 32)]
  22. public string LevelCode { get; set; } = string.Empty;
  23. [SugarColumn(ColumnName = "target_role_ids", Length = 2000, IsNullable = true)]
  24. public string? TargetRoleIds { get; set; }
  25. [SugarColumn(ColumnName = "notify_channel", Length = 128, IsNullable = true)]
  26. public string? NotifyChannel { get; set; }
  27. [SugarColumn(ColumnName = "created_at")]
  28. public DateTime CreatedAt { get; set; } = DateTime.Now;
  29. [SugarColumn(ColumnName = "updated_at", IsNullable = true)]
  30. public DateTime? UpdatedAt { get; set; }
  31. /// <summary>
  32. /// S8-STEP6C-CFG-NOTIFY-CLOSURE-1:作用域标识(不落库)。
  33. /// GLOBAL = 平台默认 (0,0),租户侧只读;FACTORY = 当前工厂自有行。
  34. /// </summary>
  35. [SugarColumn(IsIgnore = true)]
  36. public string Scope => Admin.NET.Plugin.AiDOP.Infrastructure.S8ConfigScope.Resolve(TenantId, FactoryId);
  37. /// <summary>
  38. /// S8-STEP6C-CFG-NOTIFY-FIX-AND-CERT-1:本行所属 (scene_code, severity, level_code) 键是否存在平台默认行
  39. /// (不落库,由 ListAsync 赋值)。
  40. ///
  41. /// 含义与 exception_type / role_permission 等「逐行覆盖」对象**一致**:
  42. /// 「本工厂这一行覆盖了同键的平台默认行」。
  43. ///
  44. /// ⚠️ 修正记录:S8-STEP6C-CFG-NOTIFY-CLOSURE-1 版本下覆盖粒度曾是整个 (scene, severity) 键
  45. /// (resolver 精确命中该键即完全不读 (0,0)),本标记当时的含义是「本工厂一旦自建行就整键接管」。
  46. /// 该语义已被 S8NotificationLayerMerge 收敛为逐 level 覆盖,本注释同批修正。
  47. /// </summary>
  48. [SugarColumn(IsIgnore = true)]
  49. public bool HasGlobalDefault { get; set; }
  50. }