package dao

import "server/global"

type EnvData struct {
	global.GVA_MODEL
	Sn          string  `json:"sn" gorm:"comment:编号"`
	TunnelSn    string  `json:"tunnelSn" gorm:"comment:隧道序号"`
	Temperature float64 `json:"temperature" gorm:"comment:温度"`
	Humidity    float64 `json:"humidity" gorm:"comment:湿度"`
	Illuminance int64   `json:"illuminance" gorm:"comment:光照度"`
}

func (EnvData) TableName() string {
	return "env_data"
}

func (ed EnvData) CreateEnvData() error {
	return global.GVA_DB.Create(&ed).Error
}
