|
@@ -209,7 +209,9 @@ FROM
|
209
|
209
|
|
210
|
210
|
<select id="selectActiveUserCount" resultType="map">
|
211
|
211
|
SELECT
|
212
|
|
- *
|
|
212
|
+ temp_date.date as date,
|
|
213
|
+ sum(temp.activity_count) as activity_count,
|
|
214
|
+ temp.visit_time as visit_time
|
213
|
215
|
FROM
|
214
|
216
|
(
|
215
|
217
|
SELECT
|
|
@@ -238,19 +240,20 @@ FROM
|
238
|
240
|
LEFT JOIN (
|
239
|
241
|
SELECT
|
240
|
242
|
COUNT(1) as activity_count,
|
241
|
|
- tpvr.visit_time AS visit_time
|
|
243
|
+ tpvr.max_visit_time AS visit_time
|
242
|
244
|
FROM
|
243
|
245
|
ta_person tp
|
244
|
246
|
LEFT JOIN
|
245
|
|
- ( SELECT * FROM ta_person_visit_record GROUP BY person_id ) as tpvr
|
|
247
|
+ ( SELECT *, MAX(visit_time) as max_visit_time FROM ta_person_visit_record GROUP BY person_id ) as tpvr
|
246
|
248
|
ON tp.person_id = tpvr.person_id
|
247
|
249
|
where ifnull(tp.person_type, '') != #{personType}
|
|
250
|
+ GROUP BY DATE_FORMAT( tpvr.max_visit_time , '%Y-%m-%d' )
|
248
|
251
|
) AS temp ON
|
249
|
252
|
<if test="dateType == 'month'.toString()">
|
250
|
|
- temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m' ) ORDER BY temp_date.date
|
|
253
|
+ temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m' ) GROUP BY temp_date.date ORDER BY temp_date.date
|
251
|
254
|
</if>
|
252
|
|
- <if test="dateType != 'month'.toString()">
|
253
|
|
- temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' ) ORDER BY temp_date.date
|
|
255
|
+ <if test="dateType == 'day'.toString()">
|
|
256
|
+ temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' ) GROUP BY temp_date.date ORDER BY temp_date.date
|
254
|
257
|
</if>
|
255
|
258
|
|
256
|
259
|
</select>
|