package models import ( "time" ) // ResourceModel 资源模型 (CMDB 模型定义) type ResourceModel struct { ID uint `gorm:"primarykey" json:"id"` Name string `gorm:"size:64;not null" json:"name"` Code string `gorm:"size:64;uniqueIndex;not null" json:"code"` Description string `gorm:"size:500" json:"description"` Type string `gorm:"size:32;default:normal" json:"type"` // normal, parent Attributes string `gorm:"type:text" json:"attributes"` // JSON 数组 Icon string `gorm:"size:64" json:"icon"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } func (ResourceModel) TableName() string { return "asset_resource_models" }