AdoS8DashboardCellConfig.cs 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. namespace Admin.NET.Plugin.AiDOP.Entity.S8;
  2. /// <summary>
  3. /// S8 大屏卡片内容配置。描述"哪个页面的哪个卡片显示什么"。
  4. /// UI 视觉层保持现状,本表仅承载卡片的数据绑定与统计口径配置。
  5. /// 采用"全局基线 + 工厂可覆盖"策略:tenant_id=0 / factory_id=0 表示全局默认。
  6. /// </summary>
  7. [SugarTable("ado_s8_dashboard_cell_config", "S8 大屏卡片配置")]
  8. [SugarIndex("uk_ado_s8_dashboard_cell_config_tenant_factory_page_cell", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(PageCode), OrderByType.Asc, nameof(CellCode), OrderByType.Asc, IsUnique = true)]
  9. [SugarIndex("idx_ado_s8_dashboard_cell_config_page_enabled_sort", nameof(PageCode), OrderByType.Asc, nameof(Enabled), OrderByType.Asc, nameof(SortNo), OrderByType.Asc)]
  10. public class AdoS8DashboardCellConfig
  11. {
  12. [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
  13. public long Id { get; set; }
  14. [SugarColumn(ColumnName = "tenant_id", ColumnDataType = "bigint")]
  15. public long TenantId { get; set; }
  16. [SugarColumn(ColumnName = "factory_id", ColumnDataType = "bigint")]
  17. public long FactoryId { get; set; }
  18. /// <summary>归属页面:OVERVIEW / DELIVERY / PRODUCTION / SUPPLY</summary>
  19. [SugarColumn(ColumnName = "page_code", Length = 32)]
  20. public string PageCode { get; set; } = string.Empty;
  21. /// <summary>卡片编码,页面内唯一。与前端视觉结构中的稳定锚点(grid-item i、v-for key)对齐。</summary>
  22. [SugarColumn(ColumnName = "cell_code", Length = 64)]
  23. public string CellCode { get; set; } = string.Empty;
  24. /// <summary>卡片标题(覆盖前端默认;留空时前端使用组件内默认标题)</summary>
  25. [SugarColumn(ColumnName = "cell_title", Length = 128, IsNullable = true)]
  26. public string? CellTitle { get; set; }
  27. /// <summary>绑定类型:EXCEPTION_TYPE(绑单个异常类型) / AGGREGATE(按域聚合) / CUSTOM(保持现有逻辑)</summary>
  28. [SugarColumn(ColumnName = "binding_type", Length = 16)]
  29. public string BindingType { get; set; } = "CUSTOM";
  30. /// <summary>binding_type=EXCEPTION_TYPE 时使用,关联 ado_s8_exception_type.type_code</summary>
  31. [SugarColumn(ColumnName = "exception_type_code", Length = 64, IsNullable = true)]
  32. public string? ExceptionTypeCode { get; set; }
  33. /// <summary>binding_type=AGGREGATE 时使用:DOMAIN_DELIVERY / DOMAIN_PRODUCTION / DOMAIN_SUPPLY / ALL</summary>
  34. [SugarColumn(ColumnName = "aggregate_scope", Length = 32, IsNullable = true)]
  35. public string? AggregateScope { get; set; }
  36. /// <summary>统计指标:OPEN_COUNT / FREQUENCY / AVG_DURATION / CLOSE_RATE</summary>
  37. [SugarColumn(ColumnName = "stat_metric", Length = 16)]
  38. public string StatMetric { get; set; } = "OPEN_COUNT";
  39. /// <summary>时间窗:TODAY / LAST_24H / LAST_7D / LAST_30D</summary>
  40. [SugarColumn(ColumnName = "time_window", Length = 16)]
  41. public string TimeWindow { get; set; } = "LAST_24H";
  42. /// <summary>额外筛选表达式(按部门、订单范围等),留给后续扩展</summary>
  43. [SugarColumn(ColumnName = "filter_expression", Length = 1000, IsNullable = true)]
  44. public string? FilterExpression { get; set; }
  45. /// <summary>部门聚合维度:OWNER(责任部门,默认) / OCCUR(发生部门)。仅 binding_type=AGGREGATE 且聚合含部门时生效。</summary>
  46. [SugarColumn(ColumnName = "dept_group_by", Length = 8)]
  47. public string DeptGroupBy { get; set; } = "OWNER";
  48. [SugarColumn(ColumnName = "enabled", ColumnDataType = "boolean")]
  49. public bool Enabled { get; set; } = true;
  50. [SugarColumn(ColumnName = "sort_no")]
  51. public int SortNo { get; set; }
  52. [SugarColumn(ColumnName = "created_at")]
  53. public DateTime CreatedAt { get; set; } = DateTime.Now;
  54. [SugarColumn(ColumnName = "updated_at", IsNullable = true)]
  55. public DateTime? UpdatedAt { get; set; }
  56. }