env_data.go 536 B

1234567891011121314151617181920
  1. package dao
  2. import "server/global"
  3. type EnvData struct {
  4. global.GVA_MODEL
  5. Sn string `json:"sn" gorm:"comment:编号"`
  6. TunnelSn string `json:"tunnelSn" gorm:"comment:隧道序号"`
  7. Temperature float64 `json:"temperature" gorm:"comment:温度"`
  8. Humidity float64 `json:"humidity" gorm:"comment:湿度"`
  9. Illuminance int64 `json:"illuminance" gorm:"comment:光照度"`
  10. }
  11. func (EnvData) TableName() string {
  12. return "env_data"
  13. }
  14. func (ed EnvData) CreateEnvData() error {
  15. return global.GVA_DB.Create(&ed).Error
  16. }