- limit GetStoreSkus result by sku_name_place_bind

This commit is contained in:
gazebo
2018-09-21 07:44:55 +08:00
parent 4dd80436b9
commit b58530ecd2
2 changed files with 6 additions and 2 deletions

View File

@@ -58,7 +58,9 @@ func GetStoreSkus(storeID int, isFocused bool, keyword string, params map[string
FROM sku_name t1
JOIN sku t2 ON t1.id = t2.name_id AND t2.deleted_at = '1970-01-01 00:00:00' AND t2.status = ?
LEFT JOIN store_sku_bind t4 ON t4.sku_id = t2.id AND t4.deleted_at = '1970-01-01 00:00:00' AND t4.store_id = ?
WHERE t1.deleted_at = '1970-01-01 00:00:00'
JOIN store t3 ON t3.id = ?
LEFT JOIN sku_name_place_bind t5 ON t1.id = t5.name_id AND t3.city_code = t5.place_code
WHERE t1.deleted_at = '1970-01-01 00:00:00' AND (t1.is_global = 1 OR t5.id IS NOT NULL OR t4.status = ?)
`
if isFocused {
sql += " AND t4.sku_id IS NOT NULL"
@@ -68,6 +70,8 @@ func GetStoreSkus(storeID int, isFocused bool, keyword string, params map[string
sqlParams := []interface{}{
model.SkuStatusNormal,
storeID,
storeID,
model.SkuStatusNormal,
}
if keyword != "" {
keywordLike := "%" + keyword + "%"

View File

@@ -11,7 +11,7 @@ type StoreSkuController struct {
}
// @Title 得到商家商品信息
// @Description 得到商家商品信息,如下条件之间是与的关系
// @Description 得到商家商品信息,如下条件之间是与的关系。对于没有认领的商品,按城市限制。但对于已经认领的商品就不限制了,因为已经在平台上可售,可以操作(改价等等)
// @Param token header string true "认证token"
// @Param storeID query int true "门店ID"
// @Param isFocus query bool true "是否已关注(认领)"