Files
cid/model/entity/mapping/data_mapping.go
2026-03-23 14:08:11 +08:00

53 lines
1.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package mapping
import (
"cid/consts/mapping"
"gitea.com/red-future/common/beans"
)
// DataMapping 数据映射实体
type DataMapping struct {
beans.SQLBaseDO `orm:",inherit"`
// 关联信息
PlatformId int64 `orm:"platform_id" json:"platformId" description:"平台ID"`
InterfaceId int64 `orm:"interface_id" json:"interfaceId" description:"接口ID"`
// 映射规则
SourceField string `orm:"source_field" json:"sourceField" description:"源字段(接口返回字段)"`
TargetField string `orm:"target_field" json:"targetField" description:"目标字段(本地表字段)"`
FieldType string `orm:"field_type" json:"fieldType" description:"字段类型string/int/float/bool/array/object"`
DefaultValue string `orm:"default_value" json:"defaultValue" description:"默认值"`
// 转换规则 (JSONB)
TransformRule map[string]interface{} `orm:"transform_rule" json:"transformRule" description:"转换规则"`
// 优先级和状态
Priority int `orm:"priority" json:"priority" description:"优先级(数字越小优先级越高)"`
Status mapping.MappingStatus `orm:"status" json:"status" description:"状态active启用/inactive停用"`
}
// DataMappingCol 数据映射表字段定义
type DataMappingCol struct {
beans.SQLBaseCol
PlatformId string
InterfaceId string
SourceField string
TargetField string
FieldType string
DefaultValue string
TransformRule string
Priority string
Status string
}
// DataMappingCols 数据映射表字段常量
var DataMappingCols = DataMappingCol{
SQLBaseCol: beans.DefSQLBaseCol,
PlatformId: "platform_id",
InterfaceId: "interface_id",
SourceField: "source_field",
TargetField: "target_field",
FieldType: "field_type",
DefaultValue: "default_value",
TransformRule: "transform_rule",
Priority: "priority",
Status: "status",
}