iot_device.go 1.4 KB

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