iot_device.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  1. package iot
  2. import (
  3. "IotAdmin/common/models"
  4. "time"
  5. )
  6. type Device struct {
  7. ID int64 `gorm:"primary_key;auto_increment;not null;comment:Id"`
  8. ParentId int64 `gorm:"type:bigint;not null;comment:父ID"`
  9. GroupId int64 `gorm:"type:bigint;not null;comment:分组ID"`
  10. SN string `gorm:"type:varchar(50);not null;comment:设备编码"`
  11. Name string `gorm:"type:varchar(50);not null;comment:设备名称"`
  12. Type int `gorm:"type:tinyint(1);not null;comment:设备类型 1:网关 2:表计"`
  13. Mode int `gorm:"type:tinyint(1);comment:设备模式 1:下发指令查询 2:表计主动上报"`
  14. Cycle int `gorm:"type:int;comment:上报周期"`
  15. Status int `gorm:"type:tinyint(1);comment:启用状态"`
  16. // DSN 表计上报IP、端口、协议、ST、MN、用户、密码 192.168.0.104:8080@YcHj212@1@mn,192.168.0.104:8081@YcHj212@user@123456
  17. DSN string `gorm:"type:text;comment:设备Dsn"`
  18. Description string `gorm:"type:varchar(255);comment:设备描述"`
  19. Protocol string `gorm:"type:varchar(50);comment:表计协议"`
  20. Address int `gorm:"type:int;comment:表计地址"`
  21. BmYz string `gorm:"type:text;comment:编码因子"`
  22. OtherConfig string `gorm:"type:text;comment:其他配置"` //LvRef 表计线基准电压 PvRef表计相基准电压 PT CT 等配置
  23. OnlineStatus int `gorm:"type:tinyint(1);comment:在线状态"`
  24. TimeOnline time.Time `gorm:"type:datetime;comment:上线时间"`
  25. TimeOffline time.Time `gorm:"type:datetime;comment:离线时间"`
  26. models.ControlBy
  27. models.ModelTime
  28. }
  29. func (Device) TableName() string {
  30. return "iot_device"
  31. }