From dbc843d0b37f786fb816131bcc7ebca86dbe72e9 Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期四, 06 八月 2020 09:58:46 +0800
Subject: [PATCH] add crossRecord

---
 models/userCar.go |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/models/userCar.go b/models/userCar.go
index 82a76ab..2b70962 100644
--- a/models/userCar.go
+++ b/models/userCar.go
@@ -1,6 +1,9 @@
 package models
 
-import "github.com/astaxie/beego/orm"
+import (
+	"fmt"
+	"github.com/astaxie/beego/orm"
+)
 
 type UserCar struct {
 	Id       	string 		`orm:"pk;size(50);column(id)" json:"id"`
@@ -38,7 +41,8 @@
 
 func (uc *UserCar) Delete(userId string, plateNo string) (int64, error) {
 	o := orm.NewOrm()
-	result, err := o.Raw("delete from ? where userId=? and plateNo=?", uc.TableName(), userId, plateNo).Exec()
+	sql := fmt.Sprintf("delete from "+uc.TableName()+" where userId='%s' and plateNo='%s'", userId, plateNo)
+	result, err := o.Raw(sql).Exec()
 	if err != nil {
 		return 0, err
 	}

--
Gitblit v1.8.0