package com.chinacreator.video.mapper;


import org.apache.ibatis.annotations.Param;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;

import com.chinacreator.video.bean.ChannelBean;

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

/**
 * 渠道建设添加的二级渠道验证查询
 * @author xu.zhou
 * @date 20210707
 */
@Component
public interface ChannelBusiLimitDao{
	
	/**
	 * 是否为前向产品
	 * @param spid
	 * @param directype 1前向，2后向
	 * @return
	 */
	@Cacheable(value = "qrySpinfoConf",keyGenerator = "wiselyKeyGenerator")
	public int qrySpinfoConf(@Param("spid")String spid,@Param("directype")String directype);
	
	/**
	 * 查询一级渠道是否有效
	 * tb_one_channel_org
	 * @param id
	 * @return
	 */
	@Cacheable(value = "qryOneChannelConf",keyGenerator = "wiselyKeyGenerator")
	public int qryOneChannelConf(@Param("id")String id);
	
	/**
	 * 是否为后向产品
	 * @param cpid
	 * @param spid
	 * @return 大于0代表是，其他为不是
	 */
	@Cacheable(value = "hasBackBusiConf",keyGenerator = "wiselyKeyGenerator")
	public int hasBackBusiConf(@Param("cpid")String cpid, @Param("spid")String spid);
	

	/**
	 * 查询渠道表配置信息
	 * @param id
	 * @return
	 */
	@Cacheable(value = "qryChannelConfById",keyGenerator = "wiselyKeyGenerator")
	public ChannelBean qryChannelConfById(@Param("id")String id);
	
	/**
	 * 根据渠道和TYPE，获取渠道业务配置表的信息
	 * @param channel
	 * @param type
	 * @return
	 */
	@Cacheable(value = "qryChannelBusiLimitConf",keyGenerator = "wiselyKeyGenerator")
	public List<HashMap<String, String>> qryChannelBusiLimitConf(@Param("channel")String channel,@Param("type")String type);

}
