select n.campaignTitle,a.type,n.`key`,sum(a.totalCount),a.succuesCount,a.failedCount,a.pushedAt,a.finishedAt,a.batchNo from
xxx.push_records a
left join xxx.notify_setting_new n
on a.`notifySettingKey`=n.notifyKey
left join xxx.notify_except_total_new ex
on a.`notifySettingKey`=ex.notifyKey and a.batchNo=ex.batchNo
left join xxx.notify_time_setting_new t on left(a.`notifySettingKey`,4)=t.notifySettingKey
where a.notifySettingKey
is not null and
locate('notify', a.`notifySettingKey`) and n.notifyKey is not null and t.isOneTimes=0
<if test="params.default != null and params.default != ''">
<![CDATA[ and 2 >= DATEDIFF(NOW(),a.pushedAt) ]]>
</if>
<if test="params.campaignTitle != null and params.campaignTitle != ''">
and n.campaignTitle
LIKE "%"#{params.campaignTitle}"%"
</if>