Commit d0e61982 by weijiguang

修复商品同是推荐、特惠重复的问题

parent bb5760ba
...@@ -64,7 +64,8 @@ public interface ShopGoodsMapper ...@@ -64,7 +64,8 @@ public interface ShopGoodsMapper
List<Goods> selectShopCategoryGoods(long shopId); List<Goods> selectShopCategoryGoods(long shopId);
List<Goods> selectShopCategoryGoodsByCategoryId(@Param("shopId") long shopId, @Param("categoryId") Long categoryId); List<Goods> selectShopCategoryGoodsByCategoryIdForOss(@Param("shopId") long shopId, @Param("categoryId") Long categoryId);
List<Goods> selectShopCategoryGoodsByCategoryIdForApp(@Param("shopId") long shopId, @Param("categoryId") Long categoryId);
void updateStatus(@Param("shopID")String shopID, @Param("goodsId") Long goodsId,@Param("machineId") String robotID,@Param("status") String s); void updateStatus(@Param("shopID")String shopID, @Param("goodsId") Long goodsId,@Param("machineId") String robotID,@Param("status") String s);
......
...@@ -130,7 +130,7 @@ public class OrderTakingServiceImpl { ...@@ -130,7 +130,7 @@ public class OrderTakingServiceImpl {
categoryVo.setId(category.getId()); categoryVo.setId(category.getId());
categoryVo.setName(category.getName()); categoryVo.setName(category.getName());
categoryVo.setIcon(category.getIcon()); categoryVo.setIcon(category.getIcon());
List<Goods> goodsList = shopGoodsMapper.selectShopCategoryGoodsByCategoryId(shopId, category.getId()); List<Goods> goodsList = shopGoodsMapper.selectShopCategoryGoodsByCategoryIdForApp(shopId, category.getId());
List<GoodsVo> goodsVoList = new ArrayList<>(); List<GoodsVo> goodsVoList = new ArrayList<>();
List<GoodsVo> selloutList = new ArrayList<>(); List<GoodsVo> selloutList = new ArrayList<>();
if (!CollectionUtils.isEmpty(goodsList)) { if (!CollectionUtils.isEmpty(goodsList)) {
......
...@@ -295,7 +295,7 @@ public class ShopServiceImpl implements IShopService { ...@@ -295,7 +295,7 @@ public class ShopServiceImpl implements IShopService {
}); });
List<GoodsCategory> shopCategories = goodsCategoryMapper.selectGoodsCategoryByIds(categoryIds); List<GoodsCategory> shopCategories = goodsCategoryMapper.selectGoodsCategoryByIds(categoryIds);
for (GoodsCategory category : shopCategories) { for (GoodsCategory category : shopCategories) {
List<Goods> goodsList = shopGoodsMapper.selectShopCategoryGoodsByCategoryId(shopId, category.getId()); List<Goods> goodsList = shopGoodsMapper.selectShopCategoryGoodsByCategoryIdForOss(shopId, category.getId());
for (Goods goods : goodsList) { for (Goods goods : goodsList) {
ShopGoodsSku shopGoodsSku = new ShopGoodsSku(); ShopGoodsSku shopGoodsSku = new ShopGoodsSku();
......
...@@ -78,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -78,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and shop_id =#{shopId} and shop_id =#{shopId}
order by sg.turn order by sg.turn
</select> </select>
<select id="selectShopCategoryGoodsByCategoryId" resultType="com.soss.system.domain.Goods"> <select id="selectShopCategoryGoodsByCategoryIdForApp" resultType="com.soss.system.domain.Goods">
select select
g.id, g.id,
g.name, g.name,
...@@ -98,10 +98,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -98,10 +98,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sr.recommend_tag sr.recommend_tag
from goods g from goods g
LEFT JOIN shop_goods sg ON g.id = sg.goods_id LEFT JOIN shop_goods sg ON g.id = sg.goods_id
LEFT JOIN shop_recommend sr ON g.id = sr.goods_id and sr.`type` = 2 LEFT JOIN shop_recommend sr ON g.id = sr.goods_id and sr.`type` = 2 and sg.shop_id = sr.shop_id
where g.state ='3' and g.is_deleted = 0 and sg.shop_id = #{shopId} and category like concat('%,', #{categoryId}, ',%') where g.state ='3' and g.is_deleted = 0 and sg.shop_id = #{shopId} and category like concat('%,', #{categoryId}, ',%')
order by isRecommend DESC,sg.turn order by isRecommend DESC,sg.turn
</select> </select>
<select id="selectShopCategoryGoodsByCategoryIdForOss" resultType="com.soss.system.domain.Goods">
select
g.id,
g.name,
g.category,
g.price,
g.discount,
g.take_time,
g.spec,
g.pics,
g.`desc`,
g.remarks,
g.shelf_at as shelfAt,
g.code,
'1' as state
from goods g
LEFT JOIN shop_goods sg ON g.id = sg.goods_id
where g.state ='3' and g.is_deleted = 0 and sg.shop_id = #{shopId} and category like concat('%,', #{categoryId}, ',%')
order by sg.turn
</select>
<select id="selectShopNoAddGoods" resultType="com.soss.system.domain.Goods"> <select id="selectShopNoAddGoods" resultType="com.soss.system.domain.Goods">
select id, name, category, price, discount, take_time, spec, pics, `desc`, remarks, state, is_deleted, created_at, updated_at, code,shelf_at from goods select id, name, category, price, discount, take_time, spec, pics, `desc`, remarks, state, is_deleted, created_at, updated_at, code,shelf_at from goods
where where
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment