huanghongfa
2021-04-20 6ac0849d13ec2f178b2daa6cd3e63bbe9fdde596
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java
@@ -6,11 +6,11 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.panzhihua.common.model.dtos.shop.PageComShopStoreDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.shop.*;
import com.panzhihua.common.model.vos.shop.PageShopStoreVO;
import com.panzhihua.common.model.vos.shop.PageShopStoreVO;
import com.panzhihua.service_community.dao.ComShopGoodsAttrDAO;
import com.panzhihua.service_community.dao.ComShopGoodsDAO;
import com.panzhihua.common.model.vos.shop.PageShopStoreVO;
import com.panzhihua.common.model.vos.shop.ShopStoreVO;
import com.panzhihua.service_community.dao.ComShopStoreDAO;
import com.panzhihua.service_community.model.dos.ComShopStoreDO;
import com.panzhihua.service_community.service.ComShopStoreService;
@@ -19,6 +19,7 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
 * @auther lyq
@@ -31,6 +32,8 @@
    @Resource
    private ComShopGoodsDAO shopGoodsDAO;
    @Resource
    private ComShopGoodsAttrDAO comShopGoodsAttrDAO;
    /**
     * 查询店铺列表
@@ -67,8 +70,18 @@
        //查询店铺下商品信息
        Page page = new Page<>(comShopStoreDTO.getPageNum(), comShopStoreDTO.getPageSize());
        shopStoreVO.setGoodsList(shopGoodsDAO.pageShopGoodsByStoreId(page, comShopStoreDTO).getRecords());
        List<ComShopGoodsVO> goodsList = shopGoodsDAO.pageShopGoodsByStoreId(page, comShopStoreDTO).getRecords();
        if(!goodsList.isEmpty()){
            //查询商品规格列表
            goodsList.forEach(goods -> {
                List<ComShopGoodsAttrVO> goodsAttrList = comShopGoodsAttrDAO.getGoodsAttr(goods.getId());
                if(!goodsAttrList.isEmpty()){
                    goods.setGoodsAttrList(goodsAttrList);
                }
            });
        }
        shopStoreVO.setGoodsList(goodsList);
        return R.ok(shopStoreVO);
    }
@@ -105,10 +118,12 @@
    @Override
    public R deleteStore(Long[] id) {
        LambdaQueryWrapper<ComShopStoreDO> query = new LambdaQueryWrapper<ComShopStoreDO>().in(ComShopStoreDO::getId, id);
        ComShopStoreDO comShopStoreDO = this.baseMapper.selectOne(query);
        comShopStoreDO.setDeleteStatus(2);
        int update = this.baseMapper.updateById(comShopStoreDO);
        return update > 0 ? R.ok() : R.fail();
        List<ComShopStoreDO> comShopStoreDO = this.baseMapper.selectList(query);
        for (ComShopStoreDO shopStoreDO:comShopStoreDO) {
            shopStoreDO.setDeleteStatus(2);
            int update = this.baseMapper.updateById(shopStoreDO);
        }
        return R.ok();
    }
    @Override