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


import cn.com.countrygarden.bi.main.core.Mapper;
import cn.com.countrygarden.bi.main.model.performance.PerformanceEnv;
import cn.com.countrygarden.bi.main.model.performance.PerformanceScore;

import org.apache.ibatis.annotations.Param;



import java.util.List;
import java.util.Map;

/**
 * 指标得分
 *
 * @author leo 严明斌
 * @version 2018-4-3 16:58:32
 */

public interface PerformanceScoreMapper extends Mapper<PerformanceScore> {
    public int insertScoreList(@Param("scoreList") List<PerformanceScore> scoreList);

    public List<PerformanceScore> selectScoreList(@Param("score") PerformanceScore score);

    public PerformanceScore getByHierarchyId(@Param("score") PerformanceScore score);

    public PerformanceScore getscoreByHierarchyId(@Param("score") PerformanceScore score);

    public PerformanceScore getNewScore(@Param("score") PerformanceScore score);

    public void UpdateNewScore(@Param("score") PerformanceScore score);

    public void insertScore(@Param("score") PerformanceScore score);

    public List<PerformanceScore> selectNewScoreList(@Param("score") PerformanceScore score);

    public PerformanceScore getTotalPage(@Param("score") PerformanceScore score);

    public void UpdateNewScoretwo(@Param("score") PerformanceScore score);

    public int insertScoreSelective(PerformanceScore score);

    void updateScoreSelective(PerformanceScore score);

    /**
     * 本年度已有几个季度考核数据
     *
     * @param year 年度
     * @return int
     * @Author Geoffrey
     * @Date 2018/7/26 5:48
     */

    int selectCountQuarterByYear(@Param("year") int year);

    /**
     * 插入各区域季度总得分
     *
     * @param year    年份
     * @param quarter 季度
     * @return 无
     * @Author Geoffrey
     * @Date 2018/7/11 18:00
     */
    void insertQuarterlySumScore(@Param("year") int year, @Param("quarter") int quarter);

    /**
     * 插入城市公司季度总得分
     * @param year 年
     * @param quarter 季度
     * @author Max Date:2018/09/13
     */
    void insertQuarterlySumScoreCompany(@Param("year") int year, @Param("quarter") int quarter);

    void deleteQuarterlySumScore(@Param("year") int year, @Param("quarter") int quarter);

    List<PerformanceScore> getLastQuarterSort(@Param("element") long elementId, @Param("year") int year, @Param("quarter") int quarter);

    List<PerformanceScore> getLastQuarterSortCompany(@Param("element") long elementId, @Param("year") int year, @Param("quarter") int quarter);

    void updateNum(@Param("performanceScore") PerformanceScore performanceScore);

    //------------------以下为三期重构新增的接口 Date:2018/10/23-----------------------
    PerformanceScore selectByRecordId(long recordId);

    //删除所有指标为0和1的相关记录
    int deleteAllByRecordIds(@Param("year") int year, @Param("quarter") int quarter);

    //重构新增区域/城市总的分数
    int insertQuarterlySumScore2(@Param("year") int year, @Param("quarter") int quarter,@Param("typeNo")String typeNo);

}
