package com.iamberry.wechat.service.channel;
import com.github.pagehelper.PageHelper;
import com.iamberry.wechat.core.entity.channel.ChildChannel;
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.ChildChannelService;
import com.iamberry.wechat.service.mapper.ChildChannelMapper;
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 ChildChannelServiceImpl  implements ChildChannelService {
    @Autowired
    private ChildChannelMapper childChannelMapper;
    /**
     * 获取集合
     * @param
     * @return List
     */
    @Override
    public PagedResult<ChildChannel> getChildChannelList(PageRequest<ChildChannel> pageRequest){
        PageHelper.startPage(pageRequest.getPageNO(), pageRequest.getPageSize(), pageRequest.isPageTotal());
        List<ChildChannel> customerBasicList = childChannelMapper.getChildChannelList(pageRequest.getData());
        return PageUtil.getPage(customerBasicList);
    }
    /**
     * 查询单条数据
     * @param  id
     * @return  childChannel
     */
    @Override
    public  ChildChannel  getChildChannelById(Integer  id){
        return  childChannelMapper.getChildChannelById(id);
    }
    /**
     * 增加数据
     * @param  childChannel
     * @return Integer
     */
    @Override
    public  Integer  save(ChildChannel childChannel){
        return  childChannelMapper.save(childChannel);
    }
    /**
     * 修改数据
     * @param  childChannel
     * @return Integer
     */
    @Override
    public  Integer  update(ChildChannel  childChannel){
        return  childChannelMapper.update(childChannel);
    }
}
