package com.iamberry.wechat.service.report;

import com.github.pagehelper.PageHelper;
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.core.entity.report.Report;
import com.iamberry.wechat.face.report.ReportService;
import com.iamberry.wechat.service.mapper.ReportMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import util.PageUtil;

import java.util.List;

/**
 *  优惠券领取使用，注册人数统计接口
 * @author Administrator
 * @Date 2018-04-20
 */
@Service
public class ReportServiceImpl  implements ReportService {
    @Autowired
    private ReportMapper reportMapper;

    @Override
    public PagedResult<Report> listAdminReport(PageRequest<Report> pageRequest) {
        PageHelper.startPage(pageRequest.getPageNO(), pageRequest.getPageSize(), pageRequest.isPageTotal());
        List<Report> detedctList = reportMapper.getReportList(pageRequest.getData());
        return PageUtil.getPage(detedctList);
    }

    /**
     * 获取集合
     * @param  report
     * @return List
     */
    @Override
    public List<Report> getReportList(Report  report){
        return  reportMapper.getReportList(report);
    }
    /**
     * 查询单条数据
     * @param  id
     * @return  report
     */
    @Override
    public  Report  getReportById(Integer  id){
        return  reportMapper.getReportById(id);
    }
    /**
     * 增加数据
     * @param  report
     * @return Integer
     */
    @Override
    public  Integer  save(Report  report){
        return  reportMapper.save(report);
    }
    /**
     * 修改数据
     * @param  report
     * @return Integer
     */
    @Override
    public  Integer  update(Report  report){
        return  reportMapper.update(report);
    }
    /**
     * 删除数据
     * @param  id
     * @return Integer
     */
    @Override
    public  Integer  delete(Integer  id){
        return  reportMapper.delete(id);
    }
}
