AdoS8DetectionLog.cs 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. namespace Admin.NET.Plugin.AiDOP.Entity.S8;
  2. /// <summary>
  3. /// R6 规则检测日志:每次规则检测的审计落库(CREATED / REFRESHED / RECOVERED / NO_HIT / EVALUATE_FAILED)。
  4. /// 不做唯一索引、不做外键,写入失败必须不阻断主检测链。
  5. /// </summary>
  6. [SugarTable("ado_s8_detection_log", "S8 规则检测日志")]
  7. [SugarIndex("idx_s8_detection_log_rule_time", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(RuleCode), OrderByType.Asc, nameof(DetectedAt), OrderByType.Desc)]
  8. [SugarIndex("idx_s8_detection_log_dedup_time", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(DedupKey), OrderByType.Asc, nameof(DetectedAt), OrderByType.Desc)]
  9. [SugarIndex("idx_s8_detection_log_result_time", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(DetectResult), OrderByType.Asc, nameof(DetectedAt), OrderByType.Desc)]
  10. [SugarIndex("idx_s8_detection_log_exception", nameof(ExceptionId), OrderByType.Asc)]
  11. public class AdoS8DetectionLog
  12. {
  13. [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
  14. public long Id { get; set; }
  15. [SugarColumn(ColumnName = "tenant_id", ColumnDataType = "bigint")]
  16. public long TenantId { get; set; }
  17. [SugarColumn(ColumnName = "factory_id", ColumnDataType = "bigint")]
  18. public long FactoryId { get; set; }
  19. [SugarColumn(ColumnName = "created_at")]
  20. public DateTime CreatedAt { get; set; } = DateTime.Now;
  21. [SugarColumn(ColumnName = "updated_at", IsNullable = true)]
  22. public DateTime? UpdatedAt { get; set; }
  23. [SugarColumn(ColumnName = "is_deleted", ColumnDataType = "boolean")]
  24. public bool IsDeleted { get; set; }
  25. [SugarColumn(ColumnName = "rule_id", ColumnDataType = "bigint", IsNullable = true)]
  26. public long? RuleId { get; set; }
  27. [SugarColumn(ColumnName = "rule_code", Length = 64, IsNullable = true)]
  28. public string? RuleCode { get; set; }
  29. [SugarColumn(ColumnName = "rule_type", Length = 32, IsNullable = true)]
  30. public string? RuleType { get; set; }
  31. [SugarColumn(ColumnName = "scene_code", Length = 64, IsNullable = true)]
  32. public string? SceneCode { get; set; }
  33. [SugarColumn(ColumnName = "source_object_type", Length = 64, IsNullable = true)]
  34. public string? SourceObjectType { get; set; }
  35. [SugarColumn(ColumnName = "source_object_id", Length = 128, IsNullable = true)]
  36. public string? SourceObjectId { get; set; }
  37. [SugarColumn(ColumnName = "related_object_code", Length = 128, IsNullable = true)]
  38. public string? RelatedObjectCode { get; set; }
  39. [SugarColumn(ColumnName = "dedup_key", Length = 256, IsNullable = true)]
  40. public string? DedupKey { get; set; }
  41. /// <summary>HIT / CREATED / DUPLICATE / REFRESHED / RECOVERED / NO_HIT / EVALUATE_FAILED / SKIPPED。</summary>
  42. [SugarColumn(ColumnName = "detect_result", Length = 32)]
  43. public string DetectResult { get; set; } = string.Empty;
  44. [SugarColumn(ColumnName = "exception_id", ColumnDataType = "bigint", IsNullable = true)]
  45. public long? ExceptionId { get; set; }
  46. [SugarColumn(ColumnName = "detected_at")]
  47. public DateTime DetectedAt { get; set; } = DateTime.Now;
  48. [SugarColumn(ColumnName = "payload_snapshot", ColumnDataType = "mediumtext", IsNullable = true)]
  49. public string? PayloadSnapshot { get; set; }
  50. [SugarColumn(ColumnName = "failure_reason", Length = 128, IsNullable = true)]
  51. public string? FailureReason { get; set; }
  52. [SugarColumn(ColumnName = "failure_message", Length = 1000, IsNullable = true)]
  53. public string? FailureMessage { get; set; }
  54. [SugarColumn(ColumnName = "run_id", Length = 64, IsNullable = true)]
  55. public string? RunId { get; set; }
  56. [SugarColumn(ColumnName = "trigger_source", Length = 32, IsNullable = true)]
  57. public string? TriggerSource { get; set; }
  58. [SugarColumn(ColumnName = "remark", Length = 500, IsNullable = true)]
  59. public string? Remark { get; set; }
  60. }