123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- <?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="dspBannerSqlMapper">
- <sql id="base_column">
- id,
- dsp_id as dspId,
- advertiser_id as advertiserId,
- path,
- height,
- width,
- rheight,
- rwidth,
- state,
- memo,
- updated
- </sql>
- <insert id="add" parameterType="java.util.List">
- insert into t_dsp_banner(dsp_id,advertiser_id,path,height,width,rheight,rwidth,state,memo,updated) values
- <foreach collection="dspBannerList" item="item" index="index" separator=",">
- ( #{item.dspId}, #{item.advertiserId}, #{item.path}, #{item.height}, #{item.width},
- #{item.rheight}, #{item.rwidth}, 1, "", NOW() )
- </foreach>
- </insert>
-
- <update id="update" parameterType="java.util.List">
- <foreach collection="dspBannerList" item="item" index="index" open="" close="" separator=";">
- update t_dsp_banner set path = #{item.path},height = #{item.height},width = #{item.width},
- rheight = #{item.rheight}, rwidth = #{item.rwidth}, state = #{item.state},
- <if test="item.memo != null and item.memo != '' ">
- memo = #{item.memo},
- </if>
- updated = NOW()
- where id=#{item.id} and dsp_id = #{item.dspId} and advertiser_id = #{item.advertiserId}
- </foreach>
- </update>
-
- <select id="getAll" parameterType="java.util.Map" resultType="com.cloudcross.ssp.model.DspBanner">
- select <include refid="base_column"/>
- from t_dsp_banner where advertiser_id in
- <foreach item="advertiserId" collection="advertiserIdList" open="(" separator="," close=")">
- #{advertiserId}
- </foreach>
- and dsp_id = #{dspId}
- </select>
-
- <select id="get" parameterType="java.util.Map" resultType="com.cloudcross.ssp.model.DspBanner">
- select
- <include refid="base_column"/>
- from t_dsp_banner where id in
- <foreach item="bannerId" collection="bannerIdList" open="(" separator="," close=")">
- #{bannerId}
- </foreach>
- <if test="dspId != null and dspId != '' ">
- and dsp_id = #{dspId}
- </if>
- <if test="advertiserId != null and advertiserId != '' ">
- and advertiser_id = #{advertiserId}
- </if>
- </select>
-
- <select id="selectMaxId" parameterType="java.util.Map" resultType="java.lang.Long">
- select id from t_dsp_banner where dsp_id = #{dspId} and advertiser_id = #{advertiserId}
- <if test="bannerId != null and bannerId != '' ">
- and id != #{bannerId}
- </if>
- </select>
-
- <select id="queryState" parameterType="java.util.Map" resultType="java.util.Map">
- select id as bannerId,dsp_id as dspId,advertiser_id as advertiserId,state,memo as refuseReason
- from t_dsp_banner where id in
- <foreach item="bannerId" collection="bannerIdList" open="(" separator="," close=")">
- #{bannerId}
- </foreach>
- <if test="dspId != null and dspId != '' ">
- and dsp_id = #{dspId}
- </if>
- <if test="advertiserId != null and advertiserId != '' ">
- and advertiser_id = #{advertiserId}
- </if>
- </select>
-
- <select id="countByParams" parameterType="java.util.Map" resultType="int">
- select count(*)
- from t_dsp_banner a ,t_dsp_agent b
- <where>
- a.dsp_id = b.id
- <if test="searchValue !=null">
- and b.name like #{searchValue}
- </if>
- <if test="backState !=null">
- and a.state = #{backState}
- </if>
- </where>
- </select>
-
- <select id="findByParams" parameterType="java.util.Map" resultType="java.util.Map">
- select a.id,a.dsp_id,a.path,a.width,a.height,a.rwidth,a.rheight,a.state,a.memo,a.updated,b.name
- from t_dsp_banner a,t_dsp_agent b
- <where>
- a.dsp_id = b.id
- <if test="searchValue !=null">
- and b.name like #{searchValue}
- </if>
- <if test="backState !=null">
- and a.state = #{backState}
- </if>
- </where>
- order by a.id desc
- limit #{pager.offset}, #{pager.limit}
- </select>
-
- <update id="updateBackPass" parameterType="HashMap">
- update t_dsp_banner a ,t_dsp_banner_operator b
- set a.state=#{state},a.updated=#{updated},
- b.checked=0,b.supdated=#{supdated}
- where a.id = b.banner_id and a.id in
- <foreach item="id" collection="auditIdList" open="(" separator=","
- close=")">
- #{id}
- </foreach>
- </update>
-
- <update id="updateBackNoPass" parameterType="HashMap">
- update t_dsp_banner a ,t_dsp_banner_operator b
- set a.state=#{state},a.updated=#{updated},a.memo=#{memo},
- b.checked=3,b.supdated=#{supdated}
- where a.id = b.banner_id and a.id in
- <foreach item="id" collection="auditIdList" open="(" separator=","
- close=")">
- #{id}
- </foreach>
- </update>
-
-
-
- <select id="findByParamMap" parameterType="java.util.Map" resultType="java.util.Map">
- select a.id,a.dsp_id,a.path,a.width,a.height,a.rwidth,a.rheight,a.state,a.memo,a.updated,b.name
- from t_dsp_banner a,t_dsp_agent b
- <where>
- a.dsp_id = b.id
- <if test="searchValue !=null">
- and b.name like #{searchValue}
- </if>
- <if test="backState !=null">
- and a.state = #{backState}
- </if>
- </where>
- </select>
- <!-- ssssss后台审核通过后续判断是否t_dsp_operator有没有则添加 -->
- <select id="countByParamsOperator" parameterType="java.util.Map" resultType="int">
- select count(*)
- from t_dsp_banner a
- INNER JOIN t_dsp_agent b on a.dsp_id = b.id
- LEFT JOIN t_dsp_banner_operator c on a.id = c.banner_id and a.dsp_id = c.dsp_id
- <where>
- a.state =0
- <if test="zoneList.size()>0">
- and
- <foreach item="zone" collection="zoneList"
- open="(" separator="or" close=")" >
- a.rwidth <= #{zone.rwidth} and a.rheight <= #{zone.rheight}
- </foreach>
- </if>
- <if test="searchValue !=null">
- and b.name like #{searchValue}
- </if>
- <if test="operatorChecked !=null">
- and c.checked = #{operatorChecked}
- </if>
- </where>
- </select>
-
- <select id="findByParamsOperator" parameterType="java.util.Map" resultType="java.util.Map">
- select a.id,a.dsp_id,a.path,a.width,a.height,a.rwidth,a.rheight,a.state,a.memo,c.checked,c.supdated,b.name
- from t_dsp_banner a
- INNER JOIN t_dsp_agent b on a.dsp_id = b.id
- LEFT JOIN t_dsp_banner_operator c on a.id = c.banner_id and a.dsp_id = c.dsp_id
- <where>
- a.state =0
- <if test="zoneList.size()>0">
- and
- <foreach item="zone" collection="zoneList"
- open="(" separator="or" close=")" >
- a.rwidth <= #{zone.rwidth} and a.rheight <= #{zone.rheight}
- </foreach>
- </if>
- <if test="searchValue !=null">
- and b.name like #{searchValue}
- </if>
- <if test="operatorChecked !=null">
- and c.checked = #{operatorChecked}
- </if>
- </where>
- order by a.id desc
- limit #{pager.offset}, #{pager.limit}
- </select>
-
-
- <update id="updateOperatorPass" parameterType="HashMap">
- update t_dsp_banner a ,t_dsp_banner_operator b
- set a.updated=#{updated},
- b.checked=#{checked},b.supdated=#{supdated}
- where a.id = b.banner_id and a.id =#{bannerId}
- </update>
-
- <update id="updateOperatorNoPass" parameterType="HashMap">
- update t_dsp_banner a ,t_dsp_banner_operator b
- set a.updated=#{updated},a.memo=#{memo},
- b.checked=#{checked},b.supdated=#{supdated}
- where a.id = b.banner_id and a.id =#{bannerId}
- </update>
-
-
- <select id="getState" parameterType="HashMap" resultType="int">
- select IFNULL(checked,-1) as checked from t_dsp_banner_operator
- where operator_id=#{operatorId} and banner_id = #{bannerId}
- </select>
-
- <select id="findById" parameterType="int" resultType="DspBanner">
- select <include refid="base_column"/> from t_dsp_banner where id = #{id}
- </select>
-
- <insert id="addBannerOperator" parameterType="HashMap">
- insert t_dsp_banner_operator set
- operator_id = #{operatorId},
- dsp_id = #{dspId},
- banner_id = #{bannerId},
- checked = 0,
- supdated = #{supdated}
-
- </insert>
-
- </mapper>
|