Browse Source

媒体自投修改

jun.zhou 9 years ago
parent
commit
9c5a63bee0

+ 221 - 221
src/main/java/com/cloudcross/ssp/model/mapper/zone.sql.xml

@@ -1,222 +1,222 @@
-<?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="zoneSqlMapper">
-	
-	<sql id="base_column">
-		t_zone.id as id,
-		operator_id ,
-		t_zone.name as name,
-		width,
-		height,
-		device,
-		position,
-		status,
-		updated,
-		supdated,
-		default_path,
-		default_url,
-		recheck,
-		default_path_small
-	</sql>	
-	<select id="findZone" parameterType="int" resultType="com.cloudcross.ssp.model.Zone">
-		select * from t_zone where id=#{zoneId}
-	</select>
-	
-	 <select id="selectByIdOperator"  parameterType="int" resultType="com.cloudcross.ssp.model.Zone">
-		select *
-		from t_zone 
-		<where>
-			t_zone.id = #{id}
-		</where>
-		order by t_zone.id  desc
-	</select> 		
-	<select id="findByName"  parameterType="string" resultType="long">
-		select t_zone.id from t_zone 
-	<where> name = #{name} </where>
-	</select>
-	<resultMap id="zoneResult" type="com.cloudcross.ssp.model.Zone">
-		<id property="id" column="id" />
-		<result property="operator_id" column="operator_id" />
-		<result property="name" column="name" />
-		<result property="width" column="width" />
-		<result property="height" column="height" />
-		<result property="device" column="device" />
-		<result property="position" column="position" />
-		<result property="status" column="status" />
-		<result property="updated" column="updated" />
-		<result property="supdated" column="supdated" />
-	</resultMap> 
-	
-	<select id="selectByParams"  parameterType="map" resultMap="zoneResult">
-		select 
-		<include refid="base_column" />
-		from t_zone 
-		where t_zone.status != -1
-		
-		<if test="key!=null and value!=null">
-			<choose>
-				<when test="key=='name'">
-					and t_zone.name like #{value}
-				</when>
-				<when test="key=='id'">
-					and t_zone.id like #{value}
-				</when>
-			</choose>	
-		</if>
-		<if test="status != null">
-				and status like #{status}
-		</if>		
-		<if test="device != null">
-				and device like #{device}
-		</if>
-		<if test="position != null">
-				and position like #{position}
-		</if>	
-		<if test="height != null">
-				and height like #{height}
-		</if>
-		<if test="width != null">
-				and width like #{width}
-		</if>
-		<if test="operatorId != null">
-				and operator_id = #{operatorId}
-		</if>	
-		
-		order by  t_zone.id   desc
-		limit #{pager.offset}, #{pager.limit}
-	</select>		
-	<select id="countByParams" parameterType="map" resultType="int">
-		select count(t_zone.id)
-		from t_zone 
-		where t_zone.status != -1	
-		
-			 <if test="key!=null and value!=null">
-			<choose>
-				<when test="key=='id'">
-					and t_zone.id like #{value}
-				</when>
-				<when test="key=='name'">
-					and t_zone.name = #{value}
-				</when>
-			</choose>	
-		</if>
-		<if test="status != null">
-				and status like #{status}
-		</if>		
-		<if test="device != null">
-				and device like #{device}
-		</if>	
-		<if test="position != null">
-				and position like #{position}
-		</if>
-		<if test="height != null">
-				and height like #{height}
-		</if>
-		<if test="width != null">
-				and width like #{width}
-		</if>
-		<if test="operatorId != null">
-				and operator_id = #{operatorId}
-		</if>	
-	</select>
-		
-	<insert id="addZone" parameterType="com.cloudcross.ssp.model.Zone" useGeneratedKeys="true"
-		keyProperty="id">
-		insert into t_zone(operator_id,name,device,position,width,height,recheck,updated,supdated,default_path,default_url,default_path_small)
-		values(#{operator_id},#{name},#{device},#{position},#{width},#{height},#{recheck},#{updated},#{supdated},#{default_path},#{default_url},#{default_path_small})
-		
-	
-	</insert>
-	
-	<update id="editZone" parameterType="com.cloudcross.ssp.model.Zone">
-		update t_zone 
-		set  name=#{name},device=#{device},position=#{position}, width=#{width}, height=#{height},default_path=#{default_path},default_path_small=#{default_path_small},default_url=#{default_url},recheck=#{recheck},updated=#{updated},supdated=#{supdated}
-		where id = #{id}
-			
-	</update>
-	
-	<update id="updateZoneStatus" parameterType="HashMap">
-		update t_zone
-			set status = #{status},updated = #{updated}
-			where id in
-			<foreach item="id" collection="zoneIdList"
-		      open="(" separator="," close=")">
-		        #{id}
-			</foreach>
-	</update>
-
-	<delete id="deleteById" parameterType="int">
-		delete 
-		from t_zone
-		<where>
-		id = #{id} 
-		</where>
-	</delete>
-	
-	
-	
-	
-	<!-- 
-	<select id="findByDeviceAndPlaceId" parameterType="map" resultType="zone">
-		select t_zone.id,t_zone.name
-		 from t_zone 
-		 <where>
-		 	<if test="zoneDevice != null">
-		 		1=1 and t_zone.device = #{zoneDevice}
-		 	</if>
-		 	<if test="zonePlaceIdList != null">
-		 		and t_zone.id in (
-		 		select t_zone_place.zone_id from t_zone_place where place_id in
-		 		<foreach item="placeId" collection="zonePlaceIdList"  open="(" separator="," close=")">
-		 			#{placeId}
-		 		</foreach>
-		 		)
-		 	</if>
-		 </where>
-	</select>
-	 -->
-	<!-- 广告位排期按在投广告位ID和日期查找 -->
-	
-     <select id="findAdgroupNameByZoneIdAndSchedule" resultType="string" parameterType="map">
-       select t.name from t_adgroup t 
-       where 
-       t.id in (select az.adgroup_id from t_adgroup_zone az where az.zone_id = #{zoneId}) 
-       and
-       t.id in (select ac.adgroup_id from t_adgroup_schedule ac where ac.startdate &lt;= #{date}  and #{date} &lt;= ac.enddate)
-     </select>
-	
-	<!-- 首页中查找设备,暂时只有PC和MoBile -->
-     <select id="findByDevice" resultType="com.cloudcross.ssp.model.Zone" parameterType="int">
-           select id,name from t_zone
-         <where> device = #{device} </where>
-           order by t_zone.id desc 
-      </select>
-      
-      <!-- add by Wanfu for banner-audit -->
-      <select id="findByOperatorIdOperator" resultType="com.cloudcross.ssp.model.Zone" parameterType="int">
-           select * from t_zone where operator_id = #{operatorId} and recheck = 1 and status=0
-      </select>
-      
-	
- <select id="selectByIdBack"  parameterType="long" resultType="com.cloudcross.ssp.model.Zone">
-		select <include refid="base_column" />
-		from t_zone 
-		<where>
-			t_zone.id = #{id}
-		</where>
-		order by t_zone.id  desc
-	</select> 	
-	
-	<select id="findByOperatorIdBack" resultType="com.cloudcross.ssp.model.Zone" parameterType="long">
-           select <include refid="base_column" /> 
-           from t_zone where operator_id = #{operatorId}
-      </select>
-      
-      <!-- zhoujun -->
-      <select id="queryZoneByCondition" resultType="com.cloudcross.ssp.model.Zone" parameterType="java.util.Map">
-      	select id,name from t_zone where id = #{operatorId} 
-      	<if test="position != null">
-      		position = #{position}
-      	</if>
-      </select>
+<?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="zoneSqlMapper">
+	
+	<sql id="base_column">
+		t_zone.id as id,
+		operator_id ,
+		t_zone.name as name,
+		width,
+		height,
+		device,
+		position,
+		status,
+		updated,
+		supdated,
+		default_path,
+		default_url,
+		recheck,
+		default_path_small
+	</sql>	
+	<select id="findZone" parameterType="int" resultType="com.cloudcross.ssp.model.Zone">
+		select * from t_zone where id=#{zoneId}
+	</select>
+	
+	 <select id="selectByIdOperator"  parameterType="int" resultType="com.cloudcross.ssp.model.Zone">
+		select *
+		from t_zone 
+		<where>
+			t_zone.id = #{id}
+		</where>
+		order by t_zone.id  desc
+	</select> 		
+	<select id="findByName"  parameterType="string" resultType="long">
+		select t_zone.id from t_zone 
+	<where> name = #{name} </where>
+	</select>
+	<resultMap id="zoneResult" type="com.cloudcross.ssp.model.Zone">
+		<id property="id" column="id" />
+		<result property="operator_id" column="operator_id" />
+		<result property="name" column="name" />
+		<result property="width" column="width" />
+		<result property="height" column="height" />
+		<result property="device" column="device" />
+		<result property="position" column="position" />
+		<result property="status" column="status" />
+		<result property="updated" column="updated" />
+		<result property="supdated" column="supdated" />
+	</resultMap> 
+	
+	<select id="selectByParams"  parameterType="map" resultMap="zoneResult">
+		select 
+		<include refid="base_column" />
+		from t_zone 
+		where t_zone.status != -1
+		
+		<if test="key!=null and value!=null">
+			<choose>
+				<when test="key=='name'">
+					and t_zone.name like #{value}
+				</when>
+				<when test="key=='id'">
+					and t_zone.id like #{value}
+				</when>
+			</choose>	
+		</if>
+		<if test="status != null">
+				and status like #{status}
+		</if>		
+		<if test="device != null">
+				and device like #{device}
+		</if>
+		<if test="position != null">
+				and position like #{position}
+		</if>	
+		<if test="height != null">
+				and height like #{height}
+		</if>
+		<if test="width != null">
+				and width like #{width}
+		</if>
+		<if test="operatorId != null">
+				and operator_id = #{operatorId}
+		</if>	
+		
+		order by  t_zone.id   desc
+		limit #{pager.offset}, #{pager.limit}
+	</select>		
+	<select id="countByParams" parameterType="map" resultType="int">
+		select count(t_zone.id)
+		from t_zone 
+		where t_zone.status != -1	
+		
+			 <if test="key!=null and value!=null">
+			<choose>
+				<when test="key=='id'">
+					and t_zone.id like #{value}
+				</when>
+				<when test="key=='name'">
+					and t_zone.name = #{value}
+				</when>
+			</choose>	
+		</if>
+		<if test="status != null">
+				and status like #{status}
+		</if>		
+		<if test="device != null">
+				and device like #{device}
+		</if>	
+		<if test="position != null">
+				and position like #{position}
+		</if>
+		<if test="height != null">
+				and height like #{height}
+		</if>
+		<if test="width != null">
+				and width like #{width}
+		</if>
+		<if test="operatorId != null">
+				and operator_id = #{operatorId}
+		</if>	
+	</select>
+		
+	<insert id="addZone" parameterType="com.cloudcross.ssp.model.Zone" useGeneratedKeys="true"
+		keyProperty="id">
+		insert into t_zone(operator_id,name,device,position,width,height,recheck,updated,supdated,default_path,default_url,default_path_small)
+		values(#{operator_id},#{name},#{device},#{position},#{width},#{height},#{recheck},#{updated},#{supdated},#{default_path},#{default_url},#{default_path_small})
+		
+	
+	</insert>
+	
+	<update id="editZone" parameterType="com.cloudcross.ssp.model.Zone">
+		update t_zone 
+		set  name=#{name},device=#{device},position=#{position}, width=#{width}, height=#{height},default_path=#{default_path},default_path_small=#{default_path_small},default_url=#{default_url},recheck=#{recheck},updated=#{updated},supdated=#{supdated}
+		where id = #{id}
+			
+	</update>
+	
+	<update id="updateZoneStatus" parameterType="HashMap">
+		update t_zone
+			set status = #{status},updated = #{updated}
+			where id in
+			<foreach item="id" collection="zoneIdList"
+		      open="(" separator="," close=")">
+		        #{id}
+			</foreach>
+	</update>
+
+	<delete id="deleteById" parameterType="int">
+		delete 
+		from t_zone
+		<where>
+		id = #{id} 
+		</where>
+	</delete>
+	
+	
+	
+	
+	<!-- 
+	<select id="findByDeviceAndPlaceId" parameterType="map" resultType="zone">
+		select t_zone.id,t_zone.name
+		 from t_zone 
+		 <where>
+		 	<if test="zoneDevice != null">
+		 		1=1 and t_zone.device = #{zoneDevice}
+		 	</if>
+		 	<if test="zonePlaceIdList != null">
+		 		and t_zone.id in (
+		 		select t_zone_place.zone_id from t_zone_place where place_id in
+		 		<foreach item="placeId" collection="zonePlaceIdList"  open="(" separator="," close=")">
+		 			#{placeId}
+		 		</foreach>
+		 		)
+		 	</if>
+		 </where>
+	</select>
+	 -->
+	<!-- 广告位排期按在投广告位ID和日期查找 -->
+	
+     <select id="findAdgroupNameByZoneIdAndSchedule" resultType="string" parameterType="map">
+       select t.name from t_adgroup t 
+       where 
+       t.id in (select az.adgroup_id from t_adgroup_zone az where az.zone_id = #{zoneId}) 
+       and
+       t.id in (select ac.adgroup_id from t_adgroup_schedule ac where ac.startdate &lt;= #{date}  and #{date} &lt;= ac.enddate)
+     </select>
+	
+	<!-- 首页中查找设备,暂时只有PC和MoBile -->
+     <select id="findByDevice" resultType="com.cloudcross.ssp.model.Zone" parameterType="int">
+           select id,name from t_zone
+         <where> device = #{device} </where>
+           order by t_zone.id desc 
+      </select>
+      
+      <!-- add by Wanfu for banner-audit -->
+      <select id="findByOperatorIdOperator" resultType="com.cloudcross.ssp.model.Zone" parameterType="int">
+           select * from t_zone where operator_id = #{operatorId} and recheck = 1 and status=0
+      </select>
+      
+	
+ <select id="selectByIdBack"  parameterType="long" resultType="com.cloudcross.ssp.model.Zone">
+		select <include refid="base_column" />
+		from t_zone 
+		<where>
+			t_zone.id = #{id}
+		</where>
+		order by t_zone.id  desc
+	</select> 	
+	
+	<select id="findByOperatorIdBack" resultType="com.cloudcross.ssp.model.Zone" parameterType="long">
+           select <include refid="base_column" /> 
+           from t_zone where operator_id = #{operatorId}
+      </select>
+      
+      <!-- zhoujun -->
+      <select id="queryZoneByCondition" resultType="com.cloudcross.ssp.model.Zone" parameterType="java.util.Map">
+      	select id,name from t_zone where operator_id = #{operatorId} 
+      	<if test="position != null">
+      		position = #{position}
+      	</if>
+      </select>
 </mapper>
 </mapper>

+ 16 - 0
src/main/java/com/cloudcross/ssp/web/advertiser/main/ad/target/AdGroupController.java

@@ -1847,5 +1847,21 @@ public class AdGroupController extends SimpleController {
 		return page("createbyoperator");
 		return page("createbyoperator");
 	}
 	}
 	
 	
+	/**
+	 *  
+	 * @param position 根据广告的位置选择广告位
+	 * @return
+	 */
+	@RequestMapping("/zonelist")
+	public List<Zone> queryZoneByPosition(Integer position){
+		Map<String,Object>condition = new HashMap<String,Object>();
+		condition.put("position", position);
+		condition.put("operatorId", getLoginUser().getOperatorId());
+		return this.zoneService.queryZoneByCondition(condition);
+	}
+	
+	/*public List<Place> queryPlaceAll(){
+		
+	}*/
 	
 	
 }
 }