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

import java.util.Date;
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.expert.entity.ExpertEntity;
import com.gx.obe.server.management.expert.entity.ExpertEvaluationStep;

/**
 * @Description:
 * @author mazc
 */
@Mapper
public interface ExpertEvaluationStepMapper extends BaseMapper<ExpertEvaluationStep> {
    
    /**
     * @Description: 批量插入
     * @author mazc
     * @param ObeExpertEvaluationStepList
     */
    Integer updateBatchList(@Param("ObeExpertEvaluationStepList") List<ExpertEvaluationStep> expertEvaluationStepList);
    
    /**
     * @Description: 批量插入
     * @author mazc
     * @param ObeExpertEvaluationStepList
     */
    Integer insertByBatch(@Param("ObeExpertEvaluationStepList") List<ExpertEvaluationStep> expertEvaluationStepList);
    
    /**
     * @Description: 指定字段修改
     * @author chenxw
     * @param ObeExpertEvaluationStep
     */
    Integer updateAssignProperty(@Param("ObeExpertEvaluationStep") ExpertEvaluationStep ObeExpertEvaluationStep, @Param("attributes") String[] attributes);
    
    /**
     * @Description: 批量指定字段修改
     * @author chenxw
     * @param ObeExpertEvaluationStepList
     */
    Integer batchUpdateProperty(@Param("ObeExpertEvaluationStepList") List<ExpertEvaluationStep> ObeExpertEvaluationStepList, @Param("attributes") String[] attributes);
    
    /**
     * @Description: 检查是否存在专家的评审进度
     * @author mazc
     * @param tenderId
     * @param stepId
     * @param userId
     * @return
     */
    Integer isExistExpertEvaluationStep(@Param("tenderId") String tenderId, @Param("stepId") String stepId, @Param("userId") String userId);
    
    /**
     * @Description: 修改专家对当前评标步骤的评审进度
     * @author mazc
     * @param status
     * @param endTime
     * @param tenderId
     * @param stepId
     * @param userId
     * @return
     */
    Integer updateExpertEvaluationStepStatus(@Param("status") String status, @Param("endTime") Date endTime, @Param("tenderId") String tenderId, @Param("stepId") String stepId, @Param("userId") String userId);
    
    /**
     * @Description: 获取某一评标步骤评标专家评审完成的数量
     * @author mazc
     * @param tenderId
     * @param stepId
     * @return
     */
    Integer getExpertEvaluationComplateCount(@Param("tenderId") String tenderId, @Param("stepId") String stepId);
    
    /**
     * @Description: 删除步骤节点删除一个或多个用户数据
     * @author mazc
     * @param tenderId
     * @param stepId
     * @param userIdList
     * @return
     */
    Integer deleteEvaluationResultAndUserId(@Param("tenderId") String tenderId, @Param("stepId") String stepId, @Param("userIdList") List<String> userIdList);
    
    /**
     * @Description: 删除专家的评标步骤 \重新开始评审
     * @author mazc
     * @param tenderId
     * @return
     */
    Integer deleteRestartEvaluation(@Param("tenderId") String tenderId);
    
    /**
     * @Description: 重新开始评审 修改专家的评标步骤为未开始
     * @author mazc
     * @param tenderId
     * @return
     */
    Integer updateRestartEvaluation(@Param("tenderId") String tenderId);
    
    /**
     * @Description: 获得评审成员对指定项目的指定序号的评标步骤
     * @author wangxiang
     * @param tenderId
     * @param stepId
     * @param userId
     * @return
     */
    ExpertEvaluationStep getExpertEvaluationStepBySort(@Param("tenderId") String tenderId, @Param("sort") int sort, @Param("userId") String userId);
    
    /**
     * @Description: 获得专家确认修正评标价结果列表
     * @author guoyr
     * @param tenderId
     * @param stepId
     * @return
     */
    List<ExpertEvaluationStep> getEvalPriceConfirmList(@Param("tenderId") String tenderId, @Param("stepId") String stepId, @Param("signType") String signType);
    
    /**
     * @Description: 授权任何节点操作时都重新授权推荐评标步骤
     * @author wangxiang
     * @param stepStatus
     * @param tenderId
     * @param stepType
     * @param inProgress
     * @param complete
     * @param ifFilter
     * @param nodeSortNo
     * @return
     */
    Integer reStartRecommendStep(@Param("stepStatus") String stepStatus, @Param("tenderId") String tenderId, @Param("stepType") String stepType, @Param("priceStepType") String priceStepType, @Param("inProgress") String inProgress, @Param("complete") String complete, @Param("ifFilter") boolean ifFilter, @Param("sortNo") int nodeSortNo);
    
    /**
     * @Description: 获得步骤下已经评审完毕的专家
     * @author wangxiang
     * @param tenderId
     * @param stepId
     * @return
     */
    List<ExpertEntity> getExpertListByStepFinish(@Param("stepStatus") String tenderId, @Param("stepId") String stepId, @Param("stepStatus") String stepStatus);
    
    /**
     * @Description: 获得当前评标步骤之前未完成评审的个数
     * @author wangxiang
     * @param tenderId
     * @param userId
     * @param curStepIndex
     * @return
     */
    Integer getNotComplateStepCount(@Param("tenderId") String tenderId, @Param("userId") String userId, @Param("curStepIndex") int curStepIndex, @Param("stepStatus") String stepStatus);
    
    List<ExpertEvaluationStep> getExpertEvaluationStepByStepTypeAndStepStatus(@Param("tenderId") String tenderId, @Param("stepType") String stepType, @Param("stepStatus") String stepStatus);
    
    /**
     * @Description: 根据步骤类型和步骤状态获取专家评审步骤列表
     * @author chenxw
     * @param tenderId
     * @param stepType
     * @return
     */
    List<ExpertEvaluationStep> getExpertEvaluationStepByStepType(@Param("tenderId") String tenderId, @Param("stepType") String stepType);

    /**
     * @Description: 根据步骤类型删除专家评审步骤
     * @author chenxw
     * @param tenderId
     * @param stepType
     * @return
     */
    Integer deleteExpertEvaluationStepByStepType(@Param("tenderId") String tenderId, @Param("stepType") String stepType);
}