GetStores的vendorStoreConds规则修改,添加vendorOrgCode查询支持
This commit is contained in:
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 "地图中心经度"
|
||||
|
||||
Reference in New Issue
Block a user