Commit d33b42af authored by szh's avatar szh

add where

parent 240f4a31
...@@ -28,9 +28,8 @@ func UpdateDevList(rasp RaspDevList) error { ...@@ -28,9 +28,8 @@ func UpdateDevList(rasp RaspDevList) error {
func UpdateDevList1(rasp RaspDevList) error { func UpdateDevList1(rasp RaspDevList) error {
var dev RaspDevList var dev RaspDevList
dev.Addr = rasp.Addr
tx := db.Begin() tx := db.Begin()
if tx.First(&dev).RecordNotFound() { if tx.Where("addr = ?",rasp.Addr).First(&dev).RecordNotFound() {
if err :=tx.Create(&rasp).Error;err != nil { if err :=tx.Create(&rasp).Error;err != nil {
tx.Rollback() tx.Rollback()
return err return err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment