package dao import ( "server/global" "time" ) type TempScanDevice struct { global.GVA_MODEL GatewayID uint `gorm:"comment:扫描所属网关ID"` GatewaySN string `gorm:"comment:网关productKey LC0001"` AreaNo string `gorm:"comment:区号 00 00"` ClusterNo string `gorm:"comment:组 C0 00"` Number string `gorm:"灯号 0F C2"` UUID string `gorm:"comment:设备唯一标识,同网关不重复"` FirmwareVer string `gorm:"固件版本"` DeviceType string `gorm:"lamp/灯具"` IsSelected int `gorm:"default:0;comment:前端是否勾选 0未选1已选"` ScanTime time.Time `gorm:"扫描上报时间"` } func (TempScanDevice) TableName() string { return "temp_scan_device" } func QueryAllTempScanDevices() (tempScanDevices []TempScanDevice, err error) { err = global.GVA_DB.Find(&tempScanDevices).Error return } func QueryTempScanDevicesByGatewaySN(gatewaySN string) (tempScanDevices []TempScanDevice, err error) { err = global.GVA_DB.Where("product_key = ?", gatewaySN).Find(&tempScanDevices).Error return } func (tsd TempScanDevice) CreateTempScanDevice() error { return global.GVA_DB.Create(&tsd).Error }