uhf_reader.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package dao
  2. import (
  3. "wails-app/internal/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. ParkingLot ParkingLot `gorm:"foreignkey:ParkingLotID" json:"parking_lot"`
  24. LastOnlineTime *time.Time `json:"last_online_time" gorm:"comment:最后上线时间;default:null"`
  25. ChannelID uint `gorm:"comment:绑定通道ID" json:"channel_id"`
  26. Channel *Channel `gorm:"foreignKey:ChannelID;references:ID" json:"channel"`
  27. }
  28. func (UHFReader) TableName() string {
  29. return "uhf_reader"
  30. }