| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- package dao
- import (
- "time"
- "wails-app/internal/global"
- )
- // 连接类型
- const (
- ConnectTypeTCP = "tcp"
- ConnectTypeSerial = "serial"
- ConnectTypeMQTT = "mqtt"
- )
- 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"`
- DeviceID string `gorm:"size:100;index" json:"device_id"` // 永久硬件身份,不能由管理员随意修改
- // ========== 连接方式配置 ==========
- 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"`
- ProvisionStatus string `gorm:"size:20;default:'unprovisioned';index" json:"provision_status"`
- ProvisionMethod string `gorm:"size:20;default:'legacy'" json:"provision_method"`
- ProvisionError string `gorm:"size:500" json:"provision_error"`
- IdentityVerifiedAt *time.Time `json:"identity_verified_at"`
- ProvisionedAt *time.Time `json:"provisioned_at"`
- LastDiscoveredAt *time.Time `json:"last_discovered_at"`
- DiscoveredIP string `gorm:"size:50" json:"discovered_ip"`
- ConfigPort int `gorm:"default:0" json:"config_port"`
- DeviceModel string `gorm:"size:100" json:"device_model"`
- FirmwareVersion string `gorm:"size:100" json:"firmware_version"`
- DevicePublicKey string `gorm:"type:text" json:"device_public_key"`
- 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"
- }
|