|
|
@@ -365,6 +365,7 @@
|
|
|
pcd.tel,
|
|
|
pcd.salesman_id,
|
|
|
pcd.salesman_name,
|
|
|
+ o.customer_id,
|
|
|
MAX(o.busines_date) AS businesDate,
|
|
|
IFNULL(DATEDIFF(NOW(), MAX(o.busines_date)),0) AS daysDiff,
|
|
|
COUNT(o.customer_id) AS orderCount,
|
|
|
@@ -404,10 +405,10 @@
|
|
|
pcd.id
|
|
|
) allCunstomer WHERE allCunstomer.daysDiff >= #{CorpsDesc.days}
|
|
|
<if test="CorpsDesc.notPurchased != null and CorpsDesc.notPurchased != ''">
|
|
|
- or o.customer_id IS NULL
|
|
|
+ or allCunstomer.customer_id IS NULL
|
|
|
</if>
|
|
|
<if test="CorpsDesc.notPurchased == null or CorpsDesc.notPurchased == ''">
|
|
|
- AND o.customer_id IS NOT NULL
|
|
|
+ AND allCunstomer.customer_id IS NOT NULL
|
|
|
</if>
|
|
|
ORDER BY
|
|
|
(allCunstomer.orderCount * 0.7 + allCunstomer.daysDiff * 0.3) DESC
|