123456789101112131415161718 |
- package dao
- import "server/global"
- type DeviceRelay struct {
- ID int `json:"id"`
- RelayID int `json:"relayId" gorm:"comment:回路id"`
- DeviceId int `json:"deviceId" gorm:"comment:设备id"`
- State bool `json:"state" gorm:"comment:设备状态"`
- }
- func (DeviceRelay) TableName() string {
- return "device_relay"
- }
- func UpdateRelayState(deviceId, relayId int, state bool) error {
- return global.GVA_DB.Model(&DeviceRelay{}).Debug().Where("device_id = ? AND relay_id = ?", deviceId, relayId).Update("state", state).Error
- }
|