<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="codeSiteSqlMapper">
	
	<sql id="base_column">
		 id,
		 advertiser_id as advertiserId,      
	     script_code as script,
	     pic_code as picture	            	
	</sql>
	
	<select id="findAllAdvertiserId"  parameterType="int" resultType="com.cloudcross.ssp.model.CodeSite">
		select 
		<include refid="base_column" />
		from t_code_site where advertiser_id = #{advertiserId}
	</select>
	
	
	
	 <select id="selectById" parameterType="int" resultType="com.cloudcross.ssp.model.CodeSite">
		select 
		<include refid="base_column" />
		from t_code_site
		<where>
			id = #{id} 			
		</where>
	</select>  
	
	 
	 
	 	<select id="selectByAdvertiserIdadvertiser"  parameterType="int" resultType="com.cloudcross.ssp.model.CodeSite">
		select 
		 script_code as script
	    	
		 from t_code_site 
		
		<where>
		
		 <if test="advertiserId!=null">
			 advertiser_id = #{advertiserId}
		</if>
		 
         </where>		
		</select>
	
	<select id="selectByAdvertiserIdoperator"  parameterType="int" resultType="com.cloudcross.ssp.model.CodeSite">
		select 
		<include refid="base_column" />
		from t_code_site where advertiser_id = 	#{AdvertiserId}
	</select>
	
	 <!-- select script_code , pic_code from t_code_site where advertiser_id=1
	  -->
	<select id="getScriptByAdId"  parameterType="int" resultType="String">
		select 
		script_code
		from t_code_site where advertiser_id = #{advertiserId}
	</select>
	
	<select id="getPicyureByAdId"  parameterType="int" resultType="String">
		select 
		pic_code
		from t_code_site where advertiser_id = #{advertiserId}
	</select>
	
	
</mapper>