week_consumption_summary.go 753 B

123456789101112131415161718192021
  1. package dao
  2. import "server/global"
  3. type WeekConsumptionSummary struct {
  4. global.GVA_MODEL
  5. GatewayID uint `json:"gatewayID" gorm:"comment:网关ID"`
  6. UUID string `json:"UUID" gorm:"comment:灯具UUID,为空代表网关汇总"`
  7. Year int `json:"year" gorm:"index;comment:年份"`
  8. Week int `json:"week" gorm:"index;comment:第几周"`
  9. ActualTotal float64 `json:"actualTotal" gorm:"comment:本周累计实际能耗 度"`
  10. TheoryTotal float64 `json:"theoryTotal" gorm:"comment:本周累计理论能耗 度"`
  11. }
  12. func (WeekConsumptionSummary) TableName() string {
  13. return "week_consumption_summary"
  14. }
  15. func (wcs WeekConsumptionSummary) CreateWeekConsumptionSummary() error {
  16. return global.GVA_DB.Create(&wcs).Error
  17. }