diff --git a/repository/repository.go b/repository/repository.go index 1c98cda..fec6674 100644 --- a/repository/repository.go +++ b/repository/repository.go @@ -71,6 +71,21 @@ func (repo *Repository) FindById(id string) Identity { if md, ok := repo.relayMap[id]; ok { return md } + if md, ok := repo.physicalSectionMap[id]; ok { + return md + } + if md, ok := repo.checkPointMap[id]; ok { + return md + } + if md, ok := repo.responderMap[id]; ok { + return md + } + if md, ok := repo.stationMap[id]; ok { + return md + } + if md, ok := repo.platformMap[id]; ok { + return md + } return nil } diff --git a/repository/turnout.go b/repository/turnout.go index 53f2119..b72d987 100644 --- a/repository/turnout.go +++ b/repository/turnout.go @@ -3,6 +3,7 @@ package repository import ( "errors" "fmt" + "joylink.club/rtsssimulation/repository/model/proto" ) @@ -278,6 +279,14 @@ func (t *Turnout) FindRelay(groupCode, relayCode string) *Relay { return nil } +func (t *Turnout) GetPhysicalSection() *PhysicalSection { + return t.section +} + +func (t *Turnout) GindDevicePortByPort(port proto.Port) DevicePort { + return t.findDevicePortByPort(port) +} + type TurnoutPort struct { turnout *Turnout port proto.Port