Browse Source

查询店铺销量最高商品数据处理平台上架商品业务功能

multiwx
dy-hu 11 months ago
parent
commit
88dd950ff3
  1. 2
      cereshop-app/src/main/java/com/shop/cereshop/app/dao/shop/CerePlatformShopDAO.java
  2. 3
      cereshop-app/src/main/java/com/shop/cereshop/app/service/index/impl/IndexServiceImpl.java
  3. 2
      cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/CerePlatformShopService.java
  4. 4
      cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CerePlatformShopServiceImpl.java
  5. 8
      cereshop-app/src/main/resources/mybatis/mapper/shop/CerePlatformShopDAO.xml

2
cereshop-app/src/main/java/com/shop/cereshop/app/dao/shop/CerePlatformShopDAO.java

@ -35,7 +35,7 @@ public interface CerePlatformShopDAO extends BaseMapper<CerePlatformShop> {
List<RecommendShop> findRecommendShop();
RecommendShop findVolumeProductByShopId(@Param("shopId") Long shopId);
RecommendShop findVolumeProductByShopId(@Param("project") String project, @Param("shopId") Long shopId);
List<RecommendShop> findRecommendProducts();

3
cereshop-app/src/main/java/com/shop/cereshop/app/service/index/impl/IndexServiceImpl.java

@ -18,6 +18,7 @@ import com.shop.cereshop.app.service.index.IndexService;
import com.shop.cereshop.app.service.product.CereProductClassifyService;
import com.shop.cereshop.app.service.product.CereShopProductService;
import com.shop.cereshop.app.service.shop.CerePlatformShopService;
import com.shop.cereshop.app.utils.ContextUtil;
import com.shop.cereshop.commons.cache.product.ProductBo;
import com.shop.cereshop.commons.domain.buyer.CereBuyerSearch;
import com.shop.cereshop.commons.domain.buyer.CereBuyerUser;
@ -69,7 +70,7 @@ public class IndexServiceImpl implements IndexService {
if(!EmptyUtils.isEmpty(shops)){
shops.stream()
//查询该店销量最高商品数据
.peek(shop -> shop=cerePlatformShopservice.findVolumeProductByShopId(shop.getShopId()));
.peek(shop -> shop=cerePlatformShopservice.findVolumeProductByShopId(ContextUtil.getProject(), shop.getShopId()));
}
//查询好物推荐数据(销量前10商品数据)
List<RecommendShop> products=cerePlatformShopservice.findRecommendProducts();

2
cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/CerePlatformShopService.java

@ -24,7 +24,7 @@ import java.util.List;
public interface CerePlatformShopService {
List<RecommendShop> findRecommendShop();
RecommendShop findVolumeProductByShopId(Long shopId);
RecommendShop findVolumeProductByShopId(String project, Long shopId);
List<RecommendShop> findRecommendProducts();

4
cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CerePlatformShopServiceImpl.java

@ -105,8 +105,8 @@ public class CerePlatformShopServiceImpl implements CerePlatformShopService {
}
@Override
public RecommendShop findVolumeProductByShopId(Long shopId) {
return cerePlatformShopDAO.findVolumeProductByShopId(shopId);
public RecommendShop findVolumeProductByShopId(String project, Long shopId) {
return cerePlatformShopDAO.findVolumeProductByShopId(project, shopId);
}
@Override

8
cereshop-app/src/main/resources/mybatis/mapper/shop/CerePlatformShopDAO.xml

@ -238,7 +238,13 @@
LEFT JOIN (SELECT a.product_id,a.product_image from cere_product_image a,cere_shop_product b where a.product_id=b.product_id
GROUP BY a.product_id) e ON a.product_id=e.product_id
LEFT JOIN (SELECT a.sku_id,a.image from cere_sku_name a,cere_product_sku b where a.sku_id=b.sku_id GROUP BY a.sku_id) f ON c.sku_id=f.sku_id
where a.shop_id=#{shopId} and a.shelve_state=1
where a.shop_id=#{shopId}
<if test="project == 0">
and a.plat_shelve_state=1
</if>
<if test="project!=0 and project != ''">
and a.shelve_state=1
</if>
GROUP BY c.sku_id
ORDER BY SUM(c.number) DESC LIMIT 1
</select>

Loading…
Cancel
Save