package com.hzs.sale.wares.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.common.domain.sale.wares.BdWaresSpecialPostage;
import com.hzs.sale.wares.mapper.BdWaresSpecialPostageMapper;
import com.hzs.sale.wares.service.IBdWaresSpecialPostageService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 商品特殊邮费配置 服务实现类
 */
@Service
public class BdWaresSpecialPostageServiceImpl extends ServiceImpl<BdWaresSpecialPostageMapper, BdWaresSpecialPostage> implements IBdWaresSpecialPostageService {

    @Override
    public List<Integer> querySpecialPostagePkWares(Integer pkCountry) {
        LambdaQueryWrapper<BdWaresSpecialPostage> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(BdWaresSpecialPostage::getPkCountry, pkCountry);
        List<BdWaresSpecialPostage> pkWaresList = this.list(queryWrapper);
        return pkWaresList.stream().map(BdWaresSpecialPostage::getPkPostage).collect(Collectors.toList());
    }

    @Override
    public void deleteByPkPostage(Integer pkPostage) {
        baseMapper.deleteByPkPostage(pkPostage);
    }

}
