fix 修复providers的ids为空时数据库报错
This commit is contained in:
parent
bb10f842f3
commit
1da1fd27d8
@ -3,7 +3,6 @@ package storage
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
|
|
||||||
v2 "gitea.timerzz.com/kedaya_haitao/common/structs/v2"
|
v2 "gitea.timerzz.com/kedaya_haitao/common/structs/v2"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
@ -82,7 +81,7 @@ func (p *providerApi) Update(provider v2.Provider) error {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 删除已经没有的CalculateProcess
|
// 删除已经没有的CalculateProcess
|
||||||
if err := tx.Where(fmt.Sprintf("id not in (%s) AND owner_id = ? AND kind = ?", strings.Join(ids, ",")), provider.ID, "provider").Delete(&v2.CalculateProcess{}).Error; err != nil {
|
if err := tx.Not(ids).Where("owner_id = ? AND kind = ?", provider.ID, "provider").Delete(&v2.CalculateProcess{}).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user