Procházet zdrojové kódy

不传值时,默认为null

xu před 4 měsíci
rodič
revize
2bd39ee007
2 změnil soubory, kde provedl 18 přidání a 4 odebrání
  1. 14 0
      server/dao/shortlist.go
  2. 4 4
      server/dao/vehicle.go

+ 14 - 0
server/dao/shortlist.go

@@ -0,0 +1,14 @@
+package dao
+
+import (
+	"server/global"
+	"time"
+)
+
+type ShortList struct {
+	global.GVA_MODEL
+	ListType       string    `json:"list_type" gorm:"comment:名单类型"`
+	VehicleId      int       `json:"vehicle_id" gorm:"comment:车辆ID"`
+	Vehicle        Vehicle   `json:"vehicle" gorm:"foreignKey:VehicleId"`
+	ExpirationTime time.Time `json:"expiration_time" gorm:"comment:过期时间"`
+}

+ 4 - 4
server/dao/vehicle.go

@@ -14,10 +14,10 @@ type Vehicle struct {
 	VehicleColor  string    `gorm:"size:20" json:"vehicle_color"`                     // 车辆颜色
 	OwnerId       *uint     `json:"owner_id"`                                         // 车主id,可为空(临时车辆)
 	Owner         *Owner    `gorm:"foreignKey:OwnerId" json:"owner"`
-	LastEntryTime time.Time `json:"last_entry_time"` // 最近入场时间
-	LastExitTime  time.Time `json:"last_exit_time"`  // 最近出场时间
-	TotalStayTime int64     `json:"total_stay_time"` // 总停留时间
-	TotalFee      float64   `json:"total_fee"`       // 总费用
+	LastEntryTime time.Time `json:"last_entry_time" gorm:"default:null"` // 最近入场时间
+	LastExitTime  time.Time `json:"last_exit_time"  gorm:"default:null"` // 最近出场时间
+	TotalStayTime int64     `json:"total_stay_time"`                     // 总停留时间
+	TotalFee      float64   `json:"total_fee"`                           // 总费用
 }
 
 func (Vehicle) TableName() string {