temp_scan_device.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package dao
  2. import (
  3. "server/global"
  4. "time"
  5. )
  6. type TempScanDevice struct {
  7. global.GVA_MODEL
  8. GatewayID uint `gorm:"comment:扫描所属网关ID"`
  9. GatewaySN string `gorm:"comment:网关productKey LC0001"`
  10. AreaNo string `gorm:"comment:区号 00 00"`
  11. ClusterNo string `gorm:"comment:组 C0 00"`
  12. Number string `gorm:"灯号 0F C2"`
  13. UUID string `gorm:"comment:设备唯一标识,同网关不重复"`
  14. FirmwareVer string `gorm:"固件版本"`
  15. DeviceType string `gorm:"lamp/灯具"`
  16. IsSelected int `gorm:"default:0;comment:前端是否勾选 0未选1已选"`
  17. ScanTime time.Time `gorm:"扫描上报时间"`
  18. }
  19. func (TempScanDevice) TableName() string {
  20. return "temp_scan_device"
  21. }
  22. func QueryAllTempScanDevices() (tempScanDevices []TempScanDevice, err error) {
  23. err = global.GVA_DB.Find(&tempScanDevices).Error
  24. return
  25. }
  26. func QueryTempScanDevicesByGatewaySN(gatewaySN string) (tempScanDevices []TempScanDevice, err error) {
  27. err = global.GVA_DB.Where("product_key = ?", gatewaySN).Find(&tempScanDevices).Error
  28. return
  29. }
  30. func (tsd TempScanDevice) CreateTempScanDevice() error {
  31. return global.GVA_DB.Create(&tsd).Error
  32. }