package com.lz.modules.sys.dao.app;
/**
 * <p>
 * 业绩记录表 服务类
 * </p>
 *
 * @author quyixiao
 * @since 2020-08-10
 */

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lz.modules.app.dto.GraphicsStatisticalDto;
import com.lz.modules.app.dto.ReportProgressListDto;
import com.lz.modules.app.req.ReportListReq;
import com.lz.modules.app.req.ResultRecordReq;
import com.lz.modules.app.resp.OwnResultResp;
import com.lz.modules.flow.model.ResultRecordDto;
import com.lz.modules.performance.dto.LevelDetailExportDto;
import com.lz.modules.performance.dto.ToScoreDingTalkDto;
import com.lz.modules.performance.req.AssessDetailReq;
import com.lz.modules.performance.req.OwnResultReq;
import com.lz.modules.performance.res.AssessManagerDetailRes;
import com.lz.modules.performance.res.ChartStatistical;
import com.lz.modules.performance.res.LevelDetailExportRes;
import com.lz.modules.sys.entity.app.ResultRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

@Mapper
public interface ResultRecordMapper extends BaseMapper<ResultRecord> {


    ResultRecord selectResultRecordById(@Param("id") Long id);


    Long insertResultRecord(ResultRecord resultRecord);


    int updateResultRecordById(ResultRecord resultRecord);


    int updateCoverResultRecordById(ResultRecord resultRecord);


    int deleteResultRecordById(@Param("id") Long id);

    int deleteResultRecordById2(@Param("id") Long id);


    List<ResultRecord> selectByCondition(@Param("page") IPage page, @Param("req") ResultRecordReq req);


    List<ResultRecord> selectByConditionTest(ResultRecordReq req);

    ResultRecord selectResultRecordByStaffId(@Param("staffId") Long staffId);

    List<ResultRecordDto> selectByConditionByLeader(@Param("page") IPage page, @Param("req") ResultRecordReq params);

    void updateFlowStaffIdRoleToNull(@Param("id") Long id, @Param("status") Integer status);

    List<ResultRecord> selectResultRecordByIds(@Param("recordIds") List<Long> recordIds);

    List<OwnResultResp> ownResult(@Param("req") OwnResultReq req);

    List<GraphicsStatisticalDto> staffDistribution(@Param("monthTime") String monthTime,@Param("staffIds") List<String> staffIds);

    ResultRecord selectResultRecordByStaffIdStatus(@Param("staffId") Long staffId, @Param("status") int status);

    List<ReportProgressListDto> targetReportList(@Param("req")ReportListReq req, @Param("staffIds") List<String> staffIds,@Param("page") IPage page);

    ResultRecord selectLastResultRecordByStaffIdType(@Param("staffId") Long staffId, @Param("type") int type);

    ResultRecord selectCurrentMonthResultRecordByStaffIdType(@Param("staffId") Long staffId, @Param("type") int type);

    List<ResultRecord> selectResultRecordAllByStaffId(@Param("staffId") Long staffId);

    List<ChartStatistical> countNumByFlowProcess(@Param("startId") Long startId,@Param("evaluationIds")List<Long> evaluationIds,@Param("departmentIds")List<String> departmentIds);

    List<ChartStatistical> countNumByScoreLevel(@Param("startId") Long startId,@Param("evaluationIds")List<Long> evaluationIds,@Param("departmentIds")List<String> departmentIds);

    List<ResultRecord> selectChartDetailList(@Param("page") IPage page, @Param("departmentIds") List<String> departmentIds, @Param("startId")Long startId,@Param("scoreLevel")String scoreLevel);

    int batchDeleteByStartId(@Param("startId")Long startId);

    int countStartAndGroupNum(@Param("startId")Long startId,@Param("departmentIds")List<String> departmentIds);

    ResultRecord selectOneByStartId(@Param("startId")Long startId,@Param("departmentIds")List<String> departmentIds);

    List<AssessManagerDetailRes> selectAssessListByStartId(@Param("page") IPage page, @Param("req")AssessDetailReq req);

    List<ChartStatistical> countAssessNumByFlowProcess(@Param("req")AssessDetailReq req);

    int batchDeleteByStartIdAndStaffId(@Param("startId")Long startId,@Param("staffIds") List<String> staffIds);

    List<ResultRecord> selectToScoreList(@Param("startId")Long startId, @Param("evaluationId")Long evaluationId);

    int countAssessNumJoin(@Param("req")AssessDetailReq req);

    ResultRecord selectLastResultRecordByUserId(@Param("userId") Long userId);

    ResultRecord selectResultRecordByStaffIdAndStartId(@Param("userId") Long userId, @Param("startId") Long startId);

    List<Long> selectIdsByStartId(@Param("startId")Long startId);

    int batchDeleteByResultRecordIds(@Param("resultRecordIds")List<Long> resultRecordIds);

    List<ResultRecord> selectResultRecordsByStartId(Long startId);

    List<LevelDetailExportDto> selectLevelDetailList(@Param("departmentIds") List<String> departmentIds, @Param("startId")Long startId, @Param("scoreLevel")String scoreLevel);

    List<Long> selectStaffIdsByFlowProcess(@Param("flowProcess") List<Integer> flowProcess);

    List<ResultRecord> selectStaffIdsByStartIdAndFlowProcess(@Param("startId") Long startId, @Param("flowProcess") Long flowProcess);
}