package com.qmth.sop.business.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qmth.sop.business.bean.dto.DataPermissionDto;
import com.qmth.sop.business.bean.result.TBCrmResult;
import com.qmth.sop.business.bean.result.UserArchivesAllocationResult;
import com.qmth.sop.business.entity.TBService;
import org.apache.ibatis.annotations.Param;

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

/**
 * <p>
 * </p>
 *
 * @author dhshu
 */
public interface ServiceAnalyseMapper extends BaseMapper<TBService> {


    List<TBService> list(@Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("dpr") DataPermissionDto dpr);

    List<Map<String, Object>> projectProgress(@Param("serviceUnitId") Long serviceUnitId);

    List<Map<String, Object>> equipmentOutboundTotal(@Param("serviceUnitId") Long serviceUnitId);

    Integer projectCount(@Param("serviceUnitId") Long serviceUnitId);

    List<Map<String, Object>> supplierDistribution(@Param("serviceUnitId") Long serviceUnitId);

    IPage<TBCrmResult> crmDetail(Page<Object> iPage, @Param("serviceUnitId") Long serviceUnitId, @Param("supplierId") Long supplierId);

    List<Map<String, Object>> supplierRole(@Param("serviceUnitId") Long serviceUnitId, @Param("supplierId") Long supplierId);

    List<Map<String, Object>> supplierRegion(@Param("serviceUnitId") Long serviceUnitId, @Param("supplierId") Long supplierId);


    List<Map<String, Object>> device(@Param("serviceUnitId") Long serviceUnitId);

    List<Map<String, Object>> personnel(@Param("serviceUnitId") Long serviceUnitId);

    List<UserArchivesAllocationResult> findCrmAllocation(@Param("serviceUnitId") Long serviceUnitId, @Param("regionId") Long regionId, @Param("supplierId") Long supplierId);

    /**
     * 查找当前大区待划定派单数量
     *
     * @param regionId
     * @return
     */
    int findWaitZone(@Param("regionId") Long regionId);
}
