From b758d04a9df46cb7d65435d6263d02e48a3081f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 27 Dec 2024 09:26:23 +0800 Subject: [PATCH] 1 --- business/jxstore/cms/store_sku.go | 18 ++++++------------ controllers/cms_store_sku.go | 2 -- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 366528324..602db9d79 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -380,16 +380,13 @@ func GetStoresSkusForStore(ctx *jxcontext.Context, storeID int, isFocus, isAct b } else if stock == 2 { sql += " AND c.stock <> 0" } - if locationCode2 != "" { - sql += " AND c.location_code = ?" - sqlParams = append(sqlParams, locationCode2) - } else if locationCode { + if locationCode { sql += " AND (c.location_code = '' OR c.location_code = 'EMPTY_VALUE') " } if keyword != "" { - sql += " AND a.name LIKE ?" - sqlParams = append(sqlParams, "%"+keyword+"%") + sql += " AND a.name LIKE ? OR c.location_code LIKE ?" + sqlParams = append(sqlParams, "%"+keyword+"%", "%"+keyword+"%") } sql += ` @@ -615,8 +612,8 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, upcs []strin } if keyword != "" { keywordLike := "%" + keyword + "%" - sql += " AND (t1.name LIKE ? OR t1.prefix LIKE ? OR t1.upc LIKE ? OR t2.comment LIKE ?" - sqlParams = append(sqlParams, keywordLike, keywordLike, keywordLike, keywordLike) + sql += " AND (t1.name LIKE ? OR t1.prefix LIKE ? OR t1.upc LIKE ? OR t2.comment LIKE ? OR t4.location_code LIKE ? " + sqlParams = append(sqlParams, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike) if keywordInt64, err2 := strconv.ParseInt(keyword, 10, 64); err2 == nil { sql += ` @@ -762,10 +759,7 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, upcs []strin sql += " AND t4.stock <= ? " sqlParams = append(sqlParams, params["maxStock"]) } - if params["locationCode"] != "" && params["locationCode"] != nil { - sql += " AND t4.location_code LIKE ? " - sqlParams = append(sqlParams, "%"+params["locationCode"].(string)+"%") - } else if params["isLocationCode"] != "" && params["isLocationCode"] != nil { + if params["isLocationCode"] != "" && params["isLocationCode"] != nil { sql += " AND (t4.location_code = '' OR t4.location_code = 'EMPTY_VALUE') " } return sql, sqlParams, err diff --git a/controllers/cms_store_sku.go b/controllers/cms_store_sku.go index a814035f7..080aaf97d 100644 --- a/controllers/cms_store_sku.go +++ b/controllers/cms_store_sku.go @@ -96,7 +96,6 @@ func (c *StoreSkuController) GetStoreSkus() { // @Param minimumPrice query string false "查询最低价" // @Param minStock query int false "最小库存" // @Param maxStock query int false "最大库存" -// @Param locationCode query string false "货架码" // @Param isLocationCode query bool false "是否有货架码" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult @@ -1017,7 +1016,6 @@ func (c *StoreSkuController) GetVendorStoreSkus() { // @Param isFocus query bool true "是否已关注(认领)" // @Param stock query int false "库存是否为0[1-全查/2-有库存/3-没库存]" // @Param locationCode query bool false "商品位置是否为空" -// @Param locationCode2 query string false "商品位置编码" // @Param keyword query string false "查询关键字(可以为空,为空表示不限制)" // @Param categoryID query int false "商品所属类别ID" // @Param status query int false "查询起始状态(0:不可售,1:可售,-1 全部)"