|
@@ -146,32 +146,17 @@ FROM
|
146
|
146
|
|
147
|
147
|
<select id="selectRecentlyCount" resultType="integer" >
|
148
|
148
|
SELECT
|
149
|
|
- ifnull(SUM(activity_count), 0) as activity_count
|
|
149
|
+ COUNT(1) as activity_count
|
150
|
150
|
FROM
|
151
|
|
- (
|
152
|
|
- SELECT
|
153
|
|
- DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
|
154
|
|
- FROM
|
155
|
|
- sequence a
|
156
|
|
-
|
157
|
|
- <trim prefix="where">
|
158
|
|
- <if test="startDate != null or endDate != null">
|
159
|
|
- a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
|
160
|
|
- </if>
|
161
|
|
- <if test="startDate == null or endDate == null">
|
162
|
|
- a.rownum <![CDATA[ <= ]]> 7
|
163
|
|
- </if>
|
164
|
|
- </trim>
|
|
151
|
+ ta_person tp
|
|
152
|
+ where ifnull(tp.person_type, '') != #{personType}
|
165
|
153
|
|
166
|
|
- ) AS temp_date
|
167
|
|
- LEFT JOIN (
|
168
|
|
- SELECT
|
169
|
|
- COUNT(1) as activity_count,
|
170
|
|
- tp.create_date AS create_date
|
171
|
|
- FROM
|
172
|
|
- ta_person tp
|
173
|
|
- where ifnull(tp.person_type, '') != #{personType}
|
174
|
|
- ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date , '%Y-%m-%d' )
|
|
154
|
+ <if test="startDate != null or endDate != null">
|
|
155
|
+ AND tp.create_date BETWEEN #{startDate} and #{endDate}
|
|
156
|
+ </if>
|
|
157
|
+ <if test="startDate == null or endDate == null">
|
|
158
|
+ AND tp.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
159
|
+ </if>
|
175
|
160
|
</select>
|
176
|
161
|
|
177
|
162
|
|
|
@@ -295,14 +280,22 @@ FROM
|
295
|
280
|
|
296
|
281
|
) AS temp_date
|
297
|
282
|
LEFT JOIN (
|
298
|
|
- SELECT
|
299
|
|
- COUNT(1) as authorization_count,
|
300
|
|
- tp.create_date AS create_date
|
301
|
|
- FROM
|
302
|
|
- ta_person tp
|
303
|
|
- where ifnull(tp.person_type, '') != #{personType}
|
304
|
|
- and tp.phone is NOT NULL
|
305
|
|
- GROUP BY tp.create_date
|
|
283
|
+
|
|
284
|
+ SELECT
|
|
285
|
+ COUNT(1) as authorization_count,
|
|
286
|
+ tp.create_date as create_date
|
|
287
|
+ FROM
|
|
288
|
+ ta_person tp
|
|
289
|
+ where ifnull(tp.person_type, '') != #{personType}
|
|
290
|
+ and tp.phone is NOT NULL
|
|
291
|
+ <if test="startDate != null or endDate != null">
|
|
292
|
+ AND tp.create_date BETWEEN #{startDate} and #{endDate}
|
|
293
|
+ </if>
|
|
294
|
+ <if test="startDate == null or endDate == null">
|
|
295
|
+ AND tp.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
296
|
+ </if>
|
|
297
|
+ GROUP BY DATE_FORMAT( tp.create_date , '%Y-%m-%d' )
|
|
298
|
+
|
306
|
299
|
) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date , '%Y-%m-%d' )
|
307
|
300
|
|
308
|
301
|
) as authorization_count_table
|
|
@@ -325,13 +318,21 @@ FROM
|
325
|
318
|
|
326
|
319
|
) AS temp_date
|
327
|
320
|
LEFT JOIN (
|
328
|
|
- SELECT
|
329
|
|
- COUNT(1) as user_count,
|
330
|
|
- tp.create_date AS create_date
|
331
|
|
- FROM
|
332
|
|
- ta_person tp
|
333
|
|
- where ifnull(tp.person_type, '') != #{personType}
|
334
|
|
- GROUP BY tp.create_date
|
|
321
|
+
|
|
322
|
+ SELECT
|
|
323
|
+ COUNT(1) as user_count,
|
|
324
|
+ tp.create_date as create_date
|
|
325
|
+ FROM
|
|
326
|
+ ta_person tp
|
|
327
|
+ where ifnull(tp.person_type, '') != #{personType}
|
|
328
|
+ <if test="startDate != null or endDate != null">
|
|
329
|
+ AND tp.create_date BETWEEN #{startDate} and #{endDate}
|
|
330
|
+ </if>
|
|
331
|
+ <if test="startDate == null or endDate == null">
|
|
332
|
+ AND tp.create_date BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
|
|
333
|
+ </if>
|
|
334
|
+ GROUP BY DATE_FORMAT( tp.create_date , '%Y-%m-%d' )
|
|
335
|
+
|
335
|
336
|
) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date , '%Y-%m-%d' )
|
336
|
337
|
|
337
|
338
|
) as user_count_table
|