This commit is contained in:
douxu 2025-08-12 17:19:38 +08:00
parent 426409ed91
commit 49fbd04644
6 changed files with 10 additions and 16 deletions

View File

@ -30,7 +30,6 @@ func CreateComponentIntoDB(ctx context.Context, tx *gorm.DB, componentInfo netwo
GridID: strconv.FormatInt(componentInfo.GridID, 10),
ZoneID: strconv.FormatInt(componentInfo.ZoneID, 10),
StationID: strconv.FormatInt(componentInfo.StationID, 10),
PageID: componentInfo.PageID,
Tag: componentInfo.Tag,
ComponentType: componentInfo.ComponentType,
Name: componentInfo.Name,

View File

@ -40,7 +40,6 @@ func UpdateComponentIntoDB(ctx context.Context, tx *gorm.DB, componentInfo netwo
GridID: strconv.FormatInt(componentInfo.GridID, 10),
ZoneID: strconv.FormatInt(componentInfo.ZoneID, 10),
StationID: strconv.FormatInt(componentInfo.StationID, 10),
PageID: componentInfo.PageID,
Tag: componentInfo.Tag,
ComponentType: componentInfo.ComponentType,
Name: componentInfo.Name,

View File

@ -41,7 +41,6 @@ type ComponentUpdateInfo struct {
GridID int64 `json:"grid_id"`
ZoneID int64 `json:"zone_id"`
StationID int64 `json:"station_id"`
PageID int64 `json:"page_id"`
ComponentType int `json:"component_type"`
Params string `json:"params"`
Op int `json:"op"`

View File

@ -28,9 +28,8 @@ type Component struct {
Op int `gorm:"column:OP"`
Ts time.Time `gorm:"column:TS"`
// TODO 解决删除ID、ComponentType、PageID后的报错
// TODO 解决删除ID、ComponentType 后的报错
ID int64 `gorm:"column:id;primaryKey"`
PageID int64 `gorm:"column:page_id"`
ComponentType int `gorm:"column:TYPE"`
}

View File

@ -5,18 +5,17 @@ import "time"
// Page structure define circuit diagram page info set
type Page struct {
ID int64 `gorm:"column:id;primaryKey"`
Status int `gorm:"column:status"`
Op int `gorm:"column:op"`
Label string `gorm:"column:label"`
Context string `gorm:"column:context"`
Description string `gorm:"column:description"`
Tag string `gorm:"column:tag"`
Name string `gorm:"column:name"`
Ts time.Time `gorm:"column:ts"`
ID int64 `gorm:"column:ID;primaryKey"`
Tag string `gorm:"column:TAG"`
Name string `gorm:"column:NAME"`
Label map[string]interface{} `gorm:"column:LABEL;type:jsonb;default:'{}'"`
Context map[string]interface{} `gorm:"column:CONTEXT;type:jsonb;default:'{}'"`
Description string `gorm:"column:DESCRIPTION"`
Op int `gorm:"column:OP"`
Ts time.Time `gorm:"column:TS"`
}
// TableName func respresent return table name of Page
func (p *Page) TableName() string {
return "page"
return "PAGE"
}

View File

@ -53,7 +53,6 @@ var ParseFunc = func(parseConfig interface{}) {
unmarshalMap["grid_id"] = modelParseConfig.ComponentInfo.GridID
unmarshalMap["zone_id"] = modelParseConfig.ComponentInfo.ZoneID
unmarshalMap["station_id"] = modelParseConfig.ComponentInfo.StationID
unmarshalMap["page_id"] = modelParseConfig.ComponentInfo.PageID
unmarshalMap["component_type"] = modelParseConfig.ComponentInfo.ComponentType
unmarshalMap["name"] = modelParseConfig.ComponentInfo.Name
unmarshalMap["context"] = modelParseConfig.ComponentInfo.Context