select wx_enterprise_id wxEnterpriseId , staff_id staffId from tab_haoban_group_chat where update_time > DATE_ADD(NOW(),INTERVAL -30 day) and wx_chat_id_dk is null and init_flag = 1 and name is not null
SELECT a.wx_enterprise_id wxEnterpriseId , a.staff_id staffId FROM tab_haoban_group_chat a LEFT JOIN tab_haoban_wx_enterprise b ON a.wx_enterprise_id=b.wx_enterprise_id
group by wx_enterprise_id , staff_id
WHERE a.update_time > DATE_ADD(NOW(),INTERVAL -7 DAY) AND a.wx_chat_id_dk IS NULL AND a.init_flag = 1 AND a.chat_status != 4 AND a.name <![CDATA[ <> ]]>'' AND b.wx_security_type > 0