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

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.common.core.constant.SystemFieldConstants;
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;

/**
 * <p>
 * 商品特殊邮费配置 服务实现类
 * </p>
 *
 * @author hzs
 * @since 2023-10-27
 */
@Service
public class BdWaresSpecialPostageServiceImpl extends ServiceImpl<BdWaresSpecialPostageMapper, BdWaresSpecialPostage> implements IBdWaresSpecialPostageService {

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

    /**
     * 根据邮费主键删除邮费配置信息
     * @param pkPostage
     */
    @Override
    public void deleteByPkPostage(Integer pkPostage) {
        baseMapper.deleteByPkPostage(pkPostage);
    }

}
