device.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package models
  2. import (
  3. "IotAdmin/common/models"
  4. )
  5. // IotDevice 设备实体
  6. type IotDevice struct {
  7. models.Model
  8. ParentId string `json:"parentId" gorm:"type:bigint(20);comment:父ID"`
  9. GroupId string `json:"groupId" gorm:"type:bigint(20);comment:设备分组"`
  10. Sn string `json:"sn" gorm:"type:varchar(50);comment:设备编码"`
  11. Name string `json:"name" gorm:"type:varchar(50);comment:设备名称"`
  12. Type string `json:"type" gorm:"type:bigint(20);comment:设备类型"`
  13. Mode string `json:"mode" gorm:"type:bigint(20);comment:设备模式"`
  14. Cycle string `json:"cycle" gorm:"type:bigint(20);comment:上报周期"`
  15. Dsn string `json:"dsn" gorm:"type:varchar(255);comment:设备Dsn"`
  16. Description string `json:"description" gorm:"type:varchar(255);comment:设备描述"`
  17. Protocol string `json:"protocol" gorm:"type:varchar(255);comment:表计协议"`
  18. Address string `json:"address" gorm:"type:bigint(20);comment:表计地址"`
  19. LvRef string `json:"lvRef" gorm:"type:float;comment:表计线基准电压"`
  20. PvRef string `json:"pvRef" gorm:"type:float;comment:表计相基准电压"`
  21. BmYz string `json:"bmYz" gorm:"type:varchar(255);comment:编码因子"`
  22. Config string `json:"config" gorm:"type:varchar(255);comment:其他配置"`
  23. Group *IotGroup `json:"group" gorm:"ForeignKey:GroupId;AssociationForeignKey:Id"`
  24. models.ControlBy
  25. models.ModelTime
  26. }
  27. func (*IotDevice) TableName() string {
  28. return "iot_device"
  29. }
  30. func (e *IotDevice) Generate() models.ActiveRecord {
  31. o := *e
  32. return &o
  33. }
  34. func (e *IotDevice) GetId() interface{} {
  35. return e.Id
  36. }