|
@@ -116,14 +116,25 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="channelNumberUsageDetailsList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
- SELECT IFNULL((SELECT MAX(tt.create_time)
|
|
|
- FROM ctop_kuaishou_creative tt
|
|
|
- WHERE tt.unit_id = t3.unit_id),
|
|
|
- '-') as 'createTime', 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}
|
|
|
AND t3.channel_code = #{channelCode}
|
|
|
AND t3.unit_id is not null
|