vehicle.go 1.3 KB

1234567891011121314151617181920212223242526
  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:40;" json:"rfid_tag"` // 电子标签
  10. VehicleTypeID uint `gorm:"not null" json:"vehicle_type_id"` // 车辆类型ID
  11. VehicleType *VehicleType `gorm:"foreignKey:VehicleTypeID" json:"vehicle_type"` // 车辆类型关联
  12. VehicleBrand string `gorm:"size:50" json:"vehicle_brand"` // 车辆品牌
  13. VehicleColor string `gorm:"size:20" json:"vehicle_color"` // 车辆颜色
  14. OwnerId *uint `json:"owner_id"` // 车主id,可为空(临时车辆)
  15. Owner *Owner `gorm:"foreignKey:OwnerId" json:"owner"`
  16. LastEntryTime *time.Time `json:"last_entry_time" gorm:"default:null"` // 最近入场时间
  17. LastExitTime *time.Time `json:"last_exit_time" gorm:"default:null"` // 最近出场时间
  18. TotalStayTime int64 `json:"total_stay_time" gorm:"default:null"` // 总停留时间
  19. TotalFee float64 `json:"total_fee"` // 总费用
  20. }
  21. func (Vehicle) TableName() string {
  22. return "vehicle"
  23. }