From a5f677d2b21a47b0b8117c4c6ccca5d3a2083bb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 5 Feb 2020 10:19:46 +0800 Subject: [PATCH] =?UTF-8?q?copy=E5=95=86=E5=93=81delete=E8=AF=AD=E5=8F=A5?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=88=AB=E5=90=8D=EF=BC=8Cmysql5.=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E4=B8=8D=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index fad9b8954..5a7461d10 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1605,8 +1605,8 @@ func CopyStoreSkus(ctx *jxcontext.Context, fromStoreID int, toStoreIDs []int, co num += num2 //上方insert会无视目标门店中未关注的商品(以前关注,后来取消关注),所以这里批量删一下 sql2 := ` - DELETE FROM store_sku_bind a - WHERE a.store_id = ? AND a.sku_id IN ( + DELETE FROM store_sku_bind + WHERE store_id = ? AND sku_id IN ( SELECT b.sku_id FROM ( SELECT store_id,sku_id,count(*) FROM store_sku_bind @@ -1614,20 +1614,17 @@ func CopyStoreSkus(ctx *jxcontext.Context, fromStoreID int, toStoreIDs []int, co GROUP BY 1,2 HAVING count(*) > 1)b ) - AND a.deleted_at <> ? + AND deleted_at <> ? ` sqlParams2 := []interface{}{ toStoreID, toStoreID, utils.DefaultTimeValue, } - num3, err := dao.ExecuteSQL(db, sql2, sqlParams2) + _, err = dao.ExecuteSQL(db, sql2, sqlParams2) if err != nil { errList.AddErr(err) dao.Rollback(db) 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) dao.Commit(db) }