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), GridID: strconv.FormatInt(componentInfo.GridID, 10),
ZoneID: strconv.FormatInt(componentInfo.ZoneID, 10), ZoneID: strconv.FormatInt(componentInfo.ZoneID, 10),
StationID: strconv.FormatInt(componentInfo.StationID, 10), StationID: strconv.FormatInt(componentInfo.StationID, 10),
PageID: componentInfo.PageID,
Tag: componentInfo.Tag, Tag: componentInfo.Tag,
ComponentType: componentInfo.ComponentType, ComponentType: componentInfo.ComponentType,
Name: componentInfo.Name, 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), GridID: strconv.FormatInt(componentInfo.GridID, 10),
ZoneID: strconv.FormatInt(componentInfo.ZoneID, 10), ZoneID: strconv.FormatInt(componentInfo.ZoneID, 10),
StationID: strconv.FormatInt(componentInfo.StationID, 10), StationID: strconv.FormatInt(componentInfo.StationID, 10),
PageID: componentInfo.PageID,
Tag: componentInfo.Tag, Tag: componentInfo.Tag,
ComponentType: componentInfo.ComponentType, ComponentType: componentInfo.ComponentType,
Name: componentInfo.Name, Name: componentInfo.Name,

View File

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

View File

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

View File

@ -5,18 +5,17 @@ import "time"
// Page structure define circuit diagram page info set // Page structure define circuit diagram page info set
type Page struct { type Page struct {
ID int64 `gorm:"column:id;primaryKey"` ID int64 `gorm:"column:ID;primaryKey"`
Status int `gorm:"column:status"` Tag string `gorm:"column:TAG"`
Op int `gorm:"column:op"` Name string `gorm:"column:NAME"`
Label string `gorm:"column:label"` Label map[string]interface{} `gorm:"column:LABEL;type:jsonb;default:'{}'"`
Context string `gorm:"column:context"` Context map[string]interface{} `gorm:"column:CONTEXT;type:jsonb;default:'{}'"`
Description string `gorm:"column:description"` Description string `gorm:"column:DESCRIPTION"`
Tag string `gorm:"column:tag"` Op int `gorm:"column:OP"`
Name string `gorm:"column:name"` Ts time.Time `gorm:"column:TS"`
Ts time.Time `gorm:"column:ts"`
} }
// TableName func respresent return table name of Page // TableName func respresent return table name of Page
func (p *Page) TableName() string { 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["grid_id"] = modelParseConfig.ComponentInfo.GridID
unmarshalMap["zone_id"] = modelParseConfig.ComponentInfo.ZoneID unmarshalMap["zone_id"] = modelParseConfig.ComponentInfo.ZoneID
unmarshalMap["station_id"] = modelParseConfig.ComponentInfo.StationID unmarshalMap["station_id"] = modelParseConfig.ComponentInfo.StationID
unmarshalMap["page_id"] = modelParseConfig.ComponentInfo.PageID
unmarshalMap["component_type"] = modelParseConfig.ComponentInfo.ComponentType unmarshalMap["component_type"] = modelParseConfig.ComponentInfo.ComponentType
unmarshalMap["name"] = modelParseConfig.ComponentInfo.Name unmarshalMap["name"] = modelParseConfig.ComponentInfo.Name
unmarshalMap["context"] = modelParseConfig.ComponentInfo.Context unmarshalMap["context"] = modelParseConfig.ComponentInfo.Context