package com.gx.obe.server.management.evaluation.dao;

import java.math.BigDecimal;
import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gx.obe.server.management.evaluation.entity.EvaluationFactor;

/**
 * @author
 * @version V1.0
 * @Title: EvaluationFactor
 * @Package com.gx.obe.server.management.evaluation.entity
 * @Description: EvaluationFactorMapper 接口
 * @author: XiaoMa Pro - myzhichao@163.com
 * @date: 2019-05-17
 * @Copyright: 2019 www.msypro.com Inc. All rights reserved.
 */
@Mapper
public interface EvaluationFactorMapper extends BaseMapper<EvaluationFactor> {

    /**
     * @param ObeEvaluationFactorList
     * @Description: 批量插入
     * @author mazc
     */
    Integer insertByBatch(@Param("ObeEvaluationFactorList") List<EvaluationFactor> ObeEvaluationFactorList);

    /**
     * @param tenderId
     * @param auditType
     * @return
     * @Description: 按分类删除指标
     * @author mazc
     */
    Integer delEvaluationFactorByType(@Param("tenderId") String tenderId, @Param("auditType") String auditType);

    /**
     * @param evaluationFactor
     * @return
     * @Description: 批量跟新非空字段
     * @author mazc
     */
    Integer updateEvaluationFactorBatchList(@Param("ObeEvaluationFactorList") List<EvaluationFactor> evaluationFactor);

    /**
     * @param tenderId
     * @param factorId
     * @return
     * @Description: 验证是否已经存在投标总报价价格指标
     * @author chenxw
     */
    Integer hasTotalBidPriceFactor(@Param("tenderId") String tenderId, @Param("factorId") String factorId);

    /**
     * @param tenderId
     * @param stepId
     * @return
     * @Description: 获得指定评标步骤的评审指标
     * @author mazc
     */
    List<EvaluationFactor> getEvaluationStepFactorList(@Param("tenderId") String tenderId, @Param("stepId") String stepId);

    /**
     * @param tenderId
     * @param userId
     * @return
     * @Description: 获得专家评审要素分组指标
     * @author mazc
     */
    List<String> getEvalGroupEvaluationList(@Param("tenderId") String tenderId, @Param("userId") String userId);

    /**
     * @param tenderId
     * @param auditType
     * @param parentId
     * @return
     * @Description: 获得指标的最大序号
     * @author chenxw
     */
    Integer getMaxEvaluationFactorSortNo(@Param("tenderId") String tenderId, @Param("auditType") String auditType, @Param("parentId") String parentId);
    
    /**
     * @param tenderId
     * @param auditType
     * @param parentId
     * @return
     * @Description: 获得指标的数量
     * @author chenxw
     */
    Integer getFactorCount(@Param("tenderId") String tenderId, @Param("auditType") String auditType);


    /**
     * @param tenderId
     * @param auditType
     * @param stepId
     * @param stepId
     * @return
     * @Description: 获得可为评标步骤分配置的指标
     * @author chenxw
     */
    List<EvaluationFactor> getFactorListOfEvaluationStep(@Param("tenderId") String tenderId, @Param("auditType") String auditType, @Param("stepType") String stepType, @Param("stepId") String stepId);


    /**
     * @param tenderId
     * @param stepId
     * @return
     * @Description: 获得父级评审指标分值
     * @author chenxw
     */
    BigDecimal getEvalNodeParenFactorScore(@Param("tenderId") String tenderId, @Param("stepId") String stepId);


    /**
     * @param tenderId
     * @param userId
     * @param supplierId
     * @param stepId
     * @param auditType
     * @return
     * @Description: 获得指定专家对投标人的评标结果
     * @author chenxw
     */
    List<EvaluationFactor> getEvaluationFactorResultList(@Param("tenderId") String tenderId, @Param("userId") String userId, @Param("supplierId") String supplierId, @Param("stepId") String stepId, @Param("auditType") String auditType);


    /**
     * @param tenderId
     * @param auditType
     * @return
     * @Description: 获得指定指标类形的权重
     * @author chenxw
     */
    BigDecimal getWeightByAuditType(@Param("tenderId") String tenderId, @Param("auditType") String auditType);


    /**
     * @param sourceId
     * @param targetId
     * @Description: 交换两个指标的排序
     * @author chenxw
     */
    Integer changeEvaluationFactorSortNo(@Param("sourceId") String sourceId, @Param("targetId") String targetId);

    /**
     * @param tenderId
     * @param stepId
     * @return
     * @Description: 根据步骤id获取权重
     * @author chenxw
     */
    BigDecimal getWeightByStepId(@Param("tenderId") String tenderId, @Param("stepId") String stepId);

    /**
     * @param tenderId
     * @param stepId
     * @param weightScore
     * @return
     * @Description: 根据步骤id获取得分
     * @author chenxw
     */
    BigDecimal getScoreByStepId(@Param("tenderId") String tenderId, @Param("stepId") String stepId, @Param("weightScore") boolean weightScore);

    /**
     * @param tenderId
     * @param auditType
     * @param weightScore
     * @return
     * @Description: 获得指定指标类形的得分
     * @author chenxw
     */
    BigDecimal getScoreByAuditType(@Param("tenderId") String tenderId, @Param("auditType") String auditType, @Param("weightScore") boolean weightScore);

    /**
     * @param ObeEvaluationFactor
     * @param attributes
     * @Description: 指定字段修改
     * @author chenxw
     */
    Integer updateAssignProperty(@Param("ObeEvaluationFactor") EvaluationFactor ObeEvaluationFactor, @Param("attributes") String[] attributes);

    /**
     * @param ObeEvaluationFactorList
     * @param attributes
     * @Description: 批量指定字段修改
     * @author chenxw
     */
    Integer batchUpdateProperty(@Param("ObeEvaluationFactorList") List<EvaluationFactor> ObeEvaluationFactorList, @Param("attributes") String[] attributes);

}