123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527 |
- <?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="advertiserSqlMapper">
-
- <!--广告主端 广告主list页面数据总条数 -->
- <select id="countByParams" parameterType="java.util.Map" resultType="java.lang.Integer">
- select count(t.advertiserId) from (
- SELECT
- tar.id advertiserId
- FROM
- t_advertiser tar
- LEFT JOIN t_order tor ON tar.id = tor.advertiser_id
- LEFT JOIN t_industry tiy ON tar.industry_id = tiy.id
- WHERE tar. STATUS != - 1
- <if test="value!=null">
- and tar.name like #{value}
- </if>
- <if test="status!=null">
- and tar.status = #{status}
- </if>
- <if test="industryId!=null">
- and tar.industry_id = #{industryId}
- </if>
- <if test="agentId!=null">
- and tar.agent_id = #{agentId}
- </if>
- GROUP BY tar.id
- )t
- </select>
-
- <!--广告主端 广告主list页面数据加载 -->
- <select id="selectByParams" parameterType="java.util.Map" resultType="com.cloudcross.ssp.model.Advertiser">
- select
- tar.id id,
- tar.name name,
- tiy.name industryName,
- count(tor.id) as orderNum,
- tar.updated updated,
- tar.status status
- from t_advertiser tar
- LEFT JOIN t_order tor on tar.id = tor.advertiser_id
- LEFT JOIN t_industry tiy ON tar.industry_id = tiy.id
- where tar.status != -1
- <if test="value!=null">
- and tar.name like #{value}
- </if>
- <if test="status!=null">
- and tar.status = #{status}
- </if>
- <if test="industryId!=null">
- and tar.industry_id = #{industryId}
- </if>
- <if test="agentId!=null">
- and tar.agent_id = #{agentId}
- </if>
- group by tar.id order by tar.id desc
- limit #{pager.offset}, #{pager.limit}
- </select>
-
- <!-- 根据广告主ID来查询一条信息 -->
- <select id="selectById" parameterType="java.lang.Integer" resultType="com.cloudcross.ssp.model.Advertiser">
- SELECT
- tar.id id,
- tar.industry_id industryId,
- tar.agent_id agentId,
- tar.operator_id operatorId,
- tar.name name,
- tar.reg_name regName,
- tar.homepage homePage,
- tar.contacts contacts,
- tar.tel tel,
- tar.email email,
- tar.memo memo,
- tar.balance balance,
- tar.cpi_path cpiPath,
- tar.licence_path licencePath,
- tar.id_path idPath,
- tar.org_path orgPath,
- tar.check_account checkAccount,
- tar.check_status checkStatus,
- tar.check_memo checkMemo,
- tar.admin_id adminId,
- tar.status status,
- tar.updated updated
- FROM
- t_advertiser tar where id = #{id}
- </select>
-
- <!-- 添加 -->
- <insert id="addAdvertiser" parameterType="com.cloudcross.ssp.model.Advertiser">
- insert into t_advertiser
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="industryId != null">
- industry_id,
- </if>
- <if test="agentId != null">
- agent_id,
- </if>
- <if test="operatorId != null">
- operator_id,
- </if>
- <if test="name != null">
- name,
- </if>
- <if test="regName != null">
- reg_name,
- </if>
- <if test="homePage != null">
- homePage,
- </if>
- <if test="contacts != null">
- contacts,
- </if>
- <if test="tel != null">
- tel,
- </if>
- <if test="email != null">
- email,
- </if>
- <if test="memo != null">
- memo,
- </if>
- <if test="balance != null">
- balance,
- </if>
- <if test="cpiPath != null">
- cpi_path,
- </if>
- <if test="licencePath != null">
- licence_path,
- </if>
- <if test="idPath != null">
- id_path,
- </if>
- <if test="orgPath != null">
- org_path,
- </if>
- <if test="checkAccount != null">
- check_account,
- </if>
- <if test="checkStatus != null">
- check_status,
- </if>
- <if test="checkMemo != null">
- check_memo,
- </if>
- <if test="adminId != null">
- admin_id,
- </if>
- <if test="status != null">
- status,
- </if>
- <if test="updated != null">
- updated
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="industryId != null">
- #{industryId},
- </if>
- <if test="agentId != null">
- #{agentId},
- </if>
- <if test="operatorId != null">
- #{operatorId},
- </if>
- <if test="name != null">
- #{name},
- </if>
- <if test="regName != null">
- #{regName},
- </if>
- <if test="homePage != null">
- #{homePage},
- </if>
- <if test="contacts != null">
- #{contacts},
- </if>
- <if test="tel != null">
- #{tel},
- </if>
- <if test="email != null">
- #{email},
- </if>
- <if test="memo != null">
- #{memo},
- </if>
- <if test="balance != null">
- #{balance},
- </if>
- <if test="cpiPath != null">
- #{cpiPath},
- </if>
- <if test="licencePath != null">
- #{licencePath},
- </if>
- <if test="idPath != null">
- #{idPath},
- </if>
- <if test="orgPath != null">
- #{orgPath,jdbcType=VARCHAR},
- </if>
- <if test="checkAccount != null">
- #{checkAccount},
- </if>
- <if test="checkStatus != null">
- #{checkStatus},
- </if>
- <if test="checkMemo != null">
- #{checkMemo},
- </if>
- <if test="adminId != null">
- #{adminId},
- </if>
- <if test="status != null">
- #{status},
- </if>
- <if test="updated != null">
- #{updated},
- </if>
- </trim>
- </insert>
-
- <!-- 修改 -->
- <update id="editAdvertiser" parameterType="com.cloudcross.ssp.model.Advertiser">
- update t_advertiser set
- <trim suffix="" suffixOverrides=",">
- <if test="industryId != null">
- industry_id = #{industryId},
- </if>
- <if test="agentId != null">
- agent_id = #{agentId},
- </if>
- <if test="operatorId != null">
- operator_id = #{operatorId},
- </if>
- <if test="name != null">
- name = #{name},
- </if>
- <if test="regName != null">
- reg_name = #{regName},
- </if>
- <if test="homePage != null">
- homePage = #{homePage},
- </if>
- <if test="contacts != null">
- contacts = #{contacts},
- </if>
- <if test="tel != null">
- tel = #{tel},
- </if>
- <if test="email != null">
- email = #{email},
- </if>
- <if test="memo != null">
- memo = #{memo},
- </if>
- <if test="balance != null">
- balance = #{balance},
- </if>
- <if test="cpiPath != null">
- cpi_path = #{cpiPath},
- </if>
- <if test="licencePath != null">
- licence_path = #{licencePath},
- </if>
- <if test="idPath != null">
- id_path = #{idPath},
- </if>
- <if test="orgPath != null">
- org_path = #{orgPath},
- </if>
- <if test="checkAccount != null">
- check_account = #{checkAccount},
- </if>
- <if test="checkStatus != null">
- check_status = #{checkStatus},
- </if>
- <if test="checkMemo != null">
- check_memo = #{checkMemo},
- </if>
- <if test="adminId != null">
- admin_id = #{adminId},
- </if>
- <if test="status != null">
- status = #{status},
- </if>
- <if test="updated != null">
- updated = #{updated,jdbcType=TIMESTAMP}
- </if>
- where id = #{id}
- </trim>
- </update>
-
- <sql id="base_column">
- t_advertiser.id as id,
- t_advertiser.agent_id as agentId,
- industry_id as industryId,
- t_advertiser.name as name,
- reg_name as regName,
- homepage as homePage,
- t_advertiser.contacts,
- t_advertiser.tel as tel,
- t_advertiser.email as email,
- t_advertiser.balance as balance,
- t_advertiser.status as status,
- t_advertiser.memo as memo,
- t_advertiser.cpi_path as cpiPath,
- t_advertiser.licence_path as licencePath,
- t_advertiser.id_path as idPath,
- t_advertiser.org_path as orgPath,
- t_advertiser.check_account as checkAccount,
- t_advertiser.check_status as checkStatus,
- t_advertiser.check_memo as checkMemo,
- t_advertiser.admin_id as adminId,
- t_advertiser.updated as updated
- </sql>
-
- <select id="selectByAgentId" parameterType="int" resultType="com.cloudcross.ssp.model.Advertiser">
- select
- <include refid="base_column" />
- from t_advertiser
- <where>
- agent_id = #{id} and
- status != -1
- </where>
- </select>
-
- <select id="selectByName" parameterType="String" resultType="long">
- select
- max(id)
- from t_advertiser
- <where>
- name = #{name} and
- status != -1
- </where>
- </select>
-
- <select id="selectByOperatoradvertiser" parameterType="int" resultType="com.cloudcross.ssp.model.Advertiser">
- select
- <include refid="base_column" />
- from t_advertiser
- <where>
- agent_id = #{operatorId} and
- status != -1.
- </where>
- </select>
-
- <select id="selectByOperatoroperator" parameterType="int" resultType="com.cloudcross.ssp.model.Advertiser">
- select
- <include refid="base_column" />
- from t_advertiser
- <where>
- operator_id = #{operatorId} and
- status != -1.
- </where>
- </select>
-
-
- <select id="selectByParamsback" parameterType="map" resultType="com.cloudcross.ssp.model.Advertiser">
- select
- <include refid="base_column" />
- ,b.name as industryName, count(c.advertiser_id) as orderNum from t_industry b,t_advertiser left join t_order c
- on t_advertiser.id = c.advertiser_id
- where 1 = 1
- <if test="value!=null">
- and t_advertiser.name like #{value}
- </if>
- <if test="status!=null">
- and t_advertiser.status = #{status}
- </if>
- <if test="industryId!=null">
- and t_advertiser.industry_id = #{industryId}
- </if>
- <if test="agentId!=null">
- and t_advertiser.agent_id = #{agentId}
- </if>
- and t_advertiser.status != -1
- and t_advertiser.industry_id = b.id
- group by t_advertiser.id
- order by t_advertiser.id desc
- limit #{pager.offset}, #{pager.limit}
- </select>
- <select id="selectByParamsoperator" parameterType="map" resultType="com.cloudcross.ssp.model.Advertiser">
- select
- <include refid="base_column" />
- ,b.name as industryName, count(c.advertiser_id) as orderNum from t_industry b,t_advertiser left join t_order c
- on t_advertiser.id = c.advertiser_id
- where 1 = 1
- <if test="key!=null and value!=null">
- <choose>
- <when test="key=='name'">
- and t_advertiser.name like #{value}
- </when>
- </choose>
- </if>
- <if test="status!=null">
- and t_advertiser.status = #{status}
- </if>
- <if test="industryId!=null">
- and t_advertiser.industry_id = #{industryId}
- </if>
- and t_advertiser.status != -1
- and t_advertiser.industry_id = b.id
- group by t_advertiser.id
- order by t_advertiser.id desc
- limit #{pager.offset}, #{pager.limit}
- </select>
-
- <select id="selectByStatus" parameterType="map" resultType="com.cloudcross.ssp.model.Advertiser">
- select
- <include refid="base_column" />
- ,b.name as industryName, count(c.advertiser_id) as orderNum from t_industry b,t_advertiser left join t_order c
- on t_advertiser.id = c.advertiser_id
- where 1 = 1
- and t_advertiser.status = #{status}
- and t_advertiser.industry_id = b.id
- group by t_advertiser.id
- order by t_advertiser.id desc
- limit #{pager.offset}, #{pager.limit}
- </select>
-
- <select id="countByStatus" parameterType="map" resultType="int">
- select count(a.id)
- from t_advertiser a where status = #{status}
- </select>
-
-
- <select id="countByParamsoperator" parameterType="map" resultType="int">
- select count(a.id)
- from t_advertiser a where status != -1
- <if test="key!=null and value!=null">
- <choose>
- <when test="key=='name'">
- and a.name like #{value}
- </when>
- </choose>
- </if>
- <if test="status!=null">
- and a.status = #{status}
- </if>
- <if test="industryId!=null">
- and a.industry_id = #{industryId}
- </if>
- </select>
-
-
-
- <insert id="addAdvertiserback" parameterType="com.cloudcross.ssp.model.Advertiser">
- insert into t_advertiser(industry_id,name,reg_name,homepage,contacts,tel,email,memo
- ,cpi_path,licence_path,id_path,org_path,check_memo,updated)
- values(#{industryId},#{name},#{regName},#{homePage},#{contacts},#{tel}, #{email},#{memo}
- ,#{cpiPath},#{licencePath},#{idPath}, #{orgPath},#{checkMemo},NOW())
- </insert>
-
- <insert id="addAdvertiseroperator" parameterType="com.cloudcross.ssp.model.Advertiser">
- insert into t_advertiser(industry_id,name,reg_name,homepage,contacts,tel,email,updated,memo)
- values(#{industryId},#{name},#{regName},#{homePage},#{contacts},#{tel}, #{email},#{updated},#{memo})
- </insert>
-
-
- <update id="editAdvertiserback" parameterType="com.cloudcross.ssp.model.Advertiser">
- update t_advertiser
- set industry_id = #{industryId},name = #{name},reg_name = #{regName},homepage = #{homePage},contacts = #{contacts},tel=#{tel}
- ,email = #{email},memo = #{memo},updated = NOW()
- ,cpi_path = #{cpiPath},licence_path = #{licencePath},id_path = #{idPath},org_path = #{orgPath},check_memo = #{checkMemo}
- where t_advertiser.id=#{id}
- </update>
-
- <update id="editAdvertiseroperator" parameterType="com.cloudcross.ssp.model.Advertiser">
- update t_advertiser
- set industry_id = #{industryId},name = #{name},reg_name = #{regName},homepage = #{homePage},contacts = #{contacts},tel=#{tel}
- ,email = #{email},updated = #{updated},memo = #{memo}
- where t_advertiser.id=#{id}
- </update>
-
- <update id="updateAdvertiserStatus" parameterType="HashMap">
- update t_advertiser
- set status = #{status},updated = #{modifyDate}
- where t_advertiser.id in
- <foreach item="advertiserId" collection="advertiserIdList"
- open="(" separator="," close=")">
- #{advertiserId}
- </foreach>
- </update>
- <update id="updateSupdated" parameterType="HashMap">
- update t_adgroup
- set t_adgroup.supdated= NOW()
- where t_adgroup.advertiser_id in
- <foreach item="advertiserId" collection="advertiserIdList"
- open="(" separator="," close=")">
- #{advertiserId}
- </foreach>
- </update>
-
- <!-- 导出Excel用 -->
- <select id="findDeliverEffectAnalysis" parameterType="map" resultType="com.cloudcross.ssp.model.Advertiser">
- select
- <include refid="base_column" />
- ,b.name as industryName, count(c.advertiser_id) as orderNum from t_industry b,t_advertiser left join t_order c
- on t_advertiser.id = c.advertiser_id
- where 1 = 1
- <if test="key!=null and value!=null">
- <choose>
- <when test="key=='name'">
- and t_advertiser.name like #{value}
- </when>
- </choose>
- </if>
- <if test="status!=null">
- and t_advertiser.status = #{status}
- </if>
- <if test="industryId!=null">
- and t_advertiser.industry_id = #{industryId}
- </if>
- and t_advertiser.status != -1
- and t_advertiser.industry_id = b.id
- group by t_advertiser.id
- order by t_advertiser.id desc
- </select>
-
- <select id="selectAdvertiserNameById" parameterType="int" resultType="String">
- select name from t_advertiser where id = #{id}
- </select>
- </mapper>
|