diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index a7bfc8fae..0e988020f 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -226,6 +226,7 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte sqlWhereParams := []interface{}{ utils.DefaultTimeValue, } + tableAliasMap := make(map[string]*struct{}) for mapCondKey, tableName := range map[string]string{ "vendorStoreCond": "store_map", "courierStoreCond": "store_courier_map", @@ -269,11 +270,7 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte sqlFromParams = append(sqlFromParams, cond) sqlVendorStoreCond += " " + mapCond + " " + tableAlias + ".id IS NOT NULL" } - if keyword != "" { - keywordLike := "%" + keyword + "%" - sqlVendorStoreCond += " AND " + tableAlias + ".vendor_store_name LIKE ? " - sqlWhereParams = append(sqlWhereParams, keywordLike) - } + tableAliasMap[tableAlias] = &struct{}{} } } if sqlVendorStoreCond != "" { @@ -289,6 +286,13 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte sqlWhereParams = append(sqlWhereParams, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike) + if len(tableAliasMap) > 0 { + for k, _ := range tableAliasMap { + sqlWhere += ` OR ` + k + ".vendor_store_name LIKE ?" + sqlWhereParams = append(sqlWhereParams, keywordLike) + } + } + if keywordInt64, err2 := strconv.ParseInt(keyword, 10, 64); err2 == nil { if true { // jxutils.IsLegalMobileNumber(keywordInt64) { sqlWhere += ` OR (