<!-- SELECT FORMAT(count(distinct id),0) from customer as c where STATUS in(11,0,99) and isWaitCall = 1 and c.is_delete = 0 and (manager_id in ($managerId$))) as waitCount,-->
<!-- (SELECT FORMAT(count(distinct id),0) from customer as c where STATUS in(11,0,99) and (manager_id in ($managerId$))) as allCount,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=0 and l.source = 1 and l.call_record_id is not null) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as callToday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=1 and l.source = 1 and l.call_record_id is not null) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as callYesterday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=0 ) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as allCallToday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=1 ) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as allCallYesterday-->
<!-- SELECT FORMAT(count(distinct id),0) from customer as c where STATUS in(11,0,99) and isWaitCall = 1 and c.is_delete = 0 and (manager_id in ($managerId$))) as waitCount,-->
<!-- (SELECT FORMAT(count(distinct id),0) from customer as c where STATUS in(11,0,99) and (manager_id in ($managerId$))) as allCount,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=0 and l.source = 1 and l.call_record_id is not null) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as callToday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=1 and l.source = 1 and l.call_record_id is not null) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as callYesterday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=0 ) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as allCallToday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=1 ) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as allCallYesterday-->
SELECT FORMAT(count(id),0) from customer_merge as c where c.is_delete = 0 AND c.STATUS in(11,0,99) and manager_id = #{managerId}
and c.create_time>=#{startTime} and c.create_time<=#{endTime} and (c.isWaitCall=0 OR c.isWaitCall IS NULL)) as allCount,
and c.bind_time>=#{startTime} and c.bind_time<=#{endTime} and (c.isWaitCall=0 OR c.isWaitCall IS NULL)) as allCount,
(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.create_time>=#{startTime} and c.create_time<=#{endTime}) as waitCount,
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 group by customer_id having count>0) n on c.id=n.customer_id where 1=1
and manager_id = #{managerId} and c.create_time>=#{startTime} and c.create_time<=#{endTime}
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,
(SELECT FORMAT(count(id),0) from customer_merge as c where c.is_delete = 0 and manager_id = #{managerId}
and c.create_time>=#{startTime} and c.create_time<=#{endTime} and (c.isWaitCall = 0 OR c.isWaitCall IS NULL)
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 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.create_time>=#{startTime} and c.create_time<=#{endTime}
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
<!-- SELECT FORMAT(count(distinct id),0) from customer as c where STATUS in(11,0,99) and isWaitCall = 1 and c.is_delete = 0 and (manager_id in ($managerId$))) as waitCount,-->
<!-- (SELECT FORMAT(count(distinct id),0) from customer as c where STATUS in(11,0,99) and (manager_id in ($managerId$))) as allCount,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=0 and l.source = 1 and l.call_record_id is not null) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as callToday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=1 and l.source = 1 and l.call_record_id is not null) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as callYesterday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=0 ) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as allCallToday,-->
<!-- (select FORMAT(count(distinct id),0) from customer as c join ( SELECT l.customer_id FROM customer_callback_log l where TIMESTAMPDIFF(DAY,date_format(create_time,'%y-%m-%d'),date_format(CURDATE(),'%y-%m-%d'))=1 ) d on c.id=d.customer_id and c.is_delete = 0 and (c.manager_id in ($managerId$))) as allCallYesterday-->
SELECT FORMAT(count(id),0) from customer_merge as c where c.is_delete = 0 AND c.STATUS in(11,0,99) and manager_id = #{managerId}
and c.create_time>=#{startTime} and c.create_time<=#{endTime} and (c.isWaitCall=0 OR c.isWaitCall IS NULL)) as allCount,
and c.bind_time>=#{startTime} and c.bind_time<=#{endTime} and (c.isWaitCall=0 OR c.isWaitCall IS NULL)) as allCount,
(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.create_time>=#{startTime} and c.create_time<=#{endTime}) as waitCount,
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 group by customer_id having count>0) n on c.id=n.customer_id where 1=1
and manager_id = #{managerId} and c.create_time>=#{startTime} and c.create_time<=#{endTime}
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,
(SELECT FORMAT(count(id),0) from customer_merge as c where c.is_delete = 0 and manager_id = #{managerId}
and c.create_time>=#{startTime} and c.create_time<=#{endTime} and (c.isWaitCall = 0 OR c.isWaitCall IS NULL)
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 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.create_time>=#{startTime} and c.create_time<=#{endTime}
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