namespace Admin.NET.Plugin.AiDOP.Entity.DataPlatform;
[SugarTable("mdp_entity", "MDP同步实体配置")]
public class MdpEntity
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
public long Id { get; set; }
[SugarColumn(ColumnName = "tenant_id")]
public long TenantId { get; set; }
[SugarColumn(ColumnName = "source_id")]
public long SourceId { get; set; }
[SugarColumn(ColumnName = "entity_code", Length = 100)]
public string EntityCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "entity_name", Length = 200)]
public string EntityName { get; set; } = string.Empty;
[SugarColumn(ColumnName = "entity_type", Length = 40)]
public string EntityType { get; set; } = "TABLE";
[SugarColumn(ColumnName = "source_table_name", Length = 200, IsNullable = true)]
public string? SourceTableName { get; set; }
[SugarColumn(ColumnName = "source_api_path", Length = 500, IsNullable = true)]
public string? SourceApiPath { get; set; }
[SugarColumn(ColumnName = "api_config_id", IsNullable = true)]
public long? ApiConfigId { get; set; }
[SugarColumn(ColumnName = "target_table_name", Length = 200, IsNullable = true)]
public string? TargetTableName { get; set; }
[SugarColumn(ColumnName = "sync_mode", Length = 40)]
public string SyncMode { get; set; } = "INCR";
[SugarColumn(ColumnName = "incr_column", Length = 100, IsNullable = true)]
public string? IncrColumn { get; set; }
[SugarColumn(ColumnName = "batch_size")]
public int BatchSize { get; set; } = 5000;
[SugarColumn(ColumnName = "response_data_path", Length = 200, IsNullable = true)]
public string? ResponseDataPath { get; set; }
[SugarColumn(ColumnName = "dedup_key_path", Length = 200, IsNullable = true)]
public string? DedupKeyPath { get; set; }
/// 业务键规格:逗号分隔有序源字段名,如 Domain,Receiver,Line。
[SugarColumn(ColumnName = "biz_key_expr", Length = 300, IsNullable = true)]
public string? BizKeyExpr { get; set; }
[SugarColumn(ColumnName = "last_cursor", Length = 500, IsNullable = true)]
public string? LastCursor { get; set; }
[SugarColumn(ColumnName = "last_sync_to", IsNullable = true)]
public DateTime? LastSyncTo { get; set; }
[SugarColumn(ColumnName = "job_id", Length = 100, IsNullable = true)]
public string? JobId { get; set; }
[SugarColumn(ColumnName = "status")]
public int Status { get; set; } = 1;
/// FILE_EXCEL 实体的 Sheet/行数/导入模式等 JSON;DB/API 实体可空。
[SugarColumn(ColumnName = "file_config_json", ColumnDataType = "text", IsNullable = true)]
public string? FileConfigJson { get; set; }
/// 显式公共模板(1)才允许跨租户读取;禁止仅凭 tenant_id=0 推断。
[SugarColumn(ColumnName = "is_public_template", DefaultValue = "0")]
public int IsPublicTemplate { get; set; }
[SugarColumn(ColumnName = "remark", Length = 500, IsNullable = true)]
public string? Remark { get; set; }
[SugarColumn(ColumnName = "create_time")]
public DateTime CreateTime { get; set; }
[SugarColumn(ColumnName = "update_time")]
public DateTime UpdateTime { get; set; }
}
[SugarTable("mdp_field_mapping", "MDP字段映射配置")]
public class MdpFieldMapping
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
public long Id { get; set; }
[SugarColumn(ColumnName = "entity_id")]
public long EntityId { get; set; }
[SugarColumn(ColumnName = "source_field", Length = 200)]
public string SourceField { get; set; } = string.Empty;
[SugarColumn(ColumnName = "target_field", Length = 200)]
public string TargetField { get; set; } = string.Empty;
[SugarColumn(ColumnName = "field_type", Length = 40)]
public string FieldType { get; set; } = "DIRECT";
[SugarColumn(ColumnName = "transform_script", ColumnDataType = "text", IsNullable = true)]
public string? TransformScript { get; set; }
[SugarColumn(ColumnName = "const_value", Length = 500, IsNullable = true)]
public string? ConstValue { get; set; }
[SugarColumn(ColumnName = "lookup_table", Length = 200, IsNullable = true)]
public string? LookupTable { get; set; }
[SugarColumn(ColumnName = "is_required")]
public int IsRequired { get; set; }
[SugarColumn(ColumnName = "default_value", Length = 500, IsNullable = true)]
public string? DefaultValue { get; set; }
[SugarColumn(ColumnName = "sort_order")]
public int SortOrder { get; set; }
[SugarColumn(ColumnName = "create_time")]
public DateTime CreateTime { get; set; }
}