package com.reyun.saas.mob.user.dao;


import com.reyun.saas.common.core.Mapper;
import com.reyun.saas.common.restResult.PageParam;
import com.reyun.saas.mob.user.domain.Channel;
import org.apache.ibatis.annotations.Param;

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

public interface ChannelMapper extends Mapper<Channel> {

    /**
     * 渠道列表
     */
    List<Channel> findChannelList(@Param("appkeys")List<String> appkeys, @Param("channelAlias")String channelAlias, @Param("cid")String cid,
                                  @Param("bid")String bid, @Param("isCustomAlias")Boolean isCustomAlias, @Param("query")String query,
                                  @Param("pageParam")PageParam param);

    Integer findChannelListCount(@Param("appkeys")List<String> appkeys, @Param("channelAlias")String channelAlias, @Param("cid")String cid,
                                 @Param("bid")String bid, @Param("isCustomAlias")Boolean isCustomAlias, @Param("query")String query);

    /**
     * 根据appkeys查渠道
     */
    List<Channel> findByAppkey(@Param("appkey")String appkeys);

    /**
     * 根据appkey删除渠道
     */
    int deleteChannel(@Param("appkey") String appkey,@Param("modifyUser")Long modifyUser,@Param("modifyDate")Date modifyTime);

    List<Map<String,Object>> findByappkeysAndIsActive(@Param("appkeys")List<String> appkeys);

    List<Channel> findByappkeysAndActive(@Param("appkeys")List<String> appkeys,@Param("active")Boolean active);

    /**
     * 根据appkey查找正常(非删除、非停用状态)的cid集合
     */
    List<String> findNormalByAppkey(@Param("appkey")String appkey);
}
