(SELECT FORMAT(count(id),0) from customer as c where c.STATUS in(11,0,99) and isWaitCall = 1 and c.is_delete = 0 and manager_id = #{managerId}
and c.bind_time>=#{startTime} and c.bind_time<=#{endTime}) as waitCount,
(SELECT FORMAT(count(id),0) FROM customer_merge c inner join (select customer_id,count((substr(ccl.manager_name,1,5)!='CRM用户' and ccl.manager_id!=0) or null) as count
from customer_callback_log ccl where ccl.create_time>=#{startTime} and ccl.create_time<=#{endTime} group by customer_id having count>0) n on c.id=n.customer_id where 1=1
from customer_callback_log ccl group by customer_id having count>0) n on c.id=n.customer_id where 1=1
and manager_id = #{managerId} and c.bind_time>=#{startTime} and c.bind_time<=#{endTime}
AND c.last_call_time is not null AND c.is_delete = 0 AND c.STATUS IN ( 11, 0, 99)
AND ( c.isWaitCall = 0 OR c.isWaitCall IS NULL)) as callCount,
...
...
@@ -31,7 +31,7 @@
and c.bind_time>=#{startTime} and c.bind_time<=#{endTime} and (c.isWaitCall = 0 OR c.isWaitCall IS NULL)
AND c.STATUS IN ( 11, 0, 99 ) and c.customer_source_type=7) as cloudSent,
(select FORMAT(count(id),0) FROM customer_merge c inner join (select m.customer_id from customer_callback_log m inner join
(select customer_id,count(*) as count from customer_callback_log ccl where ccl.create_time>=#{startTime} and ccl.create_time<=#{endTime} group by customer_id) n
(select customer_id,count(*) as count from customer_callback_log group by customer_id) n
on n.count=1 and m.customer_id=n.customer_id and m.manager_id=0) c2 on c.id=c2.customer_id
where 1=1 AND c.is_delete = 0 and manager_id = #{managerId} and c.bind_time>=#{startTime} and c.bind_time<=#{endTime}
AND c.STATUS IN ( 11, 0, 99 ) and c.customer_source_type=7) as cloudWait