namespace Admin.NET.Plugin.AiDOP.Entity.S8; /// /// R6 规则检测日志:每次规则检测的审计落库(CREATED / REFRESHED / RECOVERED / NO_HIT / EVALUATE_FAILED)。 /// 不做唯一索引、不做外键,写入失败必须不阻断主检测链。 /// [SugarTable("ado_s8_detection_log", "S8 规则检测日志")] [SugarIndex("idx_s8_detection_log_rule_time", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(RuleCode), OrderByType.Asc, nameof(DetectedAt), OrderByType.Desc)] [SugarIndex("idx_s8_detection_log_dedup_time", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(DedupKey), OrderByType.Asc, nameof(DetectedAt), OrderByType.Desc)] [SugarIndex("idx_s8_detection_log_result_time", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(DetectResult), OrderByType.Asc, nameof(DetectedAt), OrderByType.Desc)] [SugarIndex("idx_s8_detection_log_exception", nameof(ExceptionId), OrderByType.Asc)] public class AdoS8DetectionLog { [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 = "factory_id", ColumnDataType = "bigint")] public long FactoryId { get; set; } [SugarColumn(ColumnName = "created_at")] public DateTime CreatedAt { get; set; } = DateTime.Now; [SugarColumn(ColumnName = "updated_at", IsNullable = true)] public DateTime? UpdatedAt { get; set; } [SugarColumn(ColumnName = "is_deleted", ColumnDataType = "boolean")] public bool IsDeleted { get; set; } [SugarColumn(ColumnName = "rule_id", ColumnDataType = "bigint", IsNullable = true)] public long? RuleId { get; set; } [SugarColumn(ColumnName = "rule_code", Length = 64, IsNullable = true)] public string? RuleCode { get; set; } [SugarColumn(ColumnName = "rule_type", Length = 32, IsNullable = true)] public string? RuleType { get; set; } [SugarColumn(ColumnName = "scene_code", Length = 64, IsNullable = true)] public string? SceneCode { get; set; } [SugarColumn(ColumnName = "source_object_type", Length = 64, IsNullable = true)] public string? SourceObjectType { get; set; } [SugarColumn(ColumnName = "source_object_id", Length = 128, IsNullable = true)] public string? SourceObjectId { get; set; } [SugarColumn(ColumnName = "related_object_code", Length = 128, IsNullable = true)] public string? RelatedObjectCode { get; set; } [SugarColumn(ColumnName = "dedup_key", Length = 256, IsNullable = true)] public string? DedupKey { get; set; } /// HIT / CREATED / DUPLICATE / REFRESHED / RECOVERED / NO_HIT / EVALUATE_FAILED / SKIPPED。 [SugarColumn(ColumnName = "detect_result", Length = 32)] public string DetectResult { get; set; } = string.Empty; [SugarColumn(ColumnName = "exception_id", ColumnDataType = "bigint", IsNullable = true)] public long? ExceptionId { get; set; } [SugarColumn(ColumnName = "detected_at")] public DateTime DetectedAt { get; set; } = DateTime.Now; [SugarColumn(ColumnName = "payload_snapshot", ColumnDataType = "mediumtext", IsNullable = true)] public string? PayloadSnapshot { get; set; } [SugarColumn(ColumnName = "failure_reason", Length = 128, IsNullable = true)] public string? FailureReason { get; set; } [SugarColumn(ColumnName = "failure_message", Length = 1000, IsNullable = true)] public string? FailureMessage { get; set; } [SugarColumn(ColumnName = "run_id", Length = 64, IsNullable = true)] public string? RunId { get; set; } [SugarColumn(ColumnName = "trigger_source", Length = 32, IsNullable = true)] public string? TriggerSource { get; set; } [SugarColumn(ColumnName = "remark", Length = 500, IsNullable = true)] public string? Remark { get; set; } }