package cn.com.countrygarden.bi.main.dao.mediaResource;

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

import javax.transaction.Transactional;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import cn.com.countrygarden.bi.main.core.Mapper;
import cn.com.countrygarden.bi.main.model.mediaResource.AdvertisingFileDirectory;

@Repository
@Transactional
public interface AdvertisingFileDirectoryMapper extends Mapper<AdvertisingFileDirectory>{

	@Select("select count(id) from advertising_file_directory where file_name = #{fileName} and media_id = #{mediaId}")
	int findFileMeans(@Param("mediaId")String mediaId,@Param("fileName")String fileName);

	@Select("select id,file_name as name,file_real_name as fileRealName,file_url as url,"
			+ "media_id as mediaId from advertising_file_directory "
			+ "where media_id = #{mediaId}")
	List<Map<String,Object>> viewAdjunctByAdvertusubgId(@Param("mediaId")String mediaId);

	int saveRelation(@Param("fileIds")String[] fileIds,@Param("mediaId")Long mediaId);

	int insertCallBack(AdvertisingFileDirectory directory);

	
}
