package com.iamberry.wechat.service.channel;

import com.github.pagehelper.PageHelper;
import com.iamberry.wechat.core.entity.channel.ChannelRebate;
import com.iamberry.wechat.core.entity.page.PageRequest;
import com.iamberry.wechat.core.entity.page.PagedResult;
import com.iamberry.wechat.face.channel.ChannelRebateService;
import com.iamberry.wechat.service.mapper.ChannelRebateMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import util.PageUtil;

import java.util.List;

/**
 *  上朵分销返利记录接口
 * @author xm
 * @Date 2018-07-23
 */
@Service
public class ChannelRebateServiceImpl  implements ChannelRebateService {
    @Autowired
    private ChannelRebateMapper channelRebateMapper;
    /**
     * 获取集合
     * @param
     * @return List
     */
    @Override
    public PagedResult<ChannelRebate> getChannelRebateList(PageRequest<ChannelRebate> pageRequest) {
        PageHelper.startPage(pageRequest.getPageNO(), pageRequest.getPageSize(), pageRequest.isPageTotal());
        List<ChannelRebate> customerBasicList = channelRebateMapper.getChannelRebateList(pageRequest.getData());
        return PageUtil.getPage(customerBasicList);
    }

    @Override
    public List<ChannelRebate> listChannelRebate(ChannelRebate channelRebate) {
        return channelRebateMapper.getChannelRebateList(channelRebate);
    }

    /**
     * 查询单条数据
     * @param  id
     * @return  channelRebate
     */
    @Override
    public  ChannelRebate  getChannelRebateById(Integer  id){
        return  channelRebateMapper.getChannelRebateById(id);
    }
    /**
     * 增加数据
     * @param  channelRebate
     * @return Integer
     */
    @Override
    public  Integer  save(ChannelRebate  channelRebate){
        return  channelRebateMapper.save(channelRebate);
    }
    /**
     * 修改数据
     * @param  channelRebate
     * @return Integer
     */
    @Override
    public  Integer  update(ChannelRebate  channelRebate){
        return  channelRebateMapper.update(channelRebate);
    }

    @Override
    public Integer updateRebackStatus(ChannelRebate channelRebate) {
        return channelRebateMapper.updateRebackStatus(channelRebate);
    }

    @Override
    public Integer getChannelRebateSum(ChannelRebate channelRebate) {
        return channelRebateMapper.getChannelRebateSum(channelRebate);
    }
}