package com.hzs.system.config.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.common.domain.system.config.BdBonusHiPink;
import com.hzs.system.config.mapper.BdBonusHiPinkMapper;
import com.hzs.system.config.service.IBdBonusHiPinkService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 嗨粉直推奖励配置 服务实现类
 * </p>
 *
 * @author zhangjing
 * @since 2022-11-03
 */
@Service
public class BdBonusHiPinkServiceImpl extends ServiceImpl<BdBonusHiPinkMapper, BdBonusHiPink> implements IBdBonusHiPinkService {

    /**
     * @description: 新增嗨粉直推奖励配置
     * @author: zhang jing
     * @date: 2022/11/3 19:54
     * @param: [bonusHiPinkList]
     * @return: boolean
     **/
    @Override
    public boolean saveBonusHiPink(List<BdBonusHiPink> bonusHiPinkList) {
        for(BdBonusHiPink bbhp : bonusHiPinkList){
            baseMapper.insert(bbhp);
        }
        return true;
    }

    /**
     * @description: 修改嗨粉直推奖励配置
     * @author: zhang jing
     * @date: 2022/11/4 9:25
     * @param: [bonusHiPinkList]
     * @return: boolean
     **/
    @Override
    public boolean updateBonusHiPink(List<BdBonusHiPink> bonusHiPinkList) {
        for(BdBonusHiPink bbhp : bonusHiPinkList){
            baseMapper.insert(bbhp);
        }
        return true;
    }

    @Override
    public List<BdBonusHiPink> queryBonusHiPink() {
        QueryWrapper<BdBonusHiPink> queryWrapper = new QueryWrapper<>();
        queryWrapper.select(" pk_country,range_type,pk_level,cal_type,bonus_value ")
                .orderByAsc("pk_country,bonus_value,range_type,pk_level");
        return baseMapper.selectList(queryWrapper);
    }
}
