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

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.EvaluationStep;

/**
 * @Description:
 * @author mazc
 */
@Mapper
public interface EvaluationStepMapper extends BaseMapper<EvaluationStep> {
    
    EvaluationStep selectEvaluationStepByFactor(@Param("tenderId") String tenderId, @Param("factorId") String factorId);
    
    /**
     * @Description: 获得评审要素下可评审的评标步骤
     * @author mazc
     * @param tenderId
     * @param evalGroup
     * @return
     */
    List<String> findEvalGroupEvalStepList(@Param("tenderId") String tenderId, @Param("evalGroup") String evalGroup);
    
    /**
     * @Description: 获得指定评标步骤以前未评审的节点
     * @author mazc
     * @param tenderId
     * @param sortNo
     * @return
     */
    EvaluationStep findPreNoStarEvaluationStep(@Param("tenderId") String tenderId, @Param("sortNo") int sortNo);
    
    /**
     * @Description: 批量插入
     * @author mazc
     * @param ObeEvaluationStepList
     */
    Integer updateBatchList(@Param("ObeEvaluationStepList") List<EvaluationStep> ObeEvaluationStepList);
    
    /**
     * @Description: 批量插入
     * @author mazc
     * @param ObeEvaluationStepList
     */
    Integer insertByBatch(@Param("ObeEvaluationStepList") List<EvaluationStep> ObeEvaluationStepList);
    
    /**
     * @Description: 进度状态
     * @author mazc
     * @param stepStatus
     * @param stepId
     * @return
     */
    Integer updateEvaluateStatus(@Param("stepStatus") String stepStatus, @Param("stepId") String stepId);
    
    /**
     * @Description: 重新开始评审 将所有评标步骤的状态改为未评审
     * @author mazc
     * @param tenderId
     * @return
     */
    Integer updateRestartEvaluation(@Param("tenderId") String tenderId);
    
    /**
     * @Description: 获得评标步骤的最大序号
     * @author chenxw
     * @param tenderId
     * @return
     */
    Integer getMaxEvaluationStepSortNo(@Param("tenderId") String tenderId);
    
    /**
     * @Description: 交换评审结点的顺序
     * @author chenxw
     * @param sourceId
     * @param targetId
     * @return
     */
    Integer changeEvaluationStepSortNo(@Param("sourceId") String sourceId, @Param("targetId") String targetId);
    
    /**
     * @Description: 更新添加步骤后后面步骤+1
     * @author chenxw
     * @param tenderId
     * @param maxComplateIndex
     */
    Integer updateSortNo(@Param("tenderId") String tenderId, @Param("maxComplateIndex") int maxComplateIndex);
    
    /**
     * @Description: 获得已完成步骤最大编号
     * @author chenxw
     * @param tenderId
     * @param stepStatus
     * @return
     */
    Integer getMAXStepCount(@Param("tenderId") String tenderId, @Param("stepStatus") String stepStatus);
    
    /**
     * @Description: 根据项目评审点id查询当前评审点所属评标步骤
     * @author chenxw
     * @param tenderId
     * @param factorId
     * @return
     */
    EvaluationStep getEvaluationStepByFactorId(@Param("tenderId") String tenderId, @Param("factorId") String factorId);
    
    /**
     * @Description: 根据项目id,专家用户id(userId)查找当前专家所拥有的评标步骤
     * @author chenxw
     * @param tenderId
     * @param userId
     * @return
     */
    List<EvaluationStep> getEvaluationStepByUserId(@Param("tenderId") String tenderId, @Param("userId") String userId);
    
    /**
     * @Description: 通过指标获得该指标所在的评标步骤
     * @author chenxw
     * @param tenderId
     * @param factorId
     * @return
     */
    EvaluationStep getEvaluationStepByFactor(@Param("tenderId") String tenderId, @Param("factorId") String factorId);
    
    /**
     * @Description: 获得存在评审不通过投标人的评标步骤
     * @author chenxw
     * @param tenderId
     * @return
     */
    List<EvaluationStep> getDisAccessmentNode(@Param("tenderId") String tenderId, @Param("UNQUALIFIED") String UNQUALIFIED, @Param("FILTER_YES") String FILTER_YES);
    
    /**
     * @Description: 获得最后一个评标步骤
     * @author chenxw
     * @param tenderId
     * @return
     */
    EvaluationStep getLastEvaluationStep(@Param("tenderId") String tenderId);
    
    /**
     * @Description: 重新授权评标步骤,并重新授权推荐
     * @author chenxw
     * @param tenderId
     * @param sortNo
     * @param isFilter
     */
    Integer reBackEvaluationStep(@Param("tenderId") String tenderId, @Param("nodeSortNo") Integer sortNo, @Param("isFilter") boolean isFilter, @Param("RE_OPERATOR") String RE_OPERATOR, @Param("RECOMMONED") String RECOMMONED, @Param("COMPLETE") String COMPLETE, @Param("IN_PROGRESS") String IN_PROGRESS, @Param("PRICE") String PRICE);
    
    /**
     * @Description: 获取完成商务技术评审 数量
     * @author chenxw
     * @param tenderId
     * @return
     */
    Integer getComplateBusAndTecEvaluationCount(String tenderId, String EVAL_BID_BUS, String EVAL_BID_TEC, String EVAL_BID_DETAIL, String COMPLETE);
    
    /**
     * @Description: 指定字段修改
     * @author chenxw
     * @param ObeEvaluationStep
     */
    Integer updateAssignProperty(@Param("ObeEvaluationStep") EvaluationStep ObeEvaluationStep, @Param("attributes") String[] attributes);
    
    /**
     * @Description: 批量指定字段修改
     * @author chenxw
     * @param ObeEvaluationStepList
     */
    Integer batchUpdateProperty(@Param("ObeEvaluationStepList") List<EvaluationStep> ObeEvaluationStepList, @Param("attributes") String[] attributes);
    
}