| | |
| | | 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"` |
| | |
| | | |
| | | 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) |
| | | fmt.Println("sql:", sql) |
| | | result, err := o.Raw(sql).Exec() |
| | | if err != nil { |
| | | return 0, err |
| | | } |