AdoSmartOpsKpiCalcConfig.cs 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using Admin.NET.Core;
  2. using SqlSugar;
  3. namespace Admin.NET.Plugin.AiDOP.Entity;
  4. /// <summary>
  5. /// KPI 计算配置(SQL 配置化引擎)。一 KPI 多版本,含发布状态机与审计。
  6. /// 独立于 ado_smart_ops_kpi_master(看板热路径),SQL 敏感配置单独承载。
  7. /// 同一 (TenantId, MetricCode) 仅一个 IsCurrent=1 的生效版本,由服务层事务保证。
  8. /// </summary>
  9. [SugarTable("ado_smart_ops_kpi_calc_config", "KPI 计算配置(SQL 配置化)")]
  10. [SugarIndex("uk_kpi_calc_cfg_metric_ver", nameof(MetricCode), OrderByType.Asc, nameof(TenantId), OrderByType.Asc, nameof(VersionNo), OrderByType.Asc, true)]
  11. public class AdoSmartOpsKpiCalcConfig : ITenantIdFilter
  12. {
  13. [SugarColumn(ColumnDescription = "主键", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
  14. public long Id { get; set; }
  15. [SugarColumn(ColumnDescription = "租户 ID", ColumnDataType = "bigint", IsNullable = true)]
  16. public long? TenantId { get; set; }
  17. [SugarColumn(ColumnDescription = "指标编码 如 S5_L1_001", Length = 50)]
  18. public string MetricCode { get; set; } = string.Empty;
  19. [SugarColumn(ColumnDescription = "模块 S1~S9", Length = 20)]
  20. public string ModuleCode { get; set; } = string.Empty;
  21. [SugarColumn(ColumnDescription = "版本号(同 KPI 内递增)")]
  22. public int VersionNo { get; set; }
  23. [SugarColumn(ColumnDescription = "计算引擎 LEGACY_CODE / CONFIG_SQL / LEGACY_TVF", Length = 20)]
  24. public string CalcEngineType { get; set; } = "CONFIG_SQL";
  25. [SugarColumn(ColumnDescription = "数据源编码(已登记数据源,禁连接串)", Length = 100, IsNullable = true)]
  26. public string? DataSourceCode { get; set; }
  27. [SugarColumn(ColumnDescription = "只读 SQL 脚本", ColumnDataType = "text", IsNullable = true)]
  28. public string? SqlScript { get; set; }
  29. [SugarColumn(ColumnDescription = "参数声明 JSON(元数据,运行绑定由引擎注入)", ColumnDataType = "text", IsNullable = true)]
  30. public string? SqlParametersJson { get; set; }
  31. [SugarColumn(ColumnDescription = "查询超时(秒),受系统上限约束")]
  32. public int TimeoutSeconds { get; set; } = 30;
  33. [SugarColumn(ColumnDescription = "发布状态 DRAFT / PUBLISHED / RETIRED", Length = 20)]
  34. public string PublishStatus { get; set; } = "DRAFT";
  35. [SugarColumn(ColumnDescription = "是否当前生效版本(同 KPI 唯一)")]
  36. public bool IsCurrent { get; set; }
  37. [SugarColumn(ColumnDescription = "备注", ColumnDataType = "text", IsNullable = true)]
  38. public string? Remark { get; set; }
  39. [SugarColumn(ColumnDescription = "创建人", Length = 100, IsNullable = true)]
  40. public string? CreatedBy { get; set; }
  41. [SugarColumn(ColumnDescription = "创建时间")]
  42. public DateTime CreatedAt { get; set; }
  43. [SugarColumn(ColumnDescription = "更新人", Length = 100, IsNullable = true)]
  44. public string? UpdatedBy { get; set; }
  45. [SugarColumn(ColumnDescription = "更新时间", IsNullable = true)]
  46. public DateTime? UpdatedAt { get; set; }
  47. [SugarColumn(ColumnDescription = "发布人", Length = 100, IsNullable = true)]
  48. public string? PublishedBy { get; set; }
  49. [SugarColumn(ColumnDescription = "发布时间", IsNullable = true)]
  50. public DateTime? PublishedAt { get; set; }
  51. [SugarColumn(ColumnDescription = "停用人", Length = 100, IsNullable = true)]
  52. public string? RetiredBy { get; set; }
  53. [SugarColumn(ColumnDescription = "停用时间", IsNullable = true)]
  54. public DateTime? RetiredAt { get; set; }
  55. }