vehicle.go 1.2 KB

12345678910111213141516171819202122232425
  1. package dao
  2. import (
  3. "server/global"
  4. "time"
  5. )
  6. type Vehicle struct {
  7. global.GVA_MODEL
  8. PlateNumber string `gorm:"size:20;not null;uniqueIndex" json:"plate_number"` // 车牌号
  9. RFIDTag string `gorm:"size:20;" json:"rfid_tag"` // 电子标签
  10. VehicleType string `gorm:"size:20;not null" json:"vehicle_type"` // 车辆类型
  11. VehicleBrand string `gorm:"size:50" json:"vehicle_brand"` // 车辆品牌
  12. VehicleColor string `gorm:"size:20" json:"vehicle_color"` // 车辆颜色
  13. OwnerId *uint `json:"owner_id"` // 车主id,可为空(临时车辆)
  14. Owner *Owner `gorm:"foreignKey:OwnerId" json:"owner"`
  15. LastEntryTime *time.Time `json:"last_entry_time" gorm:"default:null"` // 最近入场时间
  16. LastExitTime *time.Time `json:"last_exit_time" gorm:"default:null"` // 最近出场时间
  17. TotalStayTime int64 `json:"total_stay_time" gorm:"default:null"` // 总停留时间
  18. TotalFee float64 `json:"total_fee"` // 总费用
  19. }
  20. func (Vehicle) TableName() string {
  21. return "vehicle"
  22. }