Browse Source

Merge branch 'bzq1/execl-edit' of eta_server/eta_api into debug

鲍自强 9 months ago
parent
commit
f1e16c23ff
1 changed files with 8 additions and 4 deletions
  1. 8 4
      models/target.go

+ 8 - 4
models/target.go

@@ -202,13 +202,17 @@ func DeleteEdbinfoByTraceCodeList(tradeCodeList []string) (err error) {
 	}
 	o := orm.NewOrmUsingDB("edb")
 	err = o.DoTx(func(ctx context.Context, txOrm orm.TxOrmer) error {
-		sql := ` DELETE FROM edbdata WHERE TRADE_CODE in (` + strings.Join(tradeCodeList, ",") + `) `
-		_, err := txOrm.Raw(sql).Exec()
+		var holder []string
+		for range tradeCodeList {
+			holder = append(holder, "?")
+		}
+		sql := ` DELETE FROM edbdata WHERE TRADE_CODE in (` + strings.Join(holder, ",") + `) `
+		_, err := txOrm.Raw(sql, tradeCodeList).Exec()
 		if err != nil {
 			return err
 		}
-		sql = ` DELETE FROM edbinfo WHERE TRADE_CODE in (` + strings.Join(tradeCodeList, ",") + `)`
-		_, err = txOrm.Raw(sql).Exec()
+		sql = ` DELETE FROM edbinfo WHERE TRADE_CODE in (` + strings.Join(holder, ",") + `)`
+		_, err = txOrm.Raw(sql, tradeCodeList).Exec()
 		if err != nil {
 			return err
 		}