|
@@ -0,0 +1,269 @@
|
|
|
|
+<?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="cn.com.ctop.job.kuaishou.data.mapper.UserAllocationMapper">
|
|
|
|
+
|
|
|
|
+ <select id="selectAccountListByProjectId" resultType="cn.com.ctop.job.kuaishou.data.entity.UserAllocation">
|
|
|
|
+ select a.user_id as userId,
|
|
|
|
+ a.user_name as userName,
|
|
|
|
+ a.auth_name as authName,
|
|
|
|
+ a.account_id as accountId
|
|
|
|
+ from `jeecg-boot`.ctop_user_allocation a
|
|
|
|
+ left join `jeecg-boot`.ctop_project b on a.project_id = b.id
|
|
|
|
+ where b.id = #{projectId}
|
|
|
|
+ and account_status = 0
|
|
|
|
+ </select>
|
|
|
|
+ <select id="getAccountListByUserIdAndProductId" resultType="cn.com.ctop.job.kuaishou.data.entity.UserAllocation">
|
|
|
|
+ select cua.account_id, cua.auth_name, cua.user_name
|
|
|
|
+ from `jeecg-boot`.ctop_user_allocation cua
|
|
|
|
+ left join `jeecg-boot`.ctop_project cp on cua.project_id = cp.id
|
|
|
|
+ where
|
|
|
|
+ cua.project_id = #{projectId}
|
|
|
|
+ and
|
|
|
|
+ cp.product_id=#{productId}
|
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
|
+ and cua.user_id = #{userId}
|
|
|
|
+ </if>
|
|
|
|
+
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getOneByAccountId" resultType="cn.com.ctop.job.kuaishou.data.entity.UserAllocation">
|
|
|
|
+ select id,
|
|
|
|
+ user_id,
|
|
|
|
+ user_name,
|
|
|
|
+ account_id,
|
|
|
|
+ advertiser_id,
|
|
|
|
+ advertiser_name,
|
|
|
|
+ project_id,
|
|
|
|
+ project_name,
|
|
|
|
+ account_name,
|
|
|
|
+ warning_amount,
|
|
|
|
+ warning_proportion,
|
|
|
|
+ account_status,
|
|
|
|
+ auth_name,
|
|
|
|
+ system_type,
|
|
|
|
+ monitoring_link,
|
|
|
|
+ landing_page,
|
|
|
|
+ delete_comment,
|
|
|
|
+ project_strategy,
|
|
|
|
+ auto_delivery,
|
|
|
|
+ material_type,
|
|
|
|
+ media_id,
|
|
|
|
+ create_time,
|
|
|
|
+ update_time,
|
|
|
|
+ delivery_point,
|
|
|
|
+ auth_begin_time,
|
|
|
|
+ manager,
|
|
|
|
+ project_media_id
|
|
|
|
+ from `jeecg-boot`.ctop_user_allocation
|
|
|
|
+ where account_id = #{accountId}
|
|
|
|
+ Limit 1
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="queryAdvertiserId" resultType="String">
|
|
|
|
+ select distinct advertiser_id
|
|
|
|
+ from `jeecg-boot`.ctop_user_allocation
|
|
|
|
+ where account_id = #{accountId}
|
|
|
|
+ </select>
|
|
|
|
+ <select id="queryUserIdByAccountId" resultType="String">
|
|
|
|
+ select distinct user_id
|
|
|
|
+ from `jeecg-boot`.ctop_user_allocation
|
|
|
|
+ where account_id = #{accountId}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getAccountListByProject" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
+ select t1.account_id as 'accountId', (select realname from `jeecg-boot`.sys_user where id = t1.user_id) as 'userName', t1.auth_name as 'authName'
|
|
|
|
+ from `jeecg-boot`.ctop_user_allocation t1
|
|
|
|
+ where t1.project_id = #{projectId}
|
|
|
|
+ order by t1.create_time desc
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getAccountListByProjectList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
+ select
|
|
|
|
+ t1.project_id as 'projectId',
|
|
|
|
+ t1.account_id as 'accountId',
|
|
|
|
+ (select realname from `jeecg-boot`.sys_user where id = t1.user_id ) as 'userName',
|
|
|
|
+ t1.auth_name as 'authName',
|
|
|
|
+ t1.account_status as 'accountStatus'
|
|
|
|
+ from `jeecg-boot`.ctop_user_allocation t1
|
|
|
|
+ where t1.project_id in
|
|
|
|
+ <foreach collection="list" item="item" separator=","
|
|
|
|
+ open="(" close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ order by t1.create_time desc
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <select id="getUserIdListByProjectId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
+ SELECT t1.user_id as 'userId', t1.account_id as 'accountId', t1.user_name as 'userName'
|
|
|
|
+ from `jeecg-boot`.ctop_kuaishou_advertiser_base_info t1
|
|
|
|
+ LEFT JOIN
|
|
|
|
+ `jeecg-boot`.ctop_user_allocation t2
|
|
|
|
+ ON t1.account_id = t2.account_id
|
|
|
|
+ WHERE t2.project_id = #{projectId}
|
|
|
|
+ AND t2.account_status = 0
|
|
|
|
+ GROUP BY t1.user_id;
|
|
|
|
+ </select>
|
|
|
|
+ <select id="getUserIdListByProductId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
+ SELECT t1.user_id as 'userId', t1.account_id as 'accountId', t1.user_name as 'userName'
|
|
|
|
+ from `jeecg-boot`.ctop_kuaishou_advertiser_base_info t1
|
|
|
|
+ LEFT JOIN `jeecg-boot`.ctop_user_allocation t2
|
|
|
|
+ ON t1.account_id = t2.account_id
|
|
|
|
+ LEFT JOIN `jeecg-boot`.ctop_project t3
|
|
|
|
+ ON t2.project_id = t3.id
|
|
|
|
+ WHERE t3.product_id = #{productId}
|
|
|
|
+ AND t2.account_status = 0
|
|
|
|
+ GROUP BY t1.user_id;
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getValidProjectIds" resultType="java.lang.Long">
|
|
|
|
+ SELECT project_id FROM `jeecg-boot`.ctop_user_allocation t1
|
|
|
|
+ where account_status = 0
|
|
|
|
+ <if test="mediaId != null">
|
|
|
|
+ AND media_id = #{mediaId}
|
|
|
|
+ </if>
|
|
|
|
+ GROUP BY project_id
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <select id="getAccountIdListByUserId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
+ SELECT t1.account_id as 'accountId', t1.auth_name as 'authName', t1.user_name as 'userName'
|
|
|
|
+ from `jeecg-boot`.ctop_user_allocation t1
|
|
|
|
+ LEFT JOIN `jeecg-boot`.ctop_kuaishou_advertiser_base_info t2
|
|
|
|
+ ON t1.account_id = t2.account_id
|
|
|
|
+ WHERE t2.user_id = #{userId}
|
|
|
|
+ AND t1.account_status = 0
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getAccountIdsByUserId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
+ SELECT allocation.account_id,
|
|
|
|
+ allocation.auth_name,
|
|
|
|
+ project.project_name as project_name
|
|
|
|
+ FROM `jeecg-boot`.ctop_user_allocation allocation
|
|
|
|
+ left join `jeecg-boot`.ctop_project project on allocation.project_id = project.id
|
|
|
|
+ WHERE allocation.user_id = #{userId}
|
|
|
|
+ and allocation.account_status = 0
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <select id="getAllAccountIdsByMediaId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
+ SELECT account_id,
|
|
|
|
+ auth_name,
|
|
|
|
+ project_name
|
|
|
|
+ FROM `jeecg-boot`.ctop_user_allocation
|
|
|
|
+ WHERE media_id = #{mediaId}
|
|
|
|
+ and account_status = 0
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getProjectIdByAccountId" resultType="java.lang.Long">
|
|
|
|
+ select project_id
|
|
|
|
+ from `jeecg-boot`.ctop_user_allocation
|
|
|
|
+ where account_id = #{accountId} limit 1
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getUserAllocation" resultType="cn.com.ctop.job.kuaishou.data.entity.UserAllocation">
|
|
|
|
+ select *
|
|
|
|
+ from `jeecg-boot`.ctop_user_allocation
|
|
|
|
+ where account_id = #{accountId} limit 1
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getSwitchStatusByAccount" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
+ SELECT monitoring_link,
|
|
|
|
+ landing_page
|
|
|
|
+ FROM `jeecg-boot`.ctop_user_allocation
|
|
|
|
+ WHERE account_id = #{accountId}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="queryAccountsByDeleteComment" resultType="java.lang.Long">
|
|
|
|
+ SELECT account_id
|
|
|
|
+ FROM `jeecg-boot`.ctop_user_allocation
|
|
|
|
+ WHERE media_id = 2
|
|
|
|
+ AND account_status = 0
|
|
|
|
+ AND delete_comment = 0
|
|
|
|
+ </select>
|
|
|
|
+ <select id="getCompanyNameByUserId" resultType="java.lang.String">
|
|
|
|
+ select company_name
|
|
|
|
+ from `jeecg-boot`.user_company
|
|
|
|
+ where user_id = #{planId} limit 1
|
|
|
|
+ </select>
|
|
|
|
+ <select id="listByMediaId" resultType="cn.com.ctop.job.kuaishou.data.entity.UserAllocation">
|
|
|
|
+ select a.* from `jeecg-boot`.ctop_user_allocation a
|
|
|
|
+ left join `jeecg-boot`.ctop_project p on p.id = a.project_id
|
|
|
|
+ where
|
|
|
|
+ 1=1
|
|
|
|
+ <if test="null!=accountStatus">
|
|
|
|
+ and a.account_status = #{accountStatus}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="null!=mediaId">
|
|
|
|
+ and p.media_id = #{mediaId}
|
|
|
|
+ </if>
|
|
|
|
+ </select>
|
|
|
|
+ <select id="getByAccountIds" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
+ select
|
|
|
|
+ account_id as 'accountId',
|
|
|
|
+ auth_name as 'authName'
|
|
|
|
+ from `jeecg-boot`.ctop_user_allocation where
|
|
|
|
+ account_id in
|
|
|
|
+ <foreach collection="accountIds" item="item" separator=","
|
|
|
|
+ open="(" close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ </select>
|
|
|
|
+ <select id="getKuaiShouUserIdListByProjectId" resultType="java.lang.Long">
|
|
|
|
+ select t2.user_id
|
|
|
|
+ from `jeecg-boot`.ctop_user_allocation t1
|
|
|
|
+ left join `jeecg-boot`.ctop_kuaishou_advertiser_base_info t2
|
|
|
|
+ on t1.account_id = t2.account_id
|
|
|
|
+ where t1.project_id = #{projectId}
|
|
|
|
+ group by t2.user_id
|
|
|
|
+ </select>
|
|
|
|
+ <select id="selectAccountsByKuaishouUserId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
+ SELECT t2.account_id AS 'accountId', t2.user_name AS 'userName', t2.auth_name AS 'authName', t2.account_status AS 'accountStatus'
|
|
|
|
+ FROM `jeecg-boot`.ctop_kuaishou_advertiser_base_info t1
|
|
|
|
+ LEFT JOIN `jeecg-boot`.ctop_user_allocation t2 ON t1.account_id = t2.account_id
|
|
|
|
+ WHERE t1.user_id = #{userId}
|
|
|
|
+ AND t2.id IS NOT NULL;
|
|
|
|
+
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <update id="updateProjectStrategyStatus">
|
|
|
|
+ update `jeecg-boot`.ctop_user_allocation
|
|
|
|
+ set auto_delivery = #{projectStrategy}
|
|
|
|
+ where account_id = #{accountId}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <select id="queryAutomaticAccounts" resultType="java.lang.Long">
|
|
|
|
+ select account_id
|
|
|
|
+ from `jeecg-boot`.ctop_user_allocation
|
|
|
|
+ where project_id = #{projectId}
|
|
|
|
+ AND auto_delivery = 1
|
|
|
|
+ </select>
|
|
|
|
+ <select id="getIdList" resultType="java.lang.Long">
|
|
|
|
+ SELECT account_id
|
|
|
|
+ FROM `jeecg-boot`.ctop_track_monitor_configure
|
|
|
|
+ where status = 0
|
|
|
|
+
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <select id="getProjectByAccountId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
+ select id 'projectId', project_name 'projectName', max_bid 'maxBid', bid_type 'bidType', ocpx_action_type 'ocpxActionType', deep_conversion_type 'deepConversionType'
|
|
|
|
+ from `jeecg-boot`.ctop_project
|
|
|
|
+ where id = (
|
|
|
|
+ select project_id
|
|
|
|
+ from `jeecg-boot`.ctop_user_allocation
|
|
|
|
+ where account_id = #{accountId}
|
|
|
|
+ limit 1
|
|
|
|
+ )
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getProjectEntity" resultType="cn.com.ctop.job.kuaishou.data.entity.Project">
|
|
|
|
+ select *
|
|
|
|
+ from `jeecg-boot`.ctop_project
|
|
|
|
+ where id = #{projectId}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+</mapper>
|