namespace Admin.NET.Plugin.AiDOP.Entity.S8; /// /// S8-NOTIFY-RECIPIENT-1:「某条规则的某个事件发生时,通知谁」。 /// /// 身份是 (tenant_id, rule_code, event_code, recipient_type)。 /// rule_code = '*' 表示租户级默认,用于没有来源规则的异常(人工提报); /// 用显式哨兵而不是 NULL,是因为 NULL 在唯一索引里的比较语义会让人配出两条"默认" /// 而互不冲突。 /// /// 取代旧的 ado_s8_notification_layer 成为 CURRENT AUTHORITY。 /// 旧表按 (scene_code, severity, level_code) 组织,其中 level_code 的 /// L1/L2/L3 三档在库里只有 L1 被真正用过,且「主管 / 总监」在系统中没有对应实体; /// 更关键的是它不按规则,无法回答「这条规则出事通知谁」。 /// 旧表降级为 fallback:仅当本表对该 (租户, 规则, 事件) 没有任何配置时才使用, /// 且在页面上标注 LEGACY。优先级单一、可解释,不是两个平级 authority。 /// [SugarTable("ado_s8_notification_recipient", "S8 通知收件人配置")] [SugarIndex("uk_s8_notify_recipient", nameof(TenantId), OrderByType.Asc, nameof(RuleCode), OrderByType.Asc, nameof(EventCode), OrderByType.Asc, nameof(RecipientType), OrderByType.Asc, IsUnique = true)] public class AdoS8NotificationRecipient { [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")] public long Id { get; set; } /// 租户。唯一安全边界;工厂不参与。 [SugarColumn(ColumnName = "tenant_id", ColumnDataType = "bigint")] public long TenantId { get; set; } /// 规则编码;'*' = 租户级默认(无来源规则的异常走这一条)。 [SugarColumn(ColumnName = "rule_code", Length = 128)] public string RuleCode { get; set; } = string.Empty; /// 事件码,取值须在 S8NotificationCatalog.Events 内。 [SugarColumn(ColumnName = "event_code", Length = 64)] public string EventCode { get; set; } = string.Empty; /// 收件人类型,取值须在 S8NotificationCatalog.RecipientTypes 内。 [SugarColumn(ColumnName = "recipient_type", Length = 32)] public string RecipientType { get; set; } = string.Empty; /// /// 仅 SPECIFIC_USER 使用:逗号分隔的 SysUser.Id。 /// 其余类型为空 —— 它们的人选在派发那一刻由上下文解析,不预存。 /// [SugarColumn(ColumnName = "recipient_user_ids", Length = 2000, IsNullable = true)] public string? RecipientUserIds { get; set; } [SugarColumn(ColumnName = "created_at")] public DateTime CreatedAt { get; set; } = DateTime.Now; [SugarColumn(ColumnName = "created_by", Length = 64, IsNullable = true)] public string? CreatedBy { get; set; } }