| 12345678910111213141516171819202122232425262728 |
- package dao
- import "server/global"
- type DeviceConsumption struct {
- global.GVA_MODEL
- GatewayID uint `json:"gatewayID" gorm:"comment:所属网关ID"`
- UUID string `json:"UUID" gorm:"index;comment:灯具唯一UUID"`
- AreaNo string `json:"areaNo" gorm:"comment:区号"`
- Number string `json:"number" gorm:"comment:灯号"`
- DeviceName string `json:"DeviceName" gorm:"comment:网关device_name"`
- AcquisitionTs int64 `json:"acquisitionTs" gorm:"index;comment:采集时间戳"`
- TimeDur int64 `json:"timeDur" gorm:"comment:通电总时长 秒"`
- SensorDur int64 `json:"sensorDur" gorm:"comment:感应时长 秒"`
- EnergyDur int64 `json:"energyDur" gorm:"comment:等效能耗时长 秒"`
- Power float64 `json:"power" gorm:"comment:灯具额定功率 W"`
- // 预计算本次能耗,方便聚合
- ActualKwh float64 `json:"actualKwh" gorm:"comment:本次实际能耗 度"`
- TheoryKwh float64 `json:"theoryKwh" gorm:"comment:本次理论能耗 度"`
- }
- func (DeviceConsumption) TableName() string {
- return "device_consumption"
- }
- func (dc DeviceConsumption) CreateDeviceConsumption() error {
- return global.GVA_DB.Create(&dc).Error
- }
|