12345678910111213141516171819202122232425262728 |
- package dao
- import "server/global"
- type TunnelTime struct {
- global.GVA_MODEL
- TunnelSn string `json:"tunnelSn" gorm:"comment:隧道序号"`
- StartTime string `json:"startTime" gorm:"comment:开始时间"`
- EndTime string `json:"endTime" gorm:"comment:结束时间"`
- IsComplete bool `json:"isComplete" gorm:"comment:是否完成"`
- }
- func (TunnelTime) TableName() string {
- return "tunnel_time"
- }
- func (tt TunnelTime) CreateTunnelTime() error {
- err := global.GVA_DB.Create(&tt).Error
- return err
- }
- func (tt TunnelTime) UpdateTunnelTime() error {
- return global.GVA_DB.Select("start_time", "end_time", "is_complete").Where("id = ?", tt.ID).Updates(&tt).Error
- }
- func TunnelTimeOk(sn string) error {
- return global.GVA_DB.Model(&TunnelTime{}).Where("tunnel_sn = ?", sn).Update("is_complete", true).Error
- }
|