package models

import "time"

type IPCAlarm struct {
	ID      int64     `gorm:"primary_key"`                //主键ID
	DID     string    `gorm:"type:varchar(32)"`           //设备编码
	TStart  time.Time `gorm:"type:datetime"`              //告警开始时间
	TEnd    time.Time `gorm:"type:datetime;default:null"` //告警结束时间
	AType   string    `gorm:"type:varchar(32)"`           //告警主题
	Content string    `gorm:"type:varchar(128)"`          //告警内容
	LcModel
}

func (IPCAlarm) TableName() string {
	return "t_device_ipc_alarm"
}

func (o IPCAlarm) Update() error {
	err := G_db.Model(&o).Where("id = ?", o.ID).Updates(
		map[string]interface{}{"t_end": o.TEnd}).Error
	return err
}
