|
@@ -149,13 +149,13 @@ FROM
|
149
|
149
|
DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
|
150
|
150
|
FROM
|
151
|
151
|
sequence a
|
152
|
|
- WHERE
|
153
|
|
- <if test="startDate == null or endDate == null">
|
154
|
|
- a.rownum <![CDATA[ <= ]]> 7
|
155
|
|
- </if>
|
156
|
|
- <if test="startDate != null or endDate != null">
|
157
|
|
- a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
158
|
|
- </if>
|
|
152
|
+
|
|
153
|
+ <trim prefix="where">
|
|
154
|
+ <if test="startDate != null or endDate != null">
|
|
155
|
+ a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
|
156
|
+ </if>
|
|
157
|
+ </trim>
|
|
158
|
+
|
159
|
159
|
) AS temp_date
|
160
|
160
|
LEFT JOIN (
|
161
|
161
|
SELECT
|
|
@@ -180,30 +180,40 @@ FROM
|
180
|
180
|
SELECT
|
181
|
181
|
DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date, b.type_id, b.type_name
|
182
|
182
|
from sequence a, td_biz_event_type b
|
183
|
|
- where
|
184
|
|
- <if test="startDate == null or endDate == null">
|
185
|
|
- a.rownum <![CDATA[ <= ]]> 7
|
186
|
|
- </if>
|
187
|
|
- <if test="startDate != null or endDate != null">
|
188
|
|
- a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
189
|
|
- </if>
|
|
183
|
+
|
|
184
|
+ <trim prefix="where">
|
|
185
|
+ <if test="startDate != null or endDate != null">
|
|
186
|
+ a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
|
187
|
+ </if>
|
|
188
|
+ </trim>
|
190
|
189
|
|
191
|
190
|
) AS temp_date
|
192
|
191
|
|
193
|
192
|
LEFT JOIN (
|
194
|
|
- SELECT
|
195
|
|
- COUNT(1) as activityCount,
|
196
|
|
- tpvr.event_type,
|
197
|
|
- DATE_FORMAT( tpvr.visit_time , '%Y-%m-%d' ) as date
|
198
|
|
- FROM
|
199
|
|
- ta_person tp
|
200
|
|
- INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
|
201
|
|
- where ifnull(tp.person_type, '') != #{personType}
|
202
|
|
- <if test="buildingId != null and buildingId != ''">
|
203
|
|
- and tpvr.building_id = #{buildingId}
|
204
|
|
- </if>
|
205
|
|
- GROUP BY tpvr.event_type, DATE_FORMAT( tpvr.visit_time , '%Y-%m-%d' )
|
|
193
|
+ SELECT
|
|
194
|
+ COUNT(1) as activityCount,
|
|
195
|
+ tpvr.event_type,
|
|
196
|
+ DATE_FORMAT( tpvr.visit_time , '%Y-%m-%d' ) as date
|
|
197
|
+ FROM
|
|
198
|
+ ta_person tp
|
|
199
|
+ INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
|
|
200
|
+ where ifnull(tp.person_type, '') != #{personType}
|
|
201
|
+ <if test="buildingId != null and buildingId != ''">
|
|
202
|
+ and tpvr.building_id = #{buildingId}
|
|
203
|
+ </if>
|
|
204
|
+ <if test="eventType != null and eventType != ''">
|
|
205
|
+ and tpvr.event_type = #{eventType}
|
|
206
|
+ </if>
|
|
207
|
+ <if test="event != null and event != ''">
|
|
208
|
+ and tpvr.event = #{event}
|
|
209
|
+ </if>
|
|
210
|
+ <if test="activity != null and activity != ''">
|
|
211
|
+ and tpvr.activity = #{activity}
|
|
212
|
+ </if>
|
|
213
|
+
|
|
214
|
+ GROUP BY tpvr.event_type, DATE_FORMAT( tpvr.visit_time , '%Y-%m-%d' )
|
206
|
215
|
) AS temp ON temp_date.date = temp.date and temp_date.type_id = temp.event_type
|
|
216
|
+ order by temp_date.date asc
|
207
|
217
|
</select>
|
208
|
218
|
|
209
|
219
|
<select id="selectActiveUserCount" resultType="map">
|
|
@@ -223,13 +233,13 @@ FROM
|
223
|
233
|
</if>
|
224
|
234
|
FROM
|
225
|
235
|
sequence a
|
226
|
|
- WHERE
|
227
|
|
- <if test="startDate == null or endDate == null">
|
228
|
|
- a.rownum <![CDATA[ <= ]]> 7
|
229
|
|
- </if>
|
230
|
|
- <if test="startDate != null or endDate != null">
|
231
|
|
- a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
232
|
|
- </if>
|
|
236
|
+
|
|
237
|
+ <trim prefix="where">
|
|
238
|
+ <if test="startDate != null or endDate != null">
|
|
239
|
+ a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
|
240
|
+ </if>
|
|
241
|
+ </trim>
|
|
242
|
+
|
233
|
243
|
) AS temp_date
|
234
|
244
|
LEFT JOIN (
|
235
|
245
|
SELECT
|
|
@@ -257,14 +267,13 @@ FROM
|
257
|
267
|
DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
|
258
|
268
|
FROM
|
259
|
269
|
sequence a
|
260
|
|
- WHERE
|
261
|
270
|
|
262
|
|
- <if test="startDate == null or endDate == null">
|
263
|
|
- a.rownum <![CDATA[ <= ]]> 7
|
264
|
|
- </if>
|
265
|
|
- <if test="startDate != null or endDate != null">
|
266
|
|
- a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
267
|
|
- </if>
|
|
271
|
+ <trim prefix="where">
|
|
272
|
+ <if test="startDate != null or endDate != null">
|
|
273
|
+ a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
|
274
|
+ </if>
|
|
275
|
+ </trim>
|
|
276
|
+
|
268
|
277
|
|
269
|
278
|
) AS temp_date
|
270
|
279
|
LEFT JOIN (
|
|
@@ -289,14 +298,12 @@ FROM
|
289
|
298
|
DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
|
290
|
299
|
FROM
|
291
|
300
|
sequence a
|
292
|
|
- WHERE
|
293
|
301
|
|
294
|
|
- <if test="startDate == null or endDate == null">
|
295
|
|
- a.rownum <![CDATA[ <= ]]> 7
|
296
|
|
- </if>
|
297
|
|
- <if test="startDate != null or endDate != null">
|
298
|
|
- a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
299
|
|
- </if>
|
|
302
|
+ <trim prefix="where">
|
|
303
|
+ <if test="startDate != null or endDate != null">
|
|
304
|
+ a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
|
305
|
+ </if>
|
|
306
|
+ </trim>
|
300
|
307
|
|
301
|
308
|
) AS temp_date
|
302
|
309
|
LEFT JOIN (
|
|
@@ -384,14 +391,12 @@ FROM
|
384
|
391
|
sequence a
|
385
|
392
|
,
|
386
|
393
|
td_person_from tempf
|
387
|
|
- WHERE
|
388
|
394
|
|
389
|
|
- <if test="startDate == null or endDate == null">
|
390
|
|
- a.rownum <![CDATA[ <= ]]> 7
|
391
|
|
- </if>
|
392
|
|
- <if test="startDate != null or endDate != null">
|
393
|
|
- a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
394
|
|
- </if>
|
|
395
|
+ <trim prefix="where">
|
|
396
|
+ <if test="startDate != null or endDate != null">
|
|
397
|
+ a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
|
398
|
+ </if>
|
|
399
|
+ </trim>
|
395
|
400
|
|
396
|
401
|
) AS temp_date
|
397
|
402
|
|