package model //站台一侧屏蔽门模型 type PsdModel struct { DeviceModel //屏蔽门所包含的单元 Cells []*PsdCellModel } func NewPsdModel(id string) *PsdModel { return &PsdModel{DeviceModel: DeviceModel{Id: id}, Cells: make([]*PsdCellModel, 0)} } func (me *PsdModel) AddCell(cell *PsdCellModel) { me.Cells = append(me.Cells, cell) } ///////////////////////////////////////////// //站台一侧屏蔽门单元模型 type PsdCellModel struct { DeviceModel //该屏蔽门单元所属的屏蔽门 psd IDeviceModel } func NewPsdCellModel(id string, psdModel *PsdModel) *PsdCellModel { return &PsdCellModel{ DeviceModel: DeviceModel{Id: id}, psd: psdModel, } } func (me *PsdCellModel) Psd() *PsdModel { return me.psd.(*PsdModel) }