123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- <?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 <= #{date} and #{date} <= 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>
-
-
- </mapper>
|