|
@@ -1,48 +1,67 @@
|
|
|
<?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="bannerSqlMapper">
|
|
|
- <sql id="base_column_advertiser">
|
|
|
- id,
|
|
|
- banner_template_id as bannerTemplateId,
|
|
|
- order_id as orderId,
|
|
|
- campaign_id as campaignId,
|
|
|
- adgroup_id as adGroupId,
|
|
|
- visit_address as visitAddress,
|
|
|
- click_address as clickAddress,
|
|
|
- impression_address as impressionAddress
|
|
|
- status,
|
|
|
- checked,
|
|
|
- updated,
|
|
|
- supdated
|
|
|
+
|
|
|
+ <sql id="base_column_banner">
|
|
|
+ a.id as id,
|
|
|
+ a.banner_template_id as bannerTemplateId,
|
|
|
+ a.order_id as orderId,
|
|
|
+ a.campaign_id as campaignId,
|
|
|
+ a.adgroup_id as adGroupId,
|
|
|
+ a.visit_address as visitAddress,
|
|
|
+ a.click_address as clickAddress,
|
|
|
+ a.impression_address as impressionAddress,
|
|
|
+ a.status as status1,
|
|
|
+ a.checked as checked,
|
|
|
+ a.updated as updated,
|
|
|
+ a.supdated as supdated,
|
|
|
+ a.memo as memo
|
|
|
</sql>
|
|
|
-
|
|
|
- <sql id="base_column_operator">
|
|
|
- b.id as bannerId,
|
|
|
- banner_template_id as bannerTemplateId,
|
|
|
- order_id as orderId,
|
|
|
- campaign_id as campaignId,
|
|
|
- adgroup_id as adGroupId,
|
|
|
- visit_address as visitAddress,
|
|
|
- click_address as clickAddress,
|
|
|
- impression_address as impressionAddress,
|
|
|
- b.checked as checked,
|
|
|
- IFNULL(bo.checked,-1) as operatorChecked,
|
|
|
- b.updated as updated,
|
|
|
- memo
|
|
|
+ <sql id="base_column_bannertemplate">
|
|
|
+ b.id as bannerTemplateId,
|
|
|
+ b.agent_id as agentId,
|
|
|
+ b.advertiser_id as advertiserId,
|
|
|
+ b.agent_id as agentId,
|
|
|
+ b.name as name,
|
|
|
+ b.path as path,
|
|
|
+ b.path_small as pathSmall,
|
|
|
+ b.type as type,
|
|
|
+ b.width as width,
|
|
|
+ b.height as height,
|
|
|
+ b.status as status,
|
|
|
+ b.updated as updated
|
|
|
</sql>
|
|
|
|
|
|
- <sql id="banner_template_base_column">
|
|
|
- bt.id as banner_templateId,
|
|
|
- advertiser_id as advertiserId,
|
|
|
- name,
|
|
|
- path,
|
|
|
- path_small as pathSmall,
|
|
|
- type,
|
|
|
- width,
|
|
|
- height,
|
|
|
- bt.status as status,
|
|
|
- bt.updated as bannerTemplateUpdated
|
|
|
- </sql>
|
|
|
+
|
|
|
+ <resultMap type="com.cloudcross.ssp.model.Banner" id="Banner">
|
|
|
+ <id property="id" column="id"/>
|
|
|
+ <result property="bannerTemplateId" column="bannerTemplateId"/>
|
|
|
+ <result property="status" column="status1"/>
|
|
|
+ <result property="orderId" column="orderId"/>
|
|
|
+ <result property="campaignId" column="campaignId"/>
|
|
|
+ <result property="adGroupId" column="adGroupId"/>
|
|
|
+ <result property="visitAddress" column="visitAddress"/>
|
|
|
+ <result property="clickAddress" column="clickAddress"/>
|
|
|
+ <result property="impressionAddress" column="impressionAddress"/>
|
|
|
+ <result property="checked" column="checked"/>
|
|
|
+ <result property="updated" column="updated"/>
|
|
|
+ <result property="supdated" column="supdated"/>
|
|
|
+ <association property="bannerTemplate" javaType="com.cloudcross.ssp.model.BannerTemplate" resultMap="bannerTemplate"/>
|
|
|
+</resultMap>
|
|
|
+<resultMap type="com.cloudcross.ssp.model.BannerTemplate" id="BannerTemplate">
|
|
|
+ <id property="id" column="bannerTemplateId"/>
|
|
|
+ <result property="advertiserId" column="advertiserId"/>
|
|
|
+ <result property="agentId" column="agentId"/>
|
|
|
+ <result property="name" column="name"/>
|
|
|
+ <result property="path" column="path"/>
|
|
|
+ <result property="pathSmall" column="pathSmall"/>
|
|
|
+ <result property="type" column="type"/>
|
|
|
+ <result property="width" column="width"/>
|
|
|
+ <result property="height" column="height"/>
|
|
|
+ <result property="status" column="status"/>
|
|
|
+ <result property="updated" column="updated"/>
|
|
|
+</resultMap>
|
|
|
+
|
|
|
|
|
|
<delete id="deleteBanner" parameterType="HashMap">
|
|
|
delete from t_banner where
|
|
@@ -55,24 +74,20 @@
|
|
|
|
|
|
<update id="updateBannerStatus" parameterType="HashMap">
|
|
|
update t_banner
|
|
|
- set status=#{status},updated = #{updated},supdated = #{supdated}
|
|
|
+ set status=#{status},
|
|
|
+ updated = #{updated},
|
|
|
+ supdated = #{supdated}
|
|
|
where id in
|
|
|
<foreach item="id" collection="idList" open="(" separator=","
|
|
|
close=")">
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
</update>
|
|
|
- <update id="updateBannerStatusOperator" parameterType="HashMap">
|
|
|
- update t_banner
|
|
|
- set checked = #{checked},updated = #{updated}
|
|
|
- where id in
|
|
|
- <foreach item="bannerId" collection="bannerIdList"
|
|
|
- open="(" separator="," close=")">
|
|
|
- #{bannerId}
|
|
|
- </foreach>
|
|
|
- </update>
|
|
|
+
|
|
|
+
|
|
|
<select id="countByParams" parameterType="map" resultType="int">
|
|
|
- select count(a.id) from t_banner a ,t_banner_template b
|
|
|
+ select count(a.id) from t_banner a ,
|
|
|
+ t_banner_template b
|
|
|
<where>
|
|
|
a.banner_template_id = b.id and a.adgroup_id=#{adGroupId}
|
|
|
<if test="value !=null">
|
|
@@ -83,13 +98,13 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="countByAdGroupId" parameterType="long" resultType="int">
|
|
|
- select count(id) from t_banner
|
|
|
- where adgroup_id = #{adGroupId}
|
|
|
+ select count(id) from t_banner
|
|
|
+ where adgroup_id = #{adGroupId}
|
|
|
</select>
|
|
|
|
|
|
<select id="findById1" parameterType="long" resultType="com.cloudcross.ssp.model.Banner">
|
|
|
select
|
|
|
- <include refid="base_column_advertiser"/>
|
|
|
+ <include refid="base_column_banner"/>
|
|
|
from t_banner
|
|
|
<where>
|
|
|
adgroup_id = #{adGroupId}
|
|
@@ -97,27 +112,28 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="findByIdAdvertiser" parameterType="long" resultMap="Banner">
|
|
|
- select a.id as id,a.banner_template_id as bannerTemplateId,a.order_id as orderId,a.campaign_id as campaignId,a.adgroup_id as adGroupId,a.visit_address as visitAddress,
|
|
|
- a.click_address as clickAddress,a.impression_address as impressionAddress,a.status as status1,a.checked as checked,a.updated as updated, b.id as bannerTemplateId,b.agent_id as agentId,b.advertiser_id as advertiserId,b.name as name,b.path as path,b.path_small as pathSmall,b.type as type,b.width as width,b.height as height,b.status as status,b.updated as updated from t_banner a LEFT JOIN t_banner_template b on a.banner_template_id=b.id
|
|
|
+ select <include refid="base_column_banner"/> ,
|
|
|
+ <include refid="base_column_bannertemplate"/>
|
|
|
+ from t_banner a
|
|
|
+ LEFT JOIN t_banner_template b
|
|
|
+ on a.banner_template_id=b.id
|
|
|
<where>
|
|
|
a.id=#{id}
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
- <select id="findByIdOperator" parameterType="int" resultMap="Banner">
|
|
|
- select <include refid="base_column_operator"/> ,<include refid="banner_template_base_column"/>
|
|
|
- from t_banner b inner join t_banner_template bt on b.banner_template_id = bt.id left join t_banner_operator bo
|
|
|
-on b.id=bo.banner_id where b.id=#{id}
|
|
|
- </select>
|
|
|
+
|
|
|
|
|
|
<select id="findByParams" parameterType="map" resultMap="Banner">
|
|
|
- select a.id as id,a.banner_template_id as bannerTemplateId,a.order_id as orderId,a.campaign_id as campaignId,a.adgroup_id as adGroupId,a.visit_address as visitAddress,
|
|
|
- a.click_address as clickAddress,a.impression_address as impressionAddress,a.status as status1,a.checked as checked,a.updated as updated,a.supdated as supdated,b.id as bannerTemplateId,b.agent_id as agentId,b.advertiser_id as advertiserId,b.agent_id as agentId,b.name as name,b.path as path,b.path_small as pathSmall,b.type as type,b.width as width,b.height as height,b.status as status,b.updated as updated from t_banner a LEFT JOIN t_banner_template b on a.banner_template_id=b.id
|
|
|
+ select <include refid="base_column_banner"/> ,
|
|
|
+ <include refid="base_column_bannertemplate"/>
|
|
|
+ from t_banner a
|
|
|
+ LEFT JOIN t_banner_template b
|
|
|
+ on a.banner_template_id=b.id
|
|
|
<where>
|
|
|
a.adgroup_id=#{adGroupId}
|
|
|
<if test="value !=null">
|
|
|
and name like #{value}
|
|
|
-
|
|
|
</if>
|
|
|
</where>
|
|
|
and a.status != -1
|
|
@@ -125,104 +141,6 @@ on b.id=bo.banner_id where b.id=#{id}
|
|
|
limit #{pager.offset}, #{pager.limit}
|
|
|
</select>
|
|
|
|
|
|
- <select id="countByZoneSize" parameterType="HashMap" resultType="int">
|
|
|
- select count(*) from t_banner b inner join t_banner_template bt on b.banner_template_id = bt.id
|
|
|
- where bt.status != -1 and checked != 2 and checked !=0
|
|
|
- <if test="zoneList.size()>0">
|
|
|
- and
|
|
|
- <foreach item="zone" collection="zoneList"
|
|
|
- open="(" separator="or" close=")" >
|
|
|
- bt.width <= #{zone.width} and bt.height <= #{zone.height}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="searchKey!=null and searchValue!=null">
|
|
|
- and bt.name like #{searchValue}
|
|
|
- </if>
|
|
|
- <if test="checked!=null">
|
|
|
- and b.checked like #{checked}
|
|
|
- </if>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="findByZoneSize" parameterType="HashMap" resultMap="Banner">
|
|
|
- select <include refid="base_column_operator"/> ,<include refid="banner_template_base_column"/>
|
|
|
- from t_banner b inner join t_banner_template bt on b.banner_template_id = bt.id
|
|
|
- where bt.status != -1 and checked != 2 and checked !=0
|
|
|
- <if test="zoneList.size()>0">
|
|
|
- and
|
|
|
- <foreach item="zone" collection="zoneList"
|
|
|
- open="(" separator="or" close=")" >
|
|
|
- bt.width <= #{zone.width} and bt.height <= #{zone.height}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="searchKey!=null and searchValue!=null">
|
|
|
- and bt.name like #{searchValue}
|
|
|
- </if>
|
|
|
- <if test="checked!=null">
|
|
|
- and b.checked like #{checked}
|
|
|
- </if>
|
|
|
- order by b.id desc
|
|
|
- <if test="pager!=null">
|
|
|
- limit #{pager.offset}, #{pager.limit}
|
|
|
- </if>
|
|
|
- </select>
|
|
|
-
|
|
|
-<resultMap type="com.cloudcross.ssp.model.Banner" id="Banner">
|
|
|
- <id property="id" column="id"/>
|
|
|
- <result property="bannerTemplateId" column="bannerTemplateId"/>
|
|
|
- <result property="status" column="status1"/>
|
|
|
- <result property="orderId" column="orderId"/>
|
|
|
- <result property="campaignId" column="campaignId"/>
|
|
|
- <result property="adGroupId" column="adGroupId"/>
|
|
|
- <result property="visitAddress" column="visitAddress"/>
|
|
|
- <result property="clickAddress" column="clickAddress"/>
|
|
|
- <result property="impressionAddress" column="impressionAddress"/>
|
|
|
- <result property="checked" column="checked"/>
|
|
|
- <result property="updated" column="updated"/>
|
|
|
- <result property="supdated" column="supdated"/>
|
|
|
- <association property="bannerTemplate" javaType="com.cloudcross.ssp.model.BannerTemplate" resultMap="bannerTemplate"/>
|
|
|
-</resultMap>
|
|
|
-<resultMap type="com.cloudcross.ssp.model.BannerTemplate" id="BannerTemplate">
|
|
|
- <id property="id" column="bannerTemplateId"/>
|
|
|
- <result property="advertiserId" column="advertiserId"/>
|
|
|
- <result property="agentId" column="agentId"/>
|
|
|
- <result property="name" column="name"/>
|
|
|
- <result property="path" column="path"/>
|
|
|
- <result property="pathSmall" column="pathSmall"/>
|
|
|
- <result property="type" column="type"/>
|
|
|
- <result property="width" column="width"/>
|
|
|
- <result property="height" column="height"/>
|
|
|
- <result property="status" column="status"/>
|
|
|
- <result property="updated" column="updated"/>
|
|
|
-</resultMap>
|
|
|
-
|
|
|
-<!--<resultMap type="com.cloudcross.ssp.model.Banner" id="banneroperator">
|
|
|
- <id property="id" column="bannerId"/>
|
|
|
- <result property="bannerTemplateId" column="bannerTemplateId"/>
|
|
|
- <result property="orderId" column="orderId"/>
|
|
|
- <result property="campaignId" column="campaignId"/>
|
|
|
- <result property="adGroupId" column="adgroupId"/>
|
|
|
- <result property="visitAddress" column="visitAddress"/>
|
|
|
- <result property="clickAddress" column="clickAddress"/>
|
|
|
- <result property="impressionAddress" column="impressionAddress"/>
|
|
|
- <result property="checked" column="checked"/>
|
|
|
- <result property="operatorChecked" column="operatorChecked"/>
|
|
|
- <result property="updated" column="updated"/>
|
|
|
- <result property="memo" column="memo"/>
|
|
|
- <association property="bannerTemplate" resultMap="com.cloudcross.ssp.model.BannerTemplate"/>
|
|
|
- </resultMap> -->
|
|
|
- <!-- <resultMap type="com.cloudcross.ssp.model.BannerTemplate" id="bannerTemplate">
|
|
|
- <id property="id" column="banner_templateId"/>
|
|
|
- <result property="advertiserId" column="advertiserId"/>
|
|
|
- <result property="name" column="name"/>
|
|
|
- <result property="path" column="path"/>
|
|
|
- <result property="pathSmall" column="pathSmall"/>
|
|
|
- <result property="type" column="type"/>
|
|
|
- <result property="width" column="width"/>
|
|
|
- <result property="height" column="height"/>
|
|
|
- <result property="status" column="status"/>
|
|
|
- <result property="updated" column="bannerTemplateUpdated"/>
|
|
|
- </resultMap>-->
|
|
|
-
|
|
|
<insert id="addBanner" parameterType="com.cloudcross.ssp.model.Banner" useGeneratedKeys="true"
|
|
|
keyProperty="id">
|
|
|
insert into
|
|
@@ -398,6 +316,8 @@ on b.id=bo.banner_id where b.id=#{id}
|
|
|
</select>
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
<select id="findByParams2" parameterType="map" resultMap="Banner">
|
|
|
select a.status as status1,a.id as id,a.banner_template_id as bannerTemplateId,a.order_id as orderId,a.campaign_id as campaignId,a.adgroup_id as adGroupId,a.visit_address as visitAddress,
|
|
|
a.click_address as clickAddress,a.impression_address as impressionAddress, a.checked as checked,a.updated as updated,b.id as bannerTemplateId,b.agent_id as agentId,b.advertiser_id as advertiserId,b.agent_id as agentId,b.name as name,b.path as path,b.path_small as pathSmall,b.type as type,b.width as width,b.height as height,b.status as status,b.updated as updated from t_banner a LEFT JOIN t_banner_template b on a.banner_template_id=b.id
|
|
@@ -427,6 +347,7 @@ on b.id=bo.banner_id where b.id=#{id}
|
|
|
</where>
|
|
|
order by a.id desc
|
|
|
</select>
|
|
|
+
|
|
|
<update id="updateOperatorBannerTime" parameterType="HashMap">
|
|
|
update t_banner_operator
|
|
|
set supdated = #{supdated}
|
|
@@ -439,34 +360,5 @@ on b.id=bo.banner_id where b.id=#{id}
|
|
|
</update>
|
|
|
|
|
|
|
|
|
- <update id="updateOperatorBanner" parameterType="HashMap">
|
|
|
- update t_banner_operator
|
|
|
- set operator_id=#{operatorId},checked = #{operatorChecked},supdated = #{supdated}
|
|
|
- where banner_id = #{bannerId}
|
|
|
- </update>
|
|
|
- <select id="countByOperator" parameterType="HashMap" resultType="int">
|
|
|
- select count(*) from t_banner b inner join t_banner_template bt on b.banner_template_id = bt.id left join t_banner_operator bo
|
|
|
-on b.id=bo.banner_id and bo.operator_id=#{operatorId}
|
|
|
-where b.status = 0 and bt.status = 0 and b.checked = 1
|
|
|
- <if test="zoneList.size()>0">
|
|
|
- and
|
|
|
- <foreach item="zone" collection="zoneList"
|
|
|
- open="(" separator="or" close=")" >
|
|
|
- bt.width <= #{zone.width} and bt.height <= #{zone.height}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="searchKey!=null and searchValue!=null">
|
|
|
- and bt.name like #{searchValue}
|
|
|
- </if>
|
|
|
- <if test="operatorChecked!=null">
|
|
|
- <choose>
|
|
|
- <when test="operatorChecked == 0">
|
|
|
- and ISNULL(bo.checked) or bo.checked =0
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- and bo.checked=#{operatorChecked}
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
- </if>
|
|
|
- </select>
|
|
|
+
|
|
|
</mapper>
|