select case when t3.tarchives_ad_useid IS null then '未浏览' else '已浏览' end as ftype,
       count(distinct t2.tenterprise_userid)                             as fcount
from tarchives_ad t1
         inner join tenterprise_users t2 on t1.siteid = t2.siteid and t2.fphonenumber is not null
    and t1.fagentcanread = 1 and t2.fusertype = '经销商' and t2.fisadministrator = 1
         left join tarchives_ad_userdata t3 on t1.siteid = t3.siteid and t1.tarchives_adid = t3.tarchives_adid and
                                               t2.tenterprise_userid = t3.tenterprise_userid
         inner join tagents t4 on t2.siteid=t4.siteid and t2.tagentsid=t4.tagentsid
where t1.siteid = $siteid$ and t1.tarchives_adid = $tarchives_adid$ and t4.fsaleruserid in $tenterprise_userid$
group by case when t3.tarchives_ad_useid IS null then '未浏览'
else'已浏览'end
