package cn.com.countrygarden.bi.main.service.performance.impl;

import cn.com.countrygarden.bi.main.dao.performance.PerformanceMonthlyStatisticsMapper;
import cn.com.countrygarden.bi.main.model.performance.monthly.PerformanceMonthlyStatistics;
import cn.com.countrygarden.bi.main.service.performance.PerformanceMonthlyStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 绩效月度平均完成率
 *
 * @author Max Date:2018/09/20
 * @version 1.0
 * @since 1.8
 */
@Service
public class PerformanceMonthlyStatisticsServiceImpl implements PerformanceMonthlyStatisticsService {

    @Autowired
    private PerformanceMonthlyStatisticsMapper dao;

    @Override
    public int deleteByPrimaryKey(Long pmsId) {
        return dao.deleteByPrimaryKey(pmsId);
    }

    @Override
    public int insertSelective(PerformanceMonthlyStatistics record) {
        return dao.insertSelective(record);
    }

    @Override
    public PerformanceMonthlyStatistics selectByPrimaryKey(Long pmsId) {
        return dao.selectByPrimaryKey(pmsId);
    }

    @Override
    public int updateByPrimaryKeySelective(PerformanceMonthlyStatistics record) {
        return dao.updateByPrimaryKeySelective(record);
    }

    //得到当前指标的最后月份
    @Override
    public Integer selectMaxMonth(long elementId, int year) {
        return dao.selectMaxMonth(elementId, year);
    }

    //根据年/月/指标得到唯一一条数据
    @Override
    public PerformanceMonthlyStatistics getAverage(long elementId, int year, int month) {
        return dao.getAverage(elementId, year, month);
    }
}
