ipcalarm.go 715 B

1234567891011121314151617181920212223
  1. package models
  2. import "time"
  3. type IPCAlarm struct {
  4. ID int64 `gorm:"primary_key"` //主键ID
  5. DID string `gorm:"type:varchar(32)"` //设备编码
  6. TStart time.Time `gorm:"type:datetime"` //告警开始时间
  7. TEnd time.Time `gorm:"type:datetime;default:null"` //告警结束时间
  8. AType string `gorm:"type:varchar(32)"` //告警主题
  9. Content string `gorm:"type:varchar(128)"` //告警内容
  10. LcModel
  11. }
  12. func (IPCAlarm) TableName() string {
  13. return "t_device_ipc_alarm"
  14. }
  15. func (o IPCAlarm) Update() error {
  16. err := G_db.Model(&o).Where("id = ?", o.ID).Updates(
  17. map[string]interface{}{"t_end": o.TEnd}).Error
  18. return err
  19. }