AdoSmartOpsKpiDimensionConfig.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using Admin.NET.Core;
  2. using SqlSugar;
  3. namespace Admin.NET.Plugin.AiDOP.Entity;
  4. /// <summary>
  5. /// KPI 维度计算配置(DIMENSION_SQL 配置化)。为筛选/下钻产生可按维度拆分的结果,
  6. /// 与当前生效的汇总配置(ado_smart_ops_kpi_calc_config)版本绑定。
  7. /// 独立于汇总配置模型,绝不改动 SUMMARY_SQL。
  8. /// 同一 (TenantId, MetricCode) 仅一个 IsCurrent=1 的生效维度版本,由服务层事务保证。
  9. /// </summary>
  10. [SugarTable("ado_smart_ops_kpi_dimension_config", "KPI 维度计算配置(DIMENSION_SQL 配置化)")]
  11. [SugarIndex("uk_kpi_dim_cfg_metric_sum_ver", nameof(MetricCode), OrderByType.Asc, nameof(TenantId), OrderByType.Asc, nameof(SummaryConfigId), OrderByType.Asc, nameof(DimensionConfigVersion), OrderByType.Asc, true)]
  12. public class AdoSmartOpsKpiDimensionConfig : ITenantIdFilter
  13. {
  14. [SugarColumn(ColumnDescription = "主键", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
  15. public long Id { get; set; }
  16. [SugarColumn(ColumnDescription = "租户 ID", ColumnDataType = "bigint", IsNullable = true)]
  17. public long? TenantId { get; set; }
  18. [SugarColumn(ColumnDescription = "指标编码 如 S7_L1_001", Length = 50)]
  19. public string MetricCode { get; set; } = string.Empty;
  20. [SugarColumn(ColumnDescription = "模块 S1~S9", Length = 20)]
  21. public string ModuleCode { get; set; } = string.Empty;
  22. [SugarColumn(ColumnDescription = "绑定的汇总配置 Id(ado_smart_ops_kpi_calc_config.Id)")]
  23. public long SummaryConfigId { get; set; }
  24. [SugarColumn(ColumnDescription = "绑定的汇总配置版本号")]
  25. public int SummaryConfigVersion { get; set; }
  26. [SugarColumn(ColumnDescription = "维度配置版本号(同 KPI+汇总版本内递增)")]
  27. public int DimensionConfigVersion { get; set; }
  28. [SugarColumn(ColumnDescription = "数据源编码(已登记数据源,禁连接串)", Length = 100, IsNullable = true)]
  29. public string? DataSourceCode { get; set; }
  30. [SugarColumn(ColumnDescription = "维度只读 SQL 脚本", ColumnDataType = "text", IsNullable = true)]
  31. public string? SqlScript { get; set; }
  32. [SugarColumn(ColumnDescription = "聚合类型 DIRECT_VALUE / RATIO_OF_SUMS / AVERAGE_OF_SUMS / SUMMARY_ONLY", Length = 30)]
  33. public string AggregationType { get; set; } = "SUMMARY_ONLY";
  34. [SugarColumn(ColumnDescription = "支持维度声明 JSON 数组(如 [\"value_date\",\"order_no\"])", ColumnDataType = "text", IsNullable = true)]
  35. public string? SupportedDimensionsJson { get; set; }
  36. [SugarColumn(ColumnDescription = "输出契约声明 JSON(元数据)", ColumnDataType = "text", IsNullable = true)]
  37. public string? OutputContractJson { get; set; }
  38. [SugarColumn(ColumnDescription = "参数声明 JSON(元数据,运行绑定由引擎注入)", ColumnDataType = "text", IsNullable = true)]
  39. public string? ParameterContractJson { get; set; }
  40. [SugarColumn(ColumnDescription = "查询超时(秒),受系统上限约束")]
  41. public int TimeoutSeconds { get; set; } = 60;
  42. [SugarColumn(ColumnDescription = "发布状态 DRAFT / PUBLISHED / RETIRED", Length = 20)]
  43. public string PublishStatus { get; set; } = "DRAFT";
  44. [SugarColumn(ColumnDescription = "是否当前生效版本(同 KPI 唯一)")]
  45. public bool IsCurrent { get; set; }
  46. [SugarColumn(ColumnDescription = "业务 SQL 来源", Length = 200, IsNullable = true)]
  47. public string? BusinessSqlSource { get; set; }
  48. [SugarColumn(ColumnDescription = "变更说明", ColumnDataType = "text", IsNullable = true)]
  49. public string? ChangeRemark { get; set; }
  50. [SugarColumn(ColumnDescription = "备注", ColumnDataType = "text", IsNullable = true)]
  51. public string? Remark { get; set; }
  52. [SugarColumn(ColumnDescription = "创建人", Length = 100, IsNullable = true)]
  53. public string? CreatedBy { get; set; }
  54. [SugarColumn(ColumnDescription = "创建时间")]
  55. public DateTime CreatedAt { get; set; }
  56. [SugarColumn(ColumnDescription = "更新人", Length = 100, IsNullable = true)]
  57. public string? UpdatedBy { get; set; }
  58. [SugarColumn(ColumnDescription = "更新时间", IsNullable = true)]
  59. public DateTime? UpdatedAt { get; set; }
  60. [SugarColumn(ColumnDescription = "发布人", Length = 100, IsNullable = true)]
  61. public string? PublishedBy { get; set; }
  62. [SugarColumn(ColumnDescription = "发布时间", IsNullable = true)]
  63. public DateTime? PublishedAt { get; set; }
  64. [SugarColumn(ColumnDescription = "停用人", Length = 100, IsNullable = true)]
  65. public string? RetiredBy { get; set; }
  66. [SugarColumn(ColumnDescription = "停用时间", IsNullable = true)]
  67. public DateTime? RetiredAt { get; set; }
  68. }