copy商品delete语句去掉别名,mysql5.版本不支持
This commit is contained in:
@@ -1605,8 +1605,8 @@ func CopyStoreSkus(ctx *jxcontext.Context, fromStoreID int, toStoreIDs []int, co
|
|||||||
num += num2
|
num += num2
|
||||||
//上方insert会无视目标门店中未关注的商品(以前关注,后来取消关注),所以这里批量删一下
|
//上方insert会无视目标门店中未关注的商品(以前关注,后来取消关注),所以这里批量删一下
|
||||||
sql2 := `
|
sql2 := `
|
||||||
DELETE FROM store_sku_bind a
|
DELETE FROM store_sku_bind
|
||||||
WHERE a.store_id = ? AND a.sku_id IN (
|
WHERE store_id = ? AND sku_id IN (
|
||||||
SELECT b.sku_id FROM (
|
SELECT b.sku_id FROM (
|
||||||
SELECT store_id,sku_id,count(*)
|
SELECT store_id,sku_id,count(*)
|
||||||
FROM store_sku_bind
|
FROM store_sku_bind
|
||||||
@@ -1614,20 +1614,17 @@ func CopyStoreSkus(ctx *jxcontext.Context, fromStoreID int, toStoreIDs []int, co
|
|||||||
GROUP BY 1,2
|
GROUP BY 1,2
|
||||||
HAVING count(*) > 1)b
|
HAVING count(*) > 1)b
|
||||||
)
|
)
|
||||||
AND a.deleted_at <> ?
|
AND deleted_at <> ?
|
||||||
`
|
`
|
||||||
sqlParams2 := []interface{}{
|
sqlParams2 := []interface{}{
|
||||||
toStoreID, toStoreID, utils.DefaultTimeValue,
|
toStoreID, toStoreID, utils.DefaultTimeValue,
|
||||||
}
|
}
|
||||||
num3, err := dao.ExecuteSQL(db, sql2, sqlParams2)
|
_, err = dao.ExecuteSQL(db, sql2, sqlParams2)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errList.AddErr(err)
|
errList.AddErr(err)
|
||||||
dao.Rollback(db)
|
dao.Rollback(db)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
fmt.Println(sql2)
|
|
||||||
fmt.Println(sqlParams2)
|
|
||||||
fmt.Println(num3)
|
|
||||||
globals.SugarLogger.Debugf("CopyStoreSkus fromStoreID:%d, toStoreID:%d, trackInfo:%s num3:%d", fromStoreID, toStoreID, ctx.GetTrackInfo(), num2)
|
globals.SugarLogger.Debugf("CopyStoreSkus fromStoreID:%d, toStoreID:%d, trackInfo:%s num3:%d", fromStoreID, toStoreID, ctx.GetTrackInfo(), num2)
|
||||||
dao.Commit(db)
|
dao.Commit(db)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user