opt import history sql
This commit is contained in:
parent
13df0934e3
commit
552b5505fe
@ -162,16 +162,24 @@
|
||||
|
||||
join (
|
||||
<![CDATA[
|
||||
select called_number
|
||||
from br_call_detail_record rec
|
||||
where start_stamp > date(now() - interval 21 day)
|
||||
and tenant_id = #{arg.tenantId}
|
||||
and answer_stamp is not null
|
||||
group by called_number
|
||||
having count(answer_stamp) > 0
|
||||
select c.phone
|
||||
from br_calling_list_historical c
|
||||
|
||||
join br_call_detail_record cdr
|
||||
on c.phone = cdr.called_number
|
||||
|
||||
where cdr.start_stamp > date(now() - interval 21 day)
|
||||
and cdr.tenant_id = #{arg.tenantId}
|
||||
and cdr.answer_stamp is not null
|
||||
and c.tenant_id = #{arg.tenantId}
|
||||
and c.campaign_id = #{arg.campaignId}
|
||||
and c.export_batch_key = #{arg.exportBatchKey}
|
||||
|
||||
group by cdr.called_number
|
||||
having count(cdr.id) > 0
|
||||
]]>
|
||||
) t1
|
||||
on c.phone = t1.called_number
|
||||
on c.phone = t1.phone
|
||||
|
||||
set c.active = 0,
|
||||
c.note = 'Answered',
|
||||
@ -189,15 +197,23 @@
|
||||
|
||||
join (
|
||||
<![CDATA[
|
||||
select called_number
|
||||
from br_call_detail_record rec
|
||||
where start_stamp > date(now() - interval 21 day)
|
||||
and tenant_id = #{arg.tenantId}
|
||||
group by called_number
|
||||
having count(start_stamp) > 6
|
||||
select c.phone
|
||||
from br_calling_list_historical c
|
||||
|
||||
join br_call_detail_record cdr
|
||||
on c.phone = cdr.called_number
|
||||
|
||||
where cdr.start_stamp > date(now() - interval 21 day)
|
||||
and cdr.tenant_id = #{arg.tenantId}
|
||||
and c.tenant_id = #{arg.tenantId}
|
||||
and c.campaign_id = #{arg.campaignId}
|
||||
and c.export_batch_key = #{arg.exportBatchKey}
|
||||
|
||||
group by cdr.called_number
|
||||
having count(cdr.id) > 6
|
||||
]]>
|
||||
) t1
|
||||
on c.phone = t1.called_number
|
||||
on c.phone = t1.phone
|
||||
|
||||
set c.active = 0,
|
||||
c.note = 'Exceed 6 Times',
|
||||
@ -208,6 +224,7 @@
|
||||
and c.campaign_id = #{arg.campaignId}
|
||||
and c.export_batch_key = #{arg.exportBatchKey}
|
||||
and c.active = 1
|
||||
|
||||
</update>
|
||||
|
||||
<update id="removeCalledTwiceToday">
|
||||
@ -215,15 +232,23 @@
|
||||
|
||||
join (
|
||||
<![CDATA[
|
||||
select called_number
|
||||
from br_call_detail_record rec
|
||||
where start_stamp > date(now())
|
||||
and tenant_id = #{arg.tenantId}
|
||||
group by called_number
|
||||
having count(start_stamp) > 1
|
||||
select c.phone
|
||||
from br_calling_list_historical c
|
||||
|
||||
join br_call_detail_record cdr
|
||||
on c.phone = cdr.called_number
|
||||
|
||||
where cdr.start_stamp > date(now())
|
||||
and cdr.tenant_id = #{arg.tenantId}
|
||||
and c.tenant_id = #{arg.tenantId}
|
||||
and c.campaign_id = #{arg.campaignId}
|
||||
and c.export_batch_key = #{arg.exportBatchKey}
|
||||
|
||||
group by cdr.called_number
|
||||
having count(cdr.id) > 1
|
||||
]]>
|
||||
) t1
|
||||
on c.phone = t1.called_number
|
||||
on c.phone = t1.phone
|
||||
|
||||
set c.active = 0,
|
||||
c.note = 'Exceed 1 Times Today',
|
||||
@ -241,15 +266,23 @@
|
||||
|
||||
join (
|
||||
<![CDATA[
|
||||
select called_number
|
||||
from br_call_detail_record rec
|
||||
where start_stamp > now() - interval 4 hour
|
||||
and tenant_id = #{arg.tenantId}
|
||||
group by called_number
|
||||
having count(start_stamp) > 0
|
||||
select c.phone
|
||||
from br_calling_list_historical c
|
||||
|
||||
join br_call_detail_record cdr
|
||||
on c.phone = cdr.called_number
|
||||
|
||||
where cdr.start_stamp > now() - interval 4 hour
|
||||
and cdr.tenant_id = #{arg.tenantId}
|
||||
and c.tenant_id = #{arg.tenantId}
|
||||
and c.campaign_id = #{arg.campaignId}
|
||||
and c.export_batch_key = #{arg.exportBatchKey}
|
||||
|
||||
group by cdr.called_number
|
||||
having count(cdr.id) > 0
|
||||
]]>
|
||||
) t1
|
||||
on c.phone = t1.called_number
|
||||
on c.phone = t1.phone
|
||||
|
||||
set c.active = 0,
|
||||
c.note = 'Called In 4 Hours',
|
||||
|
Loading…
x
Reference in New Issue
Block a user