package com.ruoyi.ibs.list.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.ibs.dashboard.domain.vo.CampaignVO;
import com.ruoyi.ibs.list.domain.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.HashMap;
import java.util.List;

/**
 * 活动Mapper接口
 *
 * @author ruoyi
 * @date 2024-09-11
 */
public interface SysCampaignMapper extends BaseMapper<SysCampaign> {
    /**
     * 查询活动
     *
     * @param id 活动主键
     * @return 活动
     */
    public SysCampaign selectSysCampaignById(Long id);



    public List<SysGroup> selectCampaignGroupByCampaignId(String id);

    /**
     * 查询活动列表
     *
     * @param sysCampaign 活动
     * @return 活动集合
     */
    public List<SysCampaign> selectSysCampaignList(@Param("sysCampaign") SysCampaign sysCampaign,@Param("deptType") String deptType);




    public  List<SysCampaign> selectSysCampaignVoList(SysCampaign sysCampaign);

    /**
     *  查询 各层级 分配给我的、 其他的 任务id
     * @param sysCampaign
     * @return
     */
    public List<SysCampaign> selectSysCampType1And2(HashMap<String ,Object> inputParams) ;



    public List<SysCampaign> selectSysCampTypeUser(HashMap<String ,Object> inputParams) ;

    /**
     * 支行查询总行推送的活动列表
     *
     * @param sysCampaign 活动
     * @return 活动集合
     */
    public List<SysCampaign> selectSysCampaignListBranch(SysCampaign sysCampaign);

    /**
     * 新增活动
     *
     * @param sysCampaign 活动
     * @return 结果
     */
    public int insertSysCampaign(SysCampaign sysCampaign);

    public int insertSysCampaignSecond(SysCampaign sysCampaign);

    public List<String> selectSysCampaignGroupList(String grupId);


    public int insertSysCampaignGroup(SysCampaign sysCampaign);

    public int selectSysCampaignGroupCount(@Param("campaignId") String campaignId, @Param("groupId")String groupId);
    /**
     * 修改活动
     *
     * @param sysCampaign 活动
     * @return 结果
     */
    public int updateSysCampaign(SysCampaign sysCampaign);

    public int updateHeadHandledMissionSysCampaign(SysCampaign sysCampaign);

    /**
     * 删除活动
     *
     * @param id 活动主键
     * @return 结果
     */
    public int deleteSysCampaignById(Long id);

    /**
     * 批量删除活动
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteSysCampaignByIds(Long[] ids);

    public SysCampaign selectSysCampaignByCampaignId(String campaignId);

    public SysCampaign selectSysCampaignSecondByCampaignId(@Param("campaignId") String campaignId, @Param("deptId")  Long deptId,@Param("outletsId") Long outletsId);


    public int selectCountByCampaignName(@Param("campaignName")String campaignName);

    public List<CustomerList> selectCustomerListAll(@Param("campaignId") String campaignId,@Param("customerList") CustomerList customerList,@Param("tabName") String tabName,
                                                    @Param("deptId") Long deptId,@Param("userId")Long userId ,@Param("type") String type,@Param("userManagerId") Long userManagerId);

    public List<CustomerList> selectCoopCustomerList(@Param("campaignId") String campaignId,@Param("customerList") CustomerList customerList,@Param("tabName") String tabName,
                                                    @Param("deptId") Long deptId,@Param("userId")Long userId ,@Param("type") String type,@Param("userManagerId") Long userManagerId);

    public List<CustCampaignGroup> selectCustCampaignGroupByCampaignId(@Param("campaignId") String campaignId);

    public List<CustomerList> selectCustomerListAll2(@Param("campaignId") String campaignId,@Param("customerList") CustomerList customerList,@Param("tabName") String tabName,
                                                    @Param("deptId") Long deptId, @Param("outletsId") Long outletsId,@Param("userId")Long userId ,@Param("type") String type,@Param("userManagerId") Long userManagerId);


    public List<CustomerList> selectCustomerListAll3(@Param("campaignId") String campaignId,@Param("customerList") CustomerList customerList,@Param("tabName") String tabName,
                                                     @Param("roleUser")Long roleUser ,@Param("deptId") Long deptId);
    public List<CustomerList> selectCustomerListRetail(@Param("campaignId") String campaignId,@Param("customerList") CustomerList customerList,@Param("deptId") Long deptId);

    public List<CustomerList> selectCustomerListMerchant(@Param("campaignId") String campaignId,@Param("customerList") CustomerList customerList,@Param("deptId") Long deptId);

    public List<CustomerList> selectCustomerListBusiness(@Param("campaignId") String campaignId,@Param("customerList") CustomerList customerList,@Param("deptId") Long deptId);

    public List<CustomerList> selectCustomerListRetailBranchList(@Param("campaignId") String campaignId,@Param("customerList") CustomerList customerList,@Param("deptId") Long deptId);

    public List<CustomerList> selectCustomerListMerchantBranchList(@Param("campaignId") String campaignId,@Param("customerList") CustomerList customerList,@Param("deptId") Long deptId);

    public List<CustomerList> selectCustomerListBusinessBranchList(@Param("campaignId") String campaignId,@Param("customerList") CustomerList customerList,@Param("deptId") Long deptId);

    public List<AddressAndPhone> selectAddressAndPhoneByCustTypeAndCustIds(@Param("custType") String custType,@Param("custIds") List<String> custIds);

    public List<DeptAndOutlets> selectDeptAndOutletsByUserId(@Param("userIds") List<Long> userIds);

    public List<DeptAndOutlets> selectDeptAndOutletsBydeptIds(@Param("deptIds") List<Long> deptIds);

    public DeptAndOutlets selectDeptAndOutletsByUserName(@Param("userName") String userName);

    public List<GridInfoTs> selectGridInfoTsByGridIds(@Param("gridIds") List<Long> gridIds);

    List<CampaignVO> getListByManager(@Param("userId") Long userId);

    List<CampaignVO> getListByOutletManager(@Param("deptId") Long deptId);


    List<CampaignVO> getListByHeadAdmin(@Param("deptId") Long deptId, @Param("userRoleNum") String userRoleNum, @Param("isFinish") Boolean isFinish);

    List<CampaignVO> getListByBranchAdmin(@Param("deptId") Long deptId, @Param("userId") Long userId, @Param("isFinish") Boolean isFinish);

    List<VisitInfoVO> selectVisitInfoList(VisitInfoDTO visitInfoDTO);

    List<VisitInfoVO> selectVisitInfoList875(VisitInfoDTO visitInfoDTO);

    int updateVisitInfoFeedback(VisitInfoFeedbackUpdateDTO updateDTO);

    @Update("UPDATE sys_campaign SET del_flag = '2' where campaign_id = #{campaignId}")
    int deleteSysCampaignByCampaignId(@Param("campaignId") String campaignId);



}
