package com.cxyxiaomo.epp.access.service;

import com.cxyxiaomo.epp.access.dao.ReportDao;
import com.cxyxiaomo.epp.common.pojo.Report;
import com.cxyxiaomo.epp.common.query.ReportQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReportServiceImpl implements ReportService {

    @Autowired
    ReportDao reportDao;

    @Override
    public void addRecord(Report report) {
        reportDao.insert(report);
    }

    public void removeRecord(Integer id) {
        if (id != null) {
            reportDao.remove(id);
        }
    }

    @Override
    public List<Report> getRecordListByUserId(Integer userId) {
        return reportDao.getReportListByUserId(userId);
    }

    @Override
    public Report getLatestRecordByUserId(Integer userId) {
        return reportDao.getLatestReportByUserId(userId);
    }


    public List<Report> getReportList(ReportQuery reportQuery) {
        List<Report> reportList = reportDao.getReportList(reportQuery);
        return reportList;
    }
}
