23 lines
580 B
Go
23 lines
580 B
Go
package dao
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Device struct {
|
|
gorm.Model
|
|
AuthID int `gorm:"column:auth_id"`
|
|
DeviceName string `gorm:"column:device_name"`
|
|
DeviceType string `gorm:"column:device_type"`
|
|
DeviceStatus string `gorm:"column:device_status"`
|
|
DeviceLocation string `gorm:"column:device_location"`
|
|
DeviceIP string `gorm:"column:device_ip"`
|
|
DeviceInfo string `gorm:"column:device_info"`
|
|
}
|
|
|
|
func FindDeviceByID(id, auth_id int) Device {
|
|
var device Device
|
|
DB.Where("id = ? and auth_id = ?", id, auth_id).First(&device)
|
|
return device
|
|
}
|