diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 67c8627a5..278d44236 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -239,14 +239,21 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte if mapCond := strings.ToUpper(utils.Interface2String(params[mapCondKey])); mapCond == "AND" || mapCond == "OR" { mapCondsStr := utils.Interface2String(params[mapCondKey+"s"]) if mapCondsStr != "" { - var vendorStoreConds map[string]int + var vendorStoreConds map[string]interface{} if err = utils.UnmarshalUseNumber([]byte(mapCondsStr), &vendorStoreConds); err != nil { return "", nil, "", nil, err } sqlVendorStoreCond := "" - for vendor, cond := range vendorStoreConds { + for vendor, cond2 := range vendorStoreConds { + var cond string + if condStr, ok := cond2.(string); !ok { + cond = utils.Int64ToStr(utils.ForceInterface2Int64(cond2)) + } else { + cond = condStr + } + tableAlias := tableName + vendor - if cond != 0 { + if cond != "0" && cond != "" { if sqlVendorStoreCond == "" { if mapCond == "AND" { sqlVendorStoreCond += " AND ( 1 = 1" @@ -258,10 +265,14 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte tableAlias + ".store_id = t1.id AND " + tableAlias + ".deleted_at = ? AND " + tableAlias + ".is_sync <> 0 " sqlFromParams = append(sqlFromParams, vendor, utils.DefaultTimeValue) - if cond == 1 { + if cond == "1" { sqlVendorStoreCond += " " + mapCond + " " + tableAlias + ".id IS NOT NULL" - } else { + } else if cond == "-1" { sqlVendorStoreCond += " " + mapCond + " " + tableAlias + ".id IS NULL" + } else { + sqlFrom += " AND " + tableAlias + ".vendor_org_code = ?" + sqlFromParams = append(sqlFromParams, cond) + sqlVendorStoreCond += " " + mapCond + " " + tableAlias + ".id IS NOT NULL" } } } diff --git a/controllers/cms_store.go b/controllers/cms_store.go index 59a2cfd3f..01a583c86 100644 --- a/controllers/cms_store.go +++ b/controllers/cms_store.go @@ -29,7 +29,7 @@ type StoreController struct { // @Param tel query string false "电话" // @Param statuss query string false "门店状态列表[-1,0,1],(-1:禁用;0:休息,关店;1:正常开店),缺省不限制" // @Param vendorStoreCond query string false "查询关联门店的条件(如果此字段没有设置,vendorStoreConds无效),and:与,or:或,指的是vendorStoreConds里的条件间的关系,这组条件与其它条件都是与的关系" -// @Param vendorStoreConds query string false "为厂商条件对象{vendorID: cond},注意vendorID是字符串形式,cond,-1:没有关联,0:不限定,1:有关联,缺省为0" +// @Param vendorStoreConds query string false "为厂商条件对象{vendorID: cond},注意vendorID是字符串形式,cond,-1:没有关联,0:不限定,1:有关联,缺省为0,其它值表示vendorOrgCode" // @Param courierStoreCond query string false "查询关联门店的条件(如果此字段没有设置,courierStoreConds无效),and:与,or:或,指的是courierStoreConds里的条件间的关系,这组条件与其它条件都是与的关系" // @Param courierStoreConds query string false "为厂商条件对象{vendorID: cond},注意vendorID是字符串形式,cond,-1:没有关联,0:不限定,1:有关联,缺省为0" // @Param mapLongitude query string false "地图中心经度"