|
@@ -2,6 +2,296 @@
|
|
|
<!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,
|
|
@@ -26,16 +316,6 @@
|
|
|
t_advertiser.updated as updated
|
|
|
</sql>
|
|
|
|
|
|
- <select id="selectById" parameterType="int" resultType="com.cloudcross.ssp.model.Advertiser">
|
|
|
- select
|
|
|
- <include refid="base_column" />
|
|
|
- from t_advertiser
|
|
|
- <where>
|
|
|
- id = #{id} and
|
|
|
- status != -1
|
|
|
- </where>
|
|
|
- </select>
|
|
|
-
|
|
|
<select id="selectByAgentId" parameterType="int" resultType="com.cloudcross.ssp.model.Advertiser">
|
|
|
select
|
|
|
<include refid="base_column" />
|
|
@@ -76,30 +356,6 @@
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectByParamsadvertiser" 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 and c.status != -1
|
|
|
- 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="selectByParamsback" parameterType="map" resultType="com.cloudcross.ssp.model.Advertiser">
|
|
|
select
|
|
@@ -170,22 +426,6 @@
|
|
|
from t_advertiser a where status = #{status}
|
|
|
</select>
|
|
|
|
|
|
- <select id="countByParamsadvertiser" parameterType="map" resultType="int">
|
|
|
- select count(a.id)
|
|
|
- from t_advertiser a where status != -1
|
|
|
- <if test="value!=null">
|
|
|
- and a.name like #{value}
|
|
|
- </if>
|
|
|
- <if test="status!=null">
|
|
|
- and a.status = #{status}
|
|
|
- </if>
|
|
|
- <if test="industryId!=null">
|
|
|
- and a.industry_id = #{industryId}
|
|
|
- </if>
|
|
|
- <if test="agentId!=null">
|
|
|
- and a.agent_id = #{agentId}
|
|
|
- </if>
|
|
|
- </select>
|
|
|
|
|
|
<select id="countByParamsoperator" parameterType="map" resultType="int">
|
|
|
select count(a.id)
|
|
@@ -205,12 +445,7 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
- <insert id="addAdvertiseradvertiser" parameterType="com.cloudcross.ssp.model.Advertiser">
|
|
|
- insert into t_advertiser(industry_id,agent_id,name,reg_name,homepage,contacts,tel,email,memo
|
|
|
- ,cpi_path,licence_path,id_path,org_path,check_memo,updated)
|
|
|
- values(#{industryId},#{agentId},#{name},#{regName},#{homePage},#{contacts},#{tel}, #{email},#{memo}
|
|
|
- ,#{cpiPath},#{licencePath},#{idPath}, #{orgPath},#{checkMemo},NOW())
|
|
|
- </insert>
|
|
|
+
|
|
|
|
|
|
<insert id="addAdvertiserback" parameterType="com.cloudcross.ssp.model.Advertiser">
|
|
|
insert into t_advertiser(industry_id,name,reg_name,homepage,contacts,tel,email,memo
|
|
@@ -224,13 +459,7 @@
|
|
|
values(#{industryId},#{name},#{regName},#{homePage},#{contacts},#{tel}, #{email},#{updated},#{memo})
|
|
|
</insert>
|
|
|
|
|
|
- <update id="editAdvertiseradvertiser" 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(),admin_id = #{adminId}
|
|
|
- ,cpi_path = #{cpiPath},licence_path = #{licencePath},id_path = #{idPath},org_path = #{orgPath},check_memo = #{checkMemo}
|
|
|
- where t_advertiser.id=#{id}
|
|
|
- </update>
|
|
|
+
|
|
|
|
|
|
<update id="editAdvertiserback" parameterType="com.cloudcross.ssp.model.Advertiser">
|
|
|
update t_advertiser
|