uhf_reader.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package dao
  2. import (
  3. "server/global"
  4. "time"
  5. )
  6. type UHFReader struct {
  7. global.GVA_MODEL
  8. DeviceCode string `gorm:"size:50;not null;uniqueIndex" json:"device_code"`
  9. DeviceName string `gorm:"size:100;not null" json:"device_name"`
  10. DeviceType string `gorm:"size:100;not null" json:"device_type"`
  11. // ========== 连接方式配置 ==========
  12. ConnectType string `gorm:"size:20;not null;default:'tcp'" json:"connect_type"` // tcp / serial
  13. // TCP 配置
  14. IPAddress string `gorm:"size:50" json:"ip_address"`
  15. Port int `gorm:"default:0" json:"port"`
  16. // Serial(RS232) 配置
  17. COMPort string `gorm:"size:50" json:"com_port"` // COM3 /dev/ttyUSB0
  18. BaudRate int `gorm:"default:9600" json:"baud_rate"` // 波特率
  19. Status string `gorm:"size:20;default:'offline'" json:"status"`
  20. IsActive bool `gorm:"default:true" json:"is_active"`
  21. Description string `gorm:"size:200" json:"description"`
  22. ParkingLotID uint `json:"parking_lot_id"`
  23. LastOnlineTime *time.Time `json:"last_online_time" gorm:"comment:最后上线时间;default:null"`
  24. ChannelID uint `gorm:"comment:绑定通道ID" json:"channel_id"`
  25. Channel *Channel `gorm:"foreignKey:ChannelID;references:ID" json:"channel"`
  26. }
  27. func (UHFReader) TableName() string {
  28. return "uhf_reader"
  29. }