| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using Admin.NET.Core;
- using SqlSugar;
- namespace Admin.NET.Plugin.AiDOP.Entity;
- /// <summary>
- /// KPI 计算 SQL 执行运行日志(单 KPI 粒度,含配置版本 + SQL 指纹 + 分子分母)。
- /// mdp_transform_run_log 是批次级、表达不了 per-KPI + config version,故独立此表。
- /// 只记 SqlHash + ConfigId,不落 SQL 明文(SQL 原文在受权限控制的配置表)。
- /// </summary>
- [SugarTable("ado_smart_ops_kpi_calc_run_log", "KPI 计算 SQL 运行日志")]
- [SugarIndex("uk_kpi_calc_run_metric_batch", nameof(MetricCode), OrderByType.Asc, nameof(BatchId), OrderByType.Asc, true)]
- [SugarIndex("idx_kpi_calc_run_metric_time", nameof(MetricCode), OrderByType.Asc, nameof(StartedAt), OrderByType.Desc, false)]
- public class AdoSmartOpsKpiCalcRunLog : ITenantIdFilter
- {
- [SugarColumn(ColumnDescription = "主键", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
- public long Id { get; set; }
- [SugarColumn(ColumnDescription = "租户 ID", ColumnDataType = "bigint", IsNullable = true)]
- public long? TenantId { get; set; }
- [SugarColumn(ColumnDescription = "批次 ID(关联 mdp_transform_run_log.batch_id)", Length = 100)]
- public string BatchId { get; set; } = string.Empty;
- [SugarColumn(ColumnDescription = "模块 S1~S9", Length = 20)]
- public string ModuleCode { get; set; } = string.Empty;
- [SugarColumn(ColumnDescription = "指标编码", Length = 50)]
- public string MetricCode { get; set; } = string.Empty;
- [SugarColumn(ColumnDescription = "计算配置 ID(LEGACY 无配置时可空)", ColumnDataType = "bigint", IsNullable = true)]
- public long? ConfigId { get; set; }
- [SugarColumn(ColumnDescription = "配置版本号", IsNullable = true)]
- public int? VersionNo { get; set; }
- [SugarColumn(ColumnDescription = "引擎 LEGACY_CODE / CONFIG_SQL / LEGACY_TVF", Length = 20)]
- public string EngineType { get; set; } = string.Empty;
- [SugarColumn(ColumnDescription = "数据源编码", Length = 100, IsNullable = true)]
- public string? DataSourceCode { get; set; }
- [SugarColumn(ColumnDescription = "业务日期", ColumnDataType = "date")]
- public DateTime BizDate { get; set; }
- [SugarColumn(ColumnDescription = "开始时间")]
- public DateTime StartedAt { get; set; }
- [SugarColumn(ColumnDescription = "结束时间", IsNullable = true)]
- public DateTime? FinishedAt { get; set; }
- [SugarColumn(ColumnDescription = "耗时毫秒")]
- public long DurationMs { get; set; }
- [SugarColumn(ColumnDescription = "状态 SUCCESS / NO_DATA / FAILED", Length = 20)]
- public string Status { get; set; } = string.Empty;
- [SugarColumn(ColumnDescription = "返回行数")]
- public int RowCount { get; set; }
- [SugarColumn(ColumnDescription = "指标值", ColumnDataType = "decimal(18,4)", IsNullable = true)]
- public decimal? MetricValue { get; set; }
- [SugarColumn(ColumnDescription = "分子", ColumnDataType = "decimal(18,4)", IsNullable = true)]
- public decimal? NumeratorValue { get; set; }
- [SugarColumn(ColumnDescription = "分母", ColumnDataType = "decimal(18,4)", IsNullable = true)]
- public decimal? DenominatorValue { get; set; }
- [SugarColumn(ColumnDescription = "错误码", Length = 50, IsNullable = true)]
- public string? ErrorCode { get; set; }
- [SugarColumn(ColumnDescription = "错误摘要", Length = 500, IsNullable = true)]
- public string? ErrorMessage { get; set; }
- [SugarColumn(ColumnDescription = "SQL 指纹 SHA256(不落明文)", Length = 64, IsNullable = true)]
- public string? SqlHash { get; set; }
- [SugarColumn(ColumnDescription = "参数快照 JSON", ColumnDataType = "text", IsNullable = true)]
- public string? ParameterSnapshot { get; set; }
- [SugarColumn(ColumnDescription = "触发类型 AUTO / MANUAL / PREVIEW", Length = 20)]
- public string TriggerType { get; set; } = string.Empty;
- [SugarColumn(ColumnDescription = "创建时间")]
- public DateTime CreateTime { get; set; }
- }
|