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.channel.MainChannel;
import com.iamberry.wechat.core.entity.page.PageRequest;
import com.iamberry.wechat.core.entity.page.PagedResult;
import com.iamberry.wechat.face.channel.MainChannelService;
import com.iamberry.wechat.service.mapper.MainChannelMapper;
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 MainChannelServiceImpl  implements MainChannelService {
    @Autowired
    private MainChannelMapper mainChannelMapper;
    /**
     * 获取集合
     * @param
     * @return List
     */
    @Override
    public PagedResult<MainChannel> getMainChannelList(PageRequest<MainChannel> pageRequest){
        PageHelper.startPage(pageRequest.getPageNO(), pageRequest.getPageSize(), pageRequest.isPageTotal());
        List<MainChannel> customerBasicList = mainChannelMapper.getMainChannelList(pageRequest.getData());
        return PageUtil.getPage(customerBasicList);
    }
    /**
     * 查询单条数据
     * @param  id
     * @return  mainChannel
     */
    @Override
    public  MainChannel  getMainChannelById(Integer  id){
        return  mainChannelMapper.getMainChannelById(id);
    }
    /**
     * 增加数据
     * @param  mainChannel
     * @return Integer
     */
    @Override
    public  Integer  save(MainChannel  mainChannel){
        return  mainChannelMapper.save(mainChannel);
    }
    /**
     * 修改数据
     * @param  mainChannel
     * @return Integer
     */
    @Override
    public  Integer  update(MainChannel  mainChannel){
        return  mainChannelMapper.update(mainChannel);
    }
}
