package dao import ( "server/global" "time" ) type UHFReader struct { global.GVA_MODEL DeviceCode string `gorm:"size:50;not null;uniqueIndex" json:"device_code"` DeviceName string `gorm:"size:100;not null" json:"device_name"` DeviceType string `gorm:"size:100;not null" json:"device_type"` // ========== 连接方式配置 ========== ConnectType string `gorm:"size:20;not null;default:'tcp'" json:"connect_type"` // tcp / serial // TCP 配置 IPAddress string `gorm:"size:50" json:"ip_address"` Port int `gorm:"default:0" json:"port"` // Serial(RS232) 配置 COMPort string `gorm:"size:50" json:"com_port"` // COM3 /dev/ttyUSB0 BaudRate int `gorm:"default:9600" json:"baud_rate"` // 波特率 Status string `gorm:"size:20;default:'offline'" json:"status"` IsActive bool `gorm:"default:true" json:"is_active"` Description string `gorm:"size:200" json:"description"` ParkingLotID uint `json:"parking_lot_id"` ParkingLot ParkingLot `gorm:"foreignkey:ParkingLotID" json:"parking_lot"` LastOnlineTime *time.Time `json:"last_online_time" gorm:"comment:最后上线时间;default:null"` ChannelID uint `gorm:"comment:绑定通道ID" json:"channel_id"` Channel *Channel `gorm:"foreignKey:ChannelID;references:ID" json:"channel"` } func (UHFReader) TableName() string { return "uhf_reader" }