package com.iamberry.wechat.service.receive;

import com.github.pagehelper.PageHelper;
import com.iamberry.wechat.core.entity.PaperBean;
import com.iamberry.wechat.core.entity.integral.UseIntegral;
import com.iamberry.wechat.core.entity.page.PageRequest;
import com.iamberry.wechat.core.entity.page.PagedResult;
import com.iamberry.wechat.core.entity.receive.ChargerReceive;
import com.iamberry.wechat.face.receive.ChargReceiveService;
import com.iamberry.wechat.service.mapper.ChargerReceiveMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import util.PageUtil;

import java.util.List;

@Service("ChargReceiveServiceImpl")
public class ChargReceiveServiceImpl implements ChargReceiveService {

    @Autowired
    private ChargerReceiveMapper chargerReceiveMapper;

    @Autowired ChargReceiveService chargReceiveService;

    @Override
    public int insert(ChargerReceive record) {
        return chargerReceiveMapper.insert(record);
    }

//    @Override
//    public int insertSelective(ChargerReceive record) {
//        return chargerReceiveMapper.insertSelective(record);
//    }

    @Override
    public ChargerReceive selectByPrimaryKey(Integer receiveId) {
        return chargerReceiveMapper.selectByPrimaryKey(receiveId);
    }

    @Override
    public ChargerReceive selectByOrderId(String orderId) {
        return chargerReceiveMapper.selectByOrderId(orderId);
    }

    @Override
    public int updateByPrimaryKeySelective(ChargerReceive record) {
        return chargerReceiveMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int ship(ChargerReceive record) {
        return chargerReceiveMapper.ship(record);
    }

    @Override
    public int updateByOrderId(ChargerReceive record) {
        return chargerReceiveMapper.updateByOrderId(record);
    }

    @Override
    public List<ChargerReceive> getChargerReceiveList(ChargerReceive chargerReceive) {
        return chargerReceiveMapper.listChargerReceive(chargerReceive);
    }

    @Override
    public PagedResult<ChargerReceive> listChargerReceive(PageRequest<ChargerReceive> pageRequest) {
        PageHelper.startPage(pageRequest.getPageNO(), pageRequest.getPageSize(), pageRequest.isPageTotal());
        List<ChargerReceive> detedctList = chargerReceiveMapper.listChargerReceive(pageRequest.getData());
        return PageUtil.getPage(detedctList);
    }

    @Override
    public PagedResult<ChargerReceive> listAdminChargerReceive(PageRequest<ChargerReceive> pageRequest) {
        PageHelper.startPage(pageRequest.getPageNO(), pageRequest.getPageSize(), pageRequest.isPageTotal());
        List<ChargerReceive> detedctList = chargerReceiveMapper.listAdminChargerReceive(pageRequest.getData());
        return PageUtil.getPage(detedctList);
    }

    @Override
    public Integer getApparatusNumber(String openId) {
        return chargerReceiveMapper.getApparatusNumber(openId);
    }

}
