|
@@ -2,137 +2,292 @@
|
|
|
<!DOCTYPE mapper
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
-<mapper namespace="com.ruixuan.jinniu.mapper.KuaishouProjectMapper">
|
|
|
+<mapper namespace="com.ruixuan.jinniu.mapper.KuaishouAccountMapper">
|
|
|
|
|
|
- <resultMap type="com.ruixuan.jinniu.entity.KuaishouProject" id="KuaishouProjectResult">
|
|
|
+ <resultMap type="com.ruixuan.jinniu.entity.KuaishouAccount" id="KuaishouAccountResult">
|
|
|
<result property="id" column="id"/>
|
|
|
+ <result property="accountId" column="account_id"/>
|
|
|
+ <result property="accountName" column="account_name"/>
|
|
|
+ <result property="projectId" column="project_id"/>
|
|
|
<result property="projectName" column="project_name"/>
|
|
|
<result property="mediaCode" column="media_code"/>
|
|
|
- <result property="supplierCode" column="supplier_code"/>
|
|
|
- <result property="saleId" column="sale_id"/>
|
|
|
- <result property="saleName" column="sale_name"/>
|
|
|
- <result property="businessId" column="business_id"/>
|
|
|
- <result property="businessName" column="business_name"/>
|
|
|
- <result property="designResponsibleId" column="design_responsible_id"/>
|
|
|
- <result property="designResponsibleName" column="design_responsible_name"/>
|
|
|
- <result property="ocpxActionType" column="ocpx_action_type"/>
|
|
|
- <result property="advertiserName" column="advertiser_name"/>
|
|
|
- <result property="advertiserId" column="advertiser_id"/>
|
|
|
+ <result property="ksId" column="ks_id"/>
|
|
|
+ <result property="ksName" column="ks_name"/>
|
|
|
+ <result property="operatorId" column="operator_id"/>
|
|
|
+ <result property="operatorName" column="operator_name"/>
|
|
|
+ <result property="productName" column="product_name"/>
|
|
|
+ <result property="industry" column="industry"/>
|
|
|
+ <result property="secondIndustry" column="second_industry"/>
|
|
|
+ <result property="corporationName" column="corporation_name"/>
|
|
|
+ <result property="accountStatus" column="account_status"/>
|
|
|
+ <result property="accountType" column="account_type"/>
|
|
|
+ <result property="bindTime" column="bind_time"/>
|
|
|
+ <result property="accountCreateTime" column="account_create_time"/>
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
</resultMap>
|
|
|
|
|
|
- <sql id="selectKuaishouProjectVo">
|
|
|
+ <sql id="selectKuaishouAccountVo">
|
|
|
select id,
|
|
|
+ account_id,
|
|
|
+ account_name,
|
|
|
+ project_id,
|
|
|
project_name,
|
|
|
media_code,
|
|
|
- supplier_code,
|
|
|
- sale_id,
|
|
|
- sale_name,
|
|
|
- business_id,
|
|
|
- business_name,
|
|
|
- design_responsible_id,
|
|
|
- design_responsible_name,
|
|
|
- ocpx_action_type,
|
|
|
- advertiser_name,
|
|
|
- advertiser_id,
|
|
|
+ ks_id,
|
|
|
+ ks_name,
|
|
|
+ operator_id,
|
|
|
+ operator_name,
|
|
|
+ product_name,
|
|
|
+ industry,
|
|
|
+ second_industry,
|
|
|
+ corporation_name,
|
|
|
+ account_status,
|
|
|
+ account_type,
|
|
|
+ bind_time,
|
|
|
+ account_create_time,
|
|
|
create_time,
|
|
|
update_time
|
|
|
- from Kuaishou_project
|
|
|
+ from kuaishou_account
|
|
|
</sql>
|
|
|
|
|
|
- <select id="selectKuaishouProjectList" parameterType="com.ruixuan.jinniu.entity.KuaishouProject" resultMap="KuaishouProjectResult">
|
|
|
- <include refid="selectKuaishouProjectVo"/>
|
|
|
+ <select id="selectKuaishouAccountList" parameterType="com.ruixuan.jinniu.entity.KuaishouAccount"
|
|
|
+ resultMap="KuaishouAccountResult">
|
|
|
+ <include refid="selectKuaishouAccountVo"/>
|
|
|
<where>
|
|
|
- <if test="projectName != null and projectName != ''">and project_name like concat('%', #{projectName},
|
|
|
- '%')
|
|
|
+ <if test="accountId != null ">
|
|
|
+ and account_id = #{accountId}
|
|
|
</if>
|
|
|
- <if test="mediaCode != null and mediaCode != ''">and media_code = #{mediaCode}</if>
|
|
|
- <if test="supplierCode != null and supplierCode != ''">and supplier_code = #{supplierCode}</if>
|
|
|
- <if test="saleId != null ">and sale_id = #{saleId}</if>
|
|
|
- <if test="saleName != null and saleName != ''">and sale_name like concat('%', #{saleName}, '%')</if>
|
|
|
- <if test="businessId != null ">and business_id = #{businessId}</if>
|
|
|
- <if test="businessName != null and businessName != ''">and business_name like concat('%', #{businessName},
|
|
|
- '%')
|
|
|
+ <if test="accountName != null and accountName != ''">
|
|
|
+ and account_name like concat('%', #{accountName}, '%')
|
|
|
</if>
|
|
|
- <if test="designResponsibleId != null ">and design_responsible_id = #{designResponsibleId}</if>
|
|
|
- <if test="designResponsibleName != null and designResponsibleName != ''">and design_responsible_name like
|
|
|
- concat('%', #{designResponsibleName}, '%')
|
|
|
+ <if test="userList != null and userList.size() >0 ">
|
|
|
+ and operator_id in
|
|
|
+ <foreach collection="userList" item="userId" open="(" separator="," close=")">
|
|
|
+ #{userId}
|
|
|
+ </foreach>
|
|
|
</if>
|
|
|
- <if test="ocpxActionType != null and ocpxActionType != ''">and ocpx_action_type = #{ocpxActionType}</if>
|
|
|
- <if test="advertiserName != null and advertiserName != ''">and advertiser_name like concat('%',
|
|
|
- #{advertiserName}, '%')
|
|
|
- </if>
|
|
|
- <if test="advertiserId != null and advertiserId != ''">and advertiser_id = #{advertiserId}</if>
|
|
|
</where>
|
|
|
+ order by create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getAccountByProjectId" parameterType="com.ruixuan.jinniu.entity.KuaishouAccount"
|
|
|
+ resultMap="KuaishouAccountResult">
|
|
|
+ <include refid="selectKuaishouAccountVo"/>
|
|
|
+ where project_id = #{projectId}
|
|
|
+ order by create_time desc
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectKuaishouProjectById" parameterType="Long" resultMap="KuaishouProjectResult">
|
|
|
- <include refid="selectKuaishouProjectVo"/>
|
|
|
+ <select id="selectKuaishouAccountById" parameterType="Long" resultMap="KuaishouAccountResult">
|
|
|
+ <include refid="selectKuaishouAccountVo"/>
|
|
|
where id = #{id}
|
|
|
</select>
|
|
|
|
|
|
- <insert id="insertKuaishouProject" parameterType="com.ruixuan.jinniu.entity.KuaishouProject" useGeneratedKeys="true" keyProperty="id">
|
|
|
- insert into Kuaishou_project
|
|
|
+ <insert id="insertKuaishouAccount" parameterType="com.ruixuan.jinniu.entity.KuaishouAccount" useGeneratedKeys="true"
|
|
|
+ keyProperty="id">
|
|
|
+ insert into kuaishou_account
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="accountId != null">account_id,</if>
|
|
|
+ <if test="accountName != null">account_name,</if>
|
|
|
+ <if test="projectId != null">project_id,</if>
|
|
|
<if test="projectName != null">project_name,</if>
|
|
|
<if test="mediaCode != null">media_code,</if>
|
|
|
- <if test="supplierCode != null">supplier_code,</if>
|
|
|
- <if test="saleId != null">sale_id,</if>
|
|
|
- <if test="saleName != null">sale_name,</if>
|
|
|
- <if test="businessId != null">business_id,</if>
|
|
|
- <if test="businessName != null">business_name,</if>
|
|
|
- <if test="designResponsibleId != null">design_responsible_id,</if>
|
|
|
- <if test="designResponsibleName != null">design_responsible_name,</if>
|
|
|
- <if test="ocpxActionType != null">ocpx_action_type,</if>
|
|
|
- <if test="advertiserName != null">advertiser_name,</if>
|
|
|
- <if test="advertiserId != null">advertiser_id,</if>
|
|
|
+ <if test="ksId != null">ks_id,</if>
|
|
|
+ <if test="ksName != null">ks_name,</if>
|
|
|
+ <if test="operatorId != null">operator_id,</if>
|
|
|
+ <if test="operatorName != null">operator_name,</if>
|
|
|
+ <if test="productName != null">product_name,</if>
|
|
|
+ <if test="industry != null">industry,</if>
|
|
|
+ <if test="secondIndustry != null">second_industry,</if>
|
|
|
+ <if test="corporationName != null">corporation_name,</if>
|
|
|
+ <if test="accountStatus != null">account_status,</if>
|
|
|
+ <if test="accountType != null">account_type,</if>
|
|
|
+ <if test="bindTime != null">bind_time,</if>
|
|
|
+ <if test="accountCreateTime != null">account_create_time,</if>
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="accountId != null">#{accountId},</if>
|
|
|
+ <if test="accountName != null">#{accountName},</if>
|
|
|
+ <if test="projectId != null">#{projectId},</if>
|
|
|
<if test="projectName != null">#{projectName},</if>
|
|
|
<if test="mediaCode != null">#{mediaCode},</if>
|
|
|
- <if test="supplierCode != null">#{supplierCode},</if>
|
|
|
- <if test="saleId != null">#{saleId},</if>
|
|
|
- <if test="saleName != null">#{saleName},</if>
|
|
|
- <if test="businessId != null">#{businessId},</if>
|
|
|
- <if test="businessName != null">#{businessName},</if>
|
|
|
- <if test="designResponsibleId != null">#{designResponsibleId},</if>
|
|
|
- <if test="designResponsibleName != null">#{designResponsibleName},</if>
|
|
|
- <if test="ocpxActionType != null">#{ocpxActionType},</if>
|
|
|
- <if test="advertiserName != null">#{advertiserName},</if>
|
|
|
- <if test="advertiserId != null">#{advertiserId},</if>
|
|
|
+ <if test="ksId != null">#{ksId},</if>
|
|
|
+ <if test="ksName != null">#{ksName},</if>
|
|
|
+ <if test="operatorId != null">#{operatorId},</if>
|
|
|
+ <if test="operatorName != null">#{operatorName},</if>
|
|
|
+ <if test="productName != null">#{productName},</if>
|
|
|
+ <if test="industry != null">#{industry},</if>
|
|
|
+ <if test="secondIndustry != null">#{secondIndustry},</if>
|
|
|
+ <if test="corporationName != null">#{corporationName},</if>
|
|
|
+ <if test="accountStatus != null">#{accountStatus},</if>
|
|
|
+ <if test="accountType != null">#{accountType},</if>
|
|
|
+ <if test="bindTime != null">#{bindTime},</if>
|
|
|
+ <if test="accountCreateTime != null">#{accountCreateTime},</if>
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
- <update id="updateKuaishouProject" parameterType="com.ruixuan.jinniu.entity.KuaishouProject">
|
|
|
- update Kuaishou_project
|
|
|
+ <update id="updateKuaishouAccount" parameterType="com.ruixuan.jinniu.entity.KuaishouAccount">
|
|
|
+ update kuaishou_account
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="accountId != null">account_id = #{accountId},</if>
|
|
|
+ <if test="accountName != null">account_name = #{accountName},</if>
|
|
|
+ <if test="projectId != null">project_id = #{projectId},</if>
|
|
|
<if test="projectName != null">project_name = #{projectName},</if>
|
|
|
<if test="mediaCode != null">media_code = #{mediaCode},</if>
|
|
|
- <if test="supplierCode != null">supplier_code = #{supplierCode},</if>
|
|
|
- <if test="saleId != null">sale_id = #{saleId},</if>
|
|
|
- <if test="saleName != null">sale_name = #{saleName},</if>
|
|
|
- <if test="businessId != null">business_id = #{businessId},</if>
|
|
|
- <if test="businessName != null">business_name = #{businessName},</if>
|
|
|
- <if test="designResponsibleId != null">design_responsible_id = #{designResponsibleId},</if>
|
|
|
- <if test="designResponsibleName != null">design_responsible_name = #{designResponsibleName},</if>
|
|
|
- <if test="ocpxActionType != null">ocpx_action_type = #{ocpxActionType},</if>
|
|
|
- <if test="advertiserName != null">advertiser_name = #{advertiserName},</if>
|
|
|
- <if test="advertiserId != null">advertiser_id = #{advertiserId},</if>
|
|
|
+ <if test="ksId != null">ks_id = #{ksId},</if>
|
|
|
+ <if test="ksName != null">ks_name = #{ksName},</if>
|
|
|
+ <if test="operatorId != null">operator_id = #{operatorId},</if>
|
|
|
+ <if test="operatorName != null">operator_name = #{operatorName},</if>
|
|
|
+ <if test="productName != null">product_name = #{productName},</if>
|
|
|
+ <if test="industry != null">industry = #{industry},</if>
|
|
|
+ <if test="secondIndustry != null">second_industry = #{secondIndustry},</if>
|
|
|
+ <if test="corporationName != null">corporation_name = #{corporationName},</if>
|
|
|
+ <if test="accountStatus != null">account_status = #{accountStatus},</if>
|
|
|
+ <if test="accountType != null">account_type = #{accountType},</if>
|
|
|
+ <if test="bindTime != null">bind_time = #{bindTime},</if>
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
</trim>
|
|
|
where id = #{id}
|
|
|
</update>
|
|
|
|
|
|
- <delete id="deleteKuaishouProjectById" parameterType="Long">
|
|
|
+ <update id="updateKuaishouAccountByAccountId" parameterType="com.ruixuan.jinniu.entity.KuaishouAccount">
|
|
|
+ update kuaishou_account
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="accountId != null">account_id = #{accountId},</if>
|
|
|
+ <if test="accountName != null">account_name = #{accountName},</if>
|
|
|
+ <if test="projectId != null">project_id = #{projectId},</if>
|
|
|
+ <if test="projectName != null">project_name = #{projectName},</if>
|
|
|
+ <if test="mediaCode != null">media_code = #{mediaCode},</if>
|
|
|
+ <if test="ksId != null">ks_id = #{ksId},</if>
|
|
|
+ <if test="ksName != null">ks_name = #{ksName},</if>
|
|
|
+ <if test="operatorId != null">operator_id = #{operatorId},</if>
|
|
|
+ <if test="operatorName != null">operator_name = #{operatorName},</if>
|
|
|
+ <if test="productName != null">product_name = #{productName},</if>
|
|
|
+ <if test="industry != null">industry = #{industry},</if>
|
|
|
+ <if test="secondIndustry != null">second_industry = #{secondIndustry},</if>
|
|
|
+ <if test="corporationName != null">corporation_name = #{corporationName},</if>
|
|
|
+ <if test="accountStatus != null">account_status = #{accountStatus},</if>
|
|
|
+ <if test="accountType != null">account_type = #{accountType},</if>
|
|
|
+ <if test="bindTime != null">bind_time = #{bindTime},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteKuaishouAccountById" parameterType="Long">
|
|
|
delete
|
|
|
- from Kuaishou_project
|
|
|
+ from kuaishou_account
|
|
|
where id = #{id}
|
|
|
</delete>
|
|
|
|
|
|
+ <select id="selectUnboundAccountList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ SELECT *
|
|
|
+ FROM (
|
|
|
+ <if test="status == null or status == '' ">
|
|
|
+ ( SELECT
|
|
|
+ t1.account_id as 'accountId',
|
|
|
+ t1.account_name as 'accountName',
|
|
|
+ 'JN' as 'type',
|
|
|
+ t1.user_id as 'ksId',
|
|
|
+ t1.user_name as 'ksName',
|
|
|
+ date_format(t1.account_create_time,'%Y-%m-%d') as 'accountCreateTime',
|
|
|
+ t1.product_name as 'productName',
|
|
|
+ '-' as 'operatorName'
|
|
|
+ FROM kuaishou_agent_account_list t1
|
|
|
+ WHERE NOT EXISTS
|
|
|
+ (SELECT 1 FROM kuaishou_account t2 WHERE t2.account_id = t1.account_id)
|
|
|
+ <if test="accountId != null and accountId != '' ">
|
|
|
+ AND t1.account_id = #{accountId}
|
|
|
+ </if>
|
|
|
+ <if test="accountName != null and accountName != '' ">
|
|
|
+ AND t1.account_name Like concat('%', #{accountName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="ksId != null and ksId != '' ">
|
|
|
+ AND t1.user_id = #{ksId}
|
|
|
+ </if>
|
|
|
+ ORDER BY account_create_time DESC
|
|
|
+ )
|
|
|
+ union all
|
|
|
+ (SELECT
|
|
|
+ account_id as 'accountId',
|
|
|
+ account_name as 'accountName',
|
|
|
+ media_code as 'type',
|
|
|
+ ks_id as 'ksId',
|
|
|
+ ks_name as 'ksName',
|
|
|
+ date_format(account_create_time,'%Y-%m-%d') as 'accountCreateTime',
|
|
|
+ product_name as 'productName',
|
|
|
+ operator_name as 'operatorName'
|
|
|
+ FROM kuaishou_account
|
|
|
+ <where>
|
|
|
+ <if test="accountId != null and accountId != '' ">
|
|
|
+ AND account_id = #{accountId}
|
|
|
+ </if>
|
|
|
+ <if test="accountName != null and accountName != '' ">
|
|
|
+ AND account_name Like concat('%', #{accountName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="ksId != null and ksId != '' ">
|
|
|
+ AND ks_id = #{ksId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY account_create_time DESC
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="status == 2 ">
|
|
|
+ SELECT
|
|
|
+ t1.account_id as 'accountId',
|
|
|
+ t1.account_name as 'accountName',
|
|
|
+ 'JN' as 'type',
|
|
|
+ t1.user_id as 'ksId',
|
|
|
+ t1.user_name as 'ksName',
|
|
|
+ date_format(t1.account_create_time,'%Y-%m-%d') as 'accountCreateTime',
|
|
|
+ t1.product_name as 'productName',
|
|
|
+ '-' as 'operatorName'
|
|
|
+ FROM kuaishou_agent_account_list t1
|
|
|
+ WHERE NOT EXISTS
|
|
|
+ (SELECT 1 FROM kuaishou_account t2 WHERE t2.account_id = t1.account_id)
|
|
|
+ <if test="accountId != null and accountId != '' ">
|
|
|
+ AND t1.account_id = #{accountId}
|
|
|
+ </if>
|
|
|
+ <if test="accountName != null and accountName != '' ">
|
|
|
+ AND t1.account_name Like concat('%', #{accountName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="ksId != null and ksId != '' ">
|
|
|
+ AND t1.user_id = #{ksId}
|
|
|
+ </if>
|
|
|
+ ORDER BY account_create_time DESC
|
|
|
+ </if>
|
|
|
+ <if test="status == 1">
|
|
|
+ SELECT
|
|
|
+ account_id as 'accountId',
|
|
|
+ account_name as 'accountName',
|
|
|
+ media_code as 'type',
|
|
|
+ ks_id as 'ksId',
|
|
|
+ ks_name as 'ksName',
|
|
|
+ date_format(account_create_time,'%Y-%m-%d') as 'accountCreateTime',
|
|
|
+ product_name as 'productName',
|
|
|
+ operator_name as 'operatorName'
|
|
|
+ FROM kuaishou_account
|
|
|
+ <where>
|
|
|
+ <if test="accountId != null and accountId != '' ">
|
|
|
+ AND account_id = #{accountId}
|
|
|
+ </if>
|
|
|
+ <if test="accountName != null and accountName != '' ">
|
|
|
+ AND account_name Like concat('%', #{accountName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="ksId != null and ksId != '' ">
|
|
|
+ AND ks_id = #{ksId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY account_create_time DESC
|
|
|
+ </if>
|
|
|
+ ) t
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|