Browse Source

sql: 定时获取客户信息sql修改

Signed-off-by: binren <zhangbr@elab-plus.com>
binren 4 years ago
parent
commit
c67958a6b7
1 changed files with 3 additions and 2 deletions
  1. 3 2
      sql.py

+ 3 - 2
sql.py

@@ -3,7 +3,7 @@
 class Sql:
     # 获取项目的城市信息
     sql_1 = """
-        select IFNULL(brand_id, -1), house_id, house_name, city from d_house a where brand_id = '13' and house_id != '13' order by house_id
+        select IFNULL(brand_id, -1), house_id, house_name, city from d_house a where brand_id = '13' and house_id != '13' and status = 1 order by house_id
     """
 
     # 根据任务id获取推送客户信息
@@ -11,7 +11,8 @@ class Sql:
         select a.task_key, b.customer_type, b.name, b.mail, b.house_or_region, a.customer_id, GROUP_CONCAT(c.house_or_brand_id) as ids
         from report_task_info a left join report_push_customer_info b on b.id = a.customer_id
         left join report_customer_authority_info c on b.id = c.customer_id
-        where a.task_key = %s and a.status = b.status = c.status = 1
+		LEFT JOIN d_house d on d.house_id = c.house_or_brand_id or d.brand_id = c.house_or_brand_id
+        where a.task_key = %s and a.status = b.status = c.status = 1 and d.`status` = 1
         group by a.task_key, b.customer_type, b.name, b.mail, b.house_or_region, a.customer_id
     """