package com.cool.store.mapper;

import com.cool.store.dto.InvestmentCountDTO;
import com.cool.store.dto.PendingCountDTO;
import com.cool.store.dto.openPreparation.PlanLineDTO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.request.LineListRequest;
import com.cool.store.request.PartnerRequest;
import com.cool.store.request.PointLinePageRequest;
import com.cool.store.request.PublicLineListRequest;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface LineInfoMapper extends Mapper<LineInfoDO> {
    LineInfoDO getByPartnerId(@Param("partnerId") String partnerId);

    LineInfoDO getByLineId(@Param("lineId") Long lineId);
    List<LineInfoDO> getByLineIds(@Param("lineIds") List<Long> lineIds);
    /**
     * 查询招商经理待处理数据
     * @param investmentManagerUserId
     * @return
     */
    List<LineInfoDO> listByInvestmentManager(@Param("investmentManagerUserId") String  investmentManagerUserId, @Param("codes") List<Integer> codes);

    /**
     * 面试官待处理
     * @param interviewId
     * @param interviewType
     * @param codes
     * @return
     */
    List<LineInfoDO> listByInterview(@Param("interviewId") String  interviewId,
                                     @Param("interviewType") Integer interviewType,
                                     @Param("pendingInterviewStatusList") List<Integer> pendingInterviewStatusList,
                                     @Param("notPassingTheInterview") Integer notPassingTheInterview,
                                     @Param("codes") List<Integer> codes);

    /**
     * 我的线索列表
     * @param lineListRequest
     * @return
     */
    List<LineInfoDO> lineList(@Param("request") LineListRequest lineListRequest,
                              @Param("wantShopAreaName") String wantShopAreaName,
                              @Param("userId") String userId,
                              @Param("wantShopAreaIds") List<Long> wantShopAreaIds);

    List<LineInfoDO> partnerList(@Param("request") PartnerRequest partnerRequest,
                                 @Param("wantShopAreaName") String wantShopAreaName,
                                 @Param("userId") String userId,
                                 @Param("wantShopAreaIds") List<Long> wantShopAreaIds);


    /**
     *  公海线索列表
     * @param publicLineListRequest
     * @return
     */
    List<LineInfoDO> publicLineList(@Param("request") PublicLineListRequest publicLineListRequest, @Param("publicFlag") Boolean publicFlag);

    /**
     * 根据lineId判断是更新还是插入
     * @param lineInfoParam
     */
    void insertOrUpdate(@Param("param") LineInfoDO lineInfoParam);

    void toExperiencing(@Param("lineIds") List<Long> lineIds,
                        @Param("code") Integer code);

    /**
     * 待处理数据
     * @param userId
     * @return
     */
    PendingCountDTO pendingCount(@Param("userId") String userId);

    InvestmentCountDTO investmentData(@Param("userId") String userId);



    Integer batchUpdateInterviewWorkflowStage(@Param("lineIds") List<Long> lineIds, @Param("workflowSubStage")Integer workflowSubStage, @Param("workflowSubStageStatus")Integer workflowSubStageStatus);

    /**
     * 选址人员获取蓄水池状态的加盟商
     * @param request
     * @return
     */
    Page<LineInfoDO> getLinePageByDevelopmentManager(@Param("request") PointLinePageRequest request);

    /**
     * @Auther: wangshuo
     * @Date: 2024/4/23
     * @description: 开业运营方案根据line id join enterprise_user 查询
     */
    List<PlanLineDTO> getLines(@Param("lineIdList") List<Long> lineIdList);

    /**
     * 获取线索手机号
     * @param lineIds
     * @return
     */
    List<LineInfoDO> getLineMobile(@Param("lineIds") List<Long> lineIds);

    /**
     * 批量更新招商经理与线索状态
     * @param lineIds
     * @param status
     * @param investmentManager
     * @return
     */
    Integer batchUpdateInvestmentManager(@Param("lineIds") List<Long> lineIds,
                                         @Param("status") Integer status,
                                         @Param("investmentManager") String investmentManager);
}