|
@@ -770,9 +770,9 @@
|
|
|
IFNULL(orderYesr.payTotalYesr,0) AS payTotalYear,
|
|
|
IFNULL(orderYesr.orderCountYesr,0) AS orderCountYear,
|
|
|
IFNULL(orderTotal.payTotal,0) AS payTotal,
|
|
|
- MAX(cor.orderTime) AS lastOrderTime
|
|
|
+ ordr.lastOrderTime AS lastOrderTime
|
|
|
FROM club c
|
|
|
- LEFT JOIN cm_order cor ON c.userID = cor.userID
|
|
|
+# LEFT JOIN cm_order cor ON c.userID = cor.userID
|
|
|
LEFT JOIN USER u ON u.userId=c.userId
|
|
|
LEFT JOIN cm_svip_user csu ON csu.userId = u.userID
|
|
|
LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
|
|
@@ -814,7 +814,9 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
GROUP BY co.userid) AS orderTotal ON c.userId=orderTotal.userId
|
|
|
-
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT userID, MAX(orderTime) AS lastOrderTime FROM cm_order GROUP BY userID
|
|
|
+ ) AS ordr ON c.userID = ordr.userID
|
|
|
<where>
|
|
|
<if test="registerStartTime != null and registerStartTime != ''">
|
|
|
AND (c.addTime > #{registerStartTime} or c.addTime = #{registerStartTime} )
|
|
@@ -823,10 +825,10 @@
|
|
|
AND c.addTime <![CDATA[ <= ]]> #{registerEndTime}
|
|
|
</if>
|
|
|
<if test="searchStartTime != null and searchStartTime != ''">
|
|
|
- AND (cor.orderTime > #{searchStartTime} or cor.orderTime = #{searchStartTime} )
|
|
|
+ AND (ordr.lastOrderTime > #{searchStartTime} or ordr.lastOrderTime = #{searchStartTime} )
|
|
|
</if>
|
|
|
<if test=" searchEndTime != null and searchEndTime != ''">
|
|
|
- AND cor.orderTime <![CDATA[ <= ]]> #{searchEndTime}
|
|
|
+ AND ordr.lastOrderTime <![CDATA[ <= ]]> #{searchEndTime}
|
|
|
</if>
|
|
|
<if test="customerValue != null and customerValue != ''">
|
|
|
AND c.firstClubType = #{customerValue}
|
|
@@ -888,7 +890,7 @@
|
|
|
</where>
|
|
|
GROUP BY c.userID ORDER BY
|
|
|
<if test="payTotalMonthType == null and orderCountMonthType == null and payTotalYearType == null and orderCountYearType == null and payTotalType == null">
|
|
|
- MAX(cor.orderTime) DESC
|
|
|
+ ordr.lastOrderTime DESC
|
|
|
</if>
|
|
|
<if test="orderCountMonthType != null">
|
|
|
<if test="orderCountMonthType == 0">
|