package cn.com.countrygarden.bi.main.dao.performance;

import cn.com.countrygarden.bi.main.model.performance.monthly.PerformanceMonthlyStatistics;
import org.apache.ibatis.annotations.Param;

/**
 * 绩效月度平均完成率
 *
 * @author Max Date:2018/09/20
 * @version 1.0
 * @since 1.8
 */
public interface PerformanceMonthlyStatisticsMapper {
    int deleteByPrimaryKey(Long pmsId);

    int insertSelective(PerformanceMonthlyStatistics record);

    PerformanceMonthlyStatistics selectByPrimaryKey(Long pmsId);

    int updateByPrimaryKeySelective(PerformanceMonthlyStatistics record);

    //删除表中 年/月/指标 记录
    int deleteAverage(@Param(value = "year") int year, @Param(value = "month") int month);

    //重新计算 年/月/指标 指标平均完成率
    int insertMonthlyAverageScore(@Param(value = "year") int year, @Param(value = "month") int month);

    //得到当前指标的最后月份
    Integer selectMaxMonth(@Param(value = "elementId") long elementId, @Param(value = "year") int year);

    //根据年/月/指标得到唯一一条数据
    PerformanceMonthlyStatistics getAverage(@Param(value = "elementId") long elementId, @Param(value = "year") int year, @Param(value = "month") int month);

}