diff --git a/business/jxstore/initdata/initdata.go b/business/jxstore/initdata/initdata.go index 369748e9e..880328786 100644 --- a/business/jxstore/initdata/initdata.go +++ b/business/jxstore/initdata/initdata.go @@ -22,6 +22,7 @@ func insertPlace(ctx *jxcontext.Context, db *dao.DaoDB, parent *autonavi.Distric Name: v.Name, Level: int8(v.Level), TelCode: v.Citycode, + Enabled: 1, } if parent != nil { place.ParentCode = int(utils.Str2Int64(parent.Adcode)) @@ -94,6 +95,18 @@ func InitPlace(ctx *jxcontext.Context) (err error) { SET t1.mtps_price = t2.price WHERE t1.level = 2 AND t1.mtps_price = 0; `, + ` + UPDATE place t1 + LEFT JOIN ( + SELECT DISTINCT city_code + FROM store + UNION DISTINCT + SELECT DISTINCT place_code city_code + FROM sku_name_place_bind + ) t2 ON t1.code = t2.city_code + SET t1.enabled = 0 + WHERE t1.level = 2 AND t2.city_code IS NULL; + `, } for _, v := range updateSqls { if _, err = dao.ExecuteSQL(db, v); err != nil {