|
@@ -17,7 +17,7 @@
|
|
LEFT JOIN sys_user t2 ON t1.user_id = t2.id
|
|
LEFT JOIN sys_user t2 ON t1.user_id = t2.id
|
|
where account_id is not null
|
|
where account_id is not null
|
|
<if test="userId != null">
|
|
<if test="userId != null">
|
|
- and t1.user_id = #{userId}
|
|
|
|
|
|
+ and t1.user_id = #{userId}
|
|
</if>
|
|
</if>
|
|
<if test="projectId != null">
|
|
<if test="projectId != null">
|
|
and project_id = #{projectId}
|
|
and project_id = #{projectId}
|
|
@@ -116,25 +116,18 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="channelNumberUsageDetailsList" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="channelNumberUsageDetailsList" resultType="com.alibaba.fastjson.JSONObject">
|
|
- SELECT
|
|
|
|
- CASE
|
|
|
|
- t1.usage_range
|
|
|
|
- WHEN 1 THEN
|
|
|
|
- '账户'
|
|
|
|
- WHEN 2 THEN
|
|
|
|
- '项目' ELSE ''
|
|
|
|
- END AS 'usageRange',
|
|
|
|
- IFNULL( t3.channel_code, '' ) AS 'channelCode',
|
|
|
|
- IFNULL( t1.project_name, '' ) AS 'projectName',
|
|
|
|
- IFNULL( t2.auth_name, '' ) AS 'authName',
|
|
|
|
- IFNULL( t3.account_id, '' ) AS 'accountId',
|
|
|
|
- IFNULL( t3.campaign_id, '' ) AS 'campaignId',
|
|
|
|
- IFNULL( t3.unit_id, '' ) AS 'unitId'
|
|
|
|
- FROM
|
|
|
|
- ctop_kuaishou_channel_rel t3
|
|
|
|
- INNER JOIN ctop_kuaishou_channel t1 ON t1.account_id = t3.account_id
|
|
|
|
- AND t1.channel_code = t3.channel_code
|
|
|
|
- LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
|
|
|
|
|
|
+ SELECT CASE
|
|
|
|
+ t1.usage_range
|
|
|
|
+ WHEN 1 THEN
|
|
|
|
+ '账户'
|
|
|
|
+ WHEN 2 THEN
|
|
|
|
+ '项目'
|
|
|
|
+ ELSE ''
|
|
|
|
+ END AS 'usageRange', IFNULL(t3.channel_code, '') AS 'channelCode', IFNULL(t1.project_name, '') AS 'projectName', IFNULL(t2.auth_name, '') AS 'authName', IFNULL(t3.account_id, '') AS 'accountId', IFNULL(t3.campaign_id, '') AS 'campaignId', IFNULL(t3.unit_id, '') AS 'unitId'
|
|
|
|
+ FROM ctop_kuaishou_channel_rel t3
|
|
|
|
+ INNER JOIN ctop_kuaishou_channel t1 ON t1.account_id = t3.account_id
|
|
|
|
+ AND t1.channel_code = t3.channel_code
|
|
|
|
+ LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
|
|
WHERE t3.account_id = #{accountId}
|
|
WHERE t3.account_id = #{accountId}
|
|
AND t3.channel_code = #{channelCode}
|
|
AND t3.channel_code = #{channelCode}
|
|
AND t3.unit_id is not null
|
|
AND t3.unit_id is not null
|
|
@@ -174,12 +167,16 @@
|
|
|
|
|
|
<select id="queryByAccountId" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel">
|
|
<select id="queryByAccountId" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel">
|
|
SELECT id,
|
|
SELECT id,
|
|
- channel_code,
|
|
|
|
- usage_level,
|
|
|
|
- usage_range,
|
|
|
|
- is_have_item
|
|
|
|
|
|
+ channel_code,
|
|
|
|
+ usage_level,
|
|
|
|
+ usage_range,
|
|
|
|
+ is_have_item
|
|
FROM `ctop_kuaishou_channel`
|
|
FROM `ctop_kuaishou_channel`
|
|
WHERE account_id = #{accountId}
|
|
WHERE account_id = #{accountId}
|
|
|
|
+ AND state = 1
|
|
|
|
+ <if test="isHaveItem != null">
|
|
|
|
+ and is_have_item = #{isHaveItem}
|
|
|
|
+ </if>
|
|
ORDER BY usage_range limit 1
|
|
ORDER BY usage_range limit 1
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -254,36 +251,32 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="queryItemsListByAccountId" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="queryItemsListByAccountId" resultType="com.alibaba.fastjson.JSONObject">
|
|
- SELECT
|
|
|
|
- tt2.keyword as 'keyword',
|
|
|
|
- tt1.channel_code as 'channelCode',
|
|
|
|
- tt3.app_name as 'appName'
|
|
|
|
- FROM
|
|
|
|
- ctop_kuaishou_channel_rel tt1
|
|
|
|
- INNER JOIN (
|
|
|
|
- SELECT t3.keyword, t1.channel_code FROM ctop_kuaishou_channel t1
|
|
|
|
- INNER JOIN ctop_kuaishou_channel_items_rel t2 ON t1.id = t2.channel_id
|
|
|
|
- LEFT JOIN ctop_kuaishou_channel_items t3 ON t2.item_id = t3.id
|
|
|
|
- WHERE t1.is_have_item = 1
|
|
|
|
- AND t3.state = 1
|
|
|
|
- ) tt2 ON tt2.channel_code = tt1.channel_code
|
|
|
|
- INNER JOIN ctop_kuaishou_channel_app_info tt3 ON tt1.app_id = tt3.app_id
|
|
|
|
- WHERE
|
|
|
|
- tt1.account_id = #{accountId}
|
|
|
|
|
|
+ SELECT tt2.keyword as 'keyword', tt1.channel_code as 'channelCode', tt3.app_name as 'appName'
|
|
|
|
+ FROM ctop_kuaishou_channel_rel tt1
|
|
|
|
+ INNER JOIN (
|
|
|
|
+ SELECT t3.keyword, t1.channel_code
|
|
|
|
+ FROM ctop_kuaishou_channel t1
|
|
|
|
+ INNER JOIN ctop_kuaishou_channel_items_rel t2 ON t1.id = t2.channel_id
|
|
|
|
+ LEFT JOIN ctop_kuaishou_channel_items t3 ON t2.item_id = t3.id
|
|
|
|
+ WHERE t1.is_have_item = 1
|
|
|
|
+ AND t3.state = 1
|
|
|
|
+ ) tt2 ON tt2.channel_code = tt1.channel_code
|
|
|
|
+ INNER JOIN ctop_kuaishou_channel_app_info tt3 ON tt1.app_id = tt3.app_id
|
|
|
|
+ WHERE tt1.account_id = #{accountId}
|
|
AND tt3.app_name = #{appName}
|
|
AND tt3.app_name = #{appName}
|
|
- GROUP BY
|
|
|
|
- tt2.keyword
|
|
|
|
|
|
+ GROUP BY tt2.keyword
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="queryUsedChannel" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel">
|
|
<select id="queryUsedChannel" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel">
|
|
- SELECT t2.* FROM ctop_kuaishou_channel_rel t1
|
|
|
|
- INNER JOIN ctop_kuaishou_channel t2 ON t1.account_id = t2.account_id AND t1.channel_code = t2.channel_code
|
|
|
|
|
|
+ SELECT t2.*
|
|
|
|
+ FROM ctop_kuaishou_channel_rel t1
|
|
|
|
+ INNER JOIN ctop_kuaishou_channel t2
|
|
|
|
+ ON t1.account_id = t2.account_id AND t1.channel_code = t2.channel_code
|
|
WHERE t2.account_id = #{accountId}
|
|
WHERE t2.account_id = #{accountId}
|
|
AND t2.usage_level = #{level}
|
|
AND t2.usage_level = #{level}
|
|
AND t2.state = 1
|
|
AND t2.state = 1
|
|
- AND t1.campaign_id =#{campaignId}
|
|
|
|
- LIMIT 1
|
|
|
|
|
|
+ AND t1.campaign_id = #{campaignId} LIMIT 1
|
|
</select>
|
|
</select>
|
|
|
|
|
|
</mapper>
|
|
</mapper>
|