|
@@ -246,64 +246,72 @@ FROM
|
246
|
246
|
SELECT
|
247
|
247
|
authorization_count_table.date as date,
|
248
|
248
|
ifnull(authorization_count_table.authorization_count, 0) as authorization_count,
|
249
|
|
- user_count_table.user_count as user_count
|
|
249
|
+ ifnull(user_count_table.user_count, 0) as user_count
|
250
|
250
|
FROM
|
251
|
251
|
(
|
252
|
252
|
SELECT
|
253
|
|
- *
|
|
253
|
+ *
|
254
|
254
|
FROM
|
255
|
255
|
(
|
256
|
|
- SELECT
|
257
|
|
- DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
|
258
|
|
- FROM
|
259
|
|
- sequence a
|
260
|
|
- WHERE
|
|
256
|
+ SELECT
|
|
257
|
+ DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
|
|
258
|
+ FROM
|
|
259
|
+ sequence a
|
|
260
|
+ WHERE
|
|
261
|
+
|
261
|
262
|
<if test="startDate == null or endDate == null">
|
262
|
263
|
a.rownum <![CDATA[ <= ]]> 7
|
263
|
264
|
</if>
|
264
|
265
|
<if test="startDate != null or endDate != null">
|
265
|
266
|
a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
266
|
267
|
</if>
|
|
268
|
+
|
267
|
269
|
) AS temp_date
|
268
|
270
|
LEFT JOIN (
|
269
|
271
|
SELECT
|
270
|
|
- COUNT(1) as authorization_count,
|
271
|
|
- tpvr.visit_time AS visit_time
|
|
272
|
+ COUNT(1) as authorization_count,
|
|
273
|
+ tp.create_date AS create_date
|
272
|
274
|
FROM
|
273
|
|
- ta_person tp
|
274
|
|
- INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
|
|
275
|
+ ta_person tp
|
275
|
276
|
where ifnull(tp.person_type, '') != #{personType}
|
276
|
|
- and tp.phone is NOT NULL
|
277
|
|
- ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
|
|
277
|
+ and tp.phone is NOT NULL
|
|
278
|
+ GROUP BY tp.create_date
|
|
279
|
+ ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date , '%Y-%m-%d' )
|
|
280
|
+
|
278
|
281
|
) as authorization_count_table
|
279
|
282
|
,
|
280
|
|
- (SELECT
|
281
|
|
- *
|
282
|
|
- FROM
|
283
|
283
|
(
|
|
284
|
+ SELECT
|
|
285
|
+ *
|
|
286
|
+ FROM
|
|
287
|
+ (
|
284
|
288
|
SELECT
|
285
|
|
- DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
|
|
289
|
+ DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
|
286
|
290
|
FROM
|
287
|
|
- sequence a
|
|
291
|
+ sequence a
|
288
|
292
|
WHERE
|
289
|
|
- <if test="startDate == null or endDate == null">
|
290
|
|
- a.rownum <![CDATA[ <= ]]> 7
|
291
|
|
- </if>
|
292
|
|
- <if test="startDate != null or endDate != null">
|
293
|
|
- a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
294
|
|
- </if>
|
|
293
|
+
|
|
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>
|
|
300
|
+
|
295
|
301
|
) AS temp_date
|
296
|
302
|
LEFT JOIN (
|
297
|
303
|
SELECT
|
298
|
|
- COUNT(1) as user_count,
|
299
|
|
- tpvr.visit_time AS visit_time
|
|
304
|
+ COUNT(1) as user_count,
|
|
305
|
+ tp.create_date AS create_date
|
300
|
306
|
FROM
|
301
|
|
- ta_person tp
|
302
|
|
- INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
|
|
307
|
+ ta_person tp
|
303
|
308
|
where ifnull(tp.person_type, '') != #{personType}
|
304
|
|
- ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
|
|
309
|
+ GROUP BY tp.create_date
|
|
310
|
+ ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date , '%Y-%m-%d' )
|
305
|
311
|
|
306
|
312
|
) as user_count_table
|
|
313
|
+ where
|
|
314
|
+ user_count_table.date = authorization_count_table.date
|
307
|
315
|
GROUP BY date
|
308
|
316
|
</select>
|
309
|
317
|
|