huanghongfa
2021-04-17 eb261d529b71f922cb78971ab0b329f6c323a9bf
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java
@@ -8,6 +8,8 @@
import com.panzhihua.common.model.dtos.shop.PageComShopStoreDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.shop.ComShopStoreVO;
import com.panzhihua.service_community.dao.ComShopGoodsDAO;
import com.panzhihua.common.model.vos.shop.ComShopStoreVO;
import com.panzhihua.common.model.vos.shop.ShopGoodsVO;
import com.panzhihua.common.model.vos.shop.ShopStoreVO;
import com.panzhihua.service_community.dao.ComShopStoreDAO;
@@ -18,6 +20,8 @@
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
 * @auther lyq
 * @create 2021-04-14 15:03:55
@@ -26,11 +30,45 @@
@Slf4j
@Service
public class ComShopStoreServiceImpl extends ServiceImpl<ComShopStoreDAO, ComShopStoreDO> implements ComShopStoreService {
    @Resource
    private ComShopGoodsDAO shopGoodsDAO;
    /**
     * 查询店铺列表
     * @param comShopStoreDTO   请求参数
     * @return  店铺列表
     */
    @Override
    public R pageStoreList(PageComShopStoreDTO pageComShopStoreDTO) {
        Page page = new Page<>(pageComShopStoreDTO.getPageNum(), pageComShopStoreDTO.getPageSize());
        IPage<ComShopStoreVO> comShopStoreVOIPage = this.baseMapper.pageShopStore(page, pageComShopStoreDTO);
        return R.ok(comShopStoreVOIPage);
    public R pageStoreList(PageComShopStoreDTO comShopStoreDTO){
        Page page = new Page<>(comShopStoreDTO.getPageNum(),comShopStoreDTO.getPageSize());
        return R.ok(this.baseMapper.pageShopStore(page,comShopStoreDTO));
    }
    /**
     * 查询店铺详情
     * @param comShopStoreDTO   请求参数
     * @return  店铺详情
     */
    @Override
    public R shopStoreDetail(PageComShopStoreDTO comShopStoreDTO) {
        //查询店铺
        ComShopStoreDO storeDO = this.baseMapper.selectById(comShopStoreDTO.getStoreId());
        if (storeDO == null) {
            return R.fail(401,"店铺不存在");
        }
        if(storeDO.getStatus().equals(ComShopStoreDO.status.no)){
            return R.fail(402,"店铺已被禁用");
        }
        ComShopStoreVO shopStoreVO = new ComShopStoreVO();
        BeanUtils.copyProperties(storeDO, shopStoreVO);
        //查询店铺下商品信息
        Page page = new Page<>(comShopStoreDTO.getPageNum(), comShopStoreDTO.getPageSize());
        shopStoreVO.setGoodsList(shopGoodsDAO.pageShopGoodsByStoreId(page, comShopStoreDTO).getRecords());
        return R.ok(shopStoreVO);
    }
    @Override