瀏覽代碼

统计修改

魏熙美 5 年之前
父節點
當前提交
59a1e8d7b1

+ 7
- 5
src/main/java/com/huiju/estateagents/controller/StatisticalController.java 查看文件

11
  * 数据统计
11
  * 数据统计
12
  */
12
  */
13
 @RestController
13
 @RestController
14
-@RequestMapping("/")
14
+@RequestMapping("/api")
15
 public class StatisticalController {
15
 public class StatisticalController {
16
 
16
 
17
     @Autowired
17
     @Autowired
36
     }
36
     }
37
 
37
 
38
     /**
38
     /**
39
-     * 活跃用户数
39
+     * 新增用户数
40
      * @return
40
      * @return
41
      */
41
      */
42
     @GetMapping(value = "/admin/selectNewsUserCount")
42
     @GetMapping(value = "/admin/selectNewsUserCount")
50
      * @return
50
      * @return
51
      */
51
      */
52
     @GetMapping(value = "/admin/selectConversion")
52
     @GetMapping(value = "/admin/selectConversion")
53
-    public ResponseBean selectConversion(String conversion) {
53
+    public ResponseBean selectConversion(@RequestParam("conversion") String conversion) {
54
         return iStatisticalService.selectConversion(conversion);
54
         return iStatisticalService.selectConversion(conversion);
55
     }
55
     }
56
 
56
 
100
      * @return
100
      * @return
101
      */
101
      */
102
     @GetMapping(value = "/admin/selectUserResource")
102
     @GetMapping(value = "/admin/selectUserResource")
103
-    public ResponseBean selectUserResource() {
104
-        return iStatisticalService.selectUserResource();
103
+    public ResponseBean selectUserResource(@RequestParam(value = "startDate", required = false) Date startDate,
104
+                                           @RequestParam(value = "endDate", required = false) Date endDate) {
105
+        return iStatisticalService.selectUserResource(startDate, endDate);
105
     }
106
     }
106
 
107
 
107
 
108
 
109
+
108
 }
110
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaBuildingDynamicMapper.java 查看文件

62
      * 转化率 活动收藏 / 活动分享
62
      * 转化率 活动收藏 / 活动分享
63
      * @return
63
      * @return
64
      */
64
      */
65
-    Map<String, Object> selectBuildingDynamicStatistical(String saveOrShare);
65
+    Map<String, Object> selectBuildingDynamicStatistical(@Param("saveOrShare") String saveOrShare);
66
 
66
 
67
     /**
67
     /**
68
      * 转化率 活动报名
68
      * 转化率 活动报名

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java 查看文件

45
      * 转化率 项目收藏 / 项目分享
45
      * 转化率 项目收藏 / 项目分享
46
      * @return
46
      * @return
47
      */
47
      */
48
-    Map<String, Object> selectBuildingStatistical(String saveOrShare);
48
+    Map<String, Object> selectBuildingStatistical(@Param("saveOrShare") String saveOrShare);
49
 }
49
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaNewsMapper.java 查看文件

33
      * 转化率 咨迅收藏 / 咨迅分享
33
      * 转化率 咨迅收藏 / 咨迅分享
34
      * @return
34
      * @return
35
      */
35
      */
36
-    Map<String, Object> selectNewsStatistical(String saveOrShare);
36
+    Map<String, Object> selectNewsStatistical(@Param("saveOrShare") String saveOrShare);
37
 
37
 
38
 }
38
 }

+ 13
- 5
src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java 查看文件

6
 import com.huiju.estateagents.po.PersonPO;
6
 import com.huiju.estateagents.po.PersonPO;
7
 import org.apache.ibatis.annotations.Mapper;
7
 import org.apache.ibatis.annotations.Mapper;
8
 import org.apache.ibatis.annotations.Param;
8
 import org.apache.ibatis.annotations.Param;
9
+import org.apache.ibatis.annotations.ResultType;
9
 import org.apache.ibatis.annotations.Select;
10
 import org.apache.ibatis.annotations.Select;
10
 
11
 
11
 import java.io.Serializable;
12
 import java.io.Serializable;
55
      * @param personType
56
      * @param personType
56
      * @return
57
      * @return
57
      */
58
      */
58
-    @Select("select count(1) from ta_person where person_type != #{personType}")
59
+    @ResultType(Integer.class)
60
+    @Select("select count(1) from ta_person where ifnull(person_type, '') != #{personType}")
59
     Integer selectUserCount(@Param("personType") String personType);
61
     Integer selectUserCount(@Param("personType") String personType);
60
 
62
 
61
     /**
63
     /**
63
      * @param personType
65
      * @param personType
64
      * @return
66
      * @return
65
      */
67
      */
66
-    @Select("select count(1) from ta_person where person_type != #{personType} and phone is not null")
68
+    @ResultType(Integer.class)
69
+    @Select("select count(1) from ta_person where ifnull(person_type, '') != #{personType} and phone is not null")
67
     Integer selectRegisteredCount(@Param("personType") String personType);
70
     Integer selectRegisteredCount(@Param("personType") String personType);
68
 
71
 
69
     /**
72
     /**
106
      * @param personType
109
      * @param personType
107
      * @return
110
      * @return
108
      */
111
      */
109
-    @Select("select sex, count(1) from ta_person where person_type != #{personType} GROUP BY sex")
112
+    @Select("select sex, count(1) as sex_count from ta_person where ifnull(person_type, '') != #{personType} GROUP BY sex")
110
     List<Map<String, Object>> selectSexUser(@Param("personType") String personType);
113
     List<Map<String, Object>> selectSexUser(@Param("personType") String personType);
111
 
114
 
112
 
115
 
115
      * @param personType
118
      * @param personType
116
      * @return
119
      * @return
117
      */
120
      */
118
-    @Select("select city, count(1) from ta_person where person_type != #{personType} GROUP BY city")
121
+    @ResultType(Map.class)
122
+    @Select("select city, count(1) as city_count  from ta_person where ifnull(person_type, '') != #{personType} GROUP BY city")
119
     List<Map<String, Object>> selectCityUser(@Param("personType") String personType);
123
     List<Map<String, Object>> selectCityUser(@Param("personType") String personType);
120
 
124
 
121
 
125
 
132
      * 用户来源 柱状
136
      * 用户来源 柱状
133
      * @return
137
      * @return
134
      */
138
      */
135
-    List<Map<String, Object>> selectUserSourceColumnar(@Param("personType") String personType);
139
+    List<Map<String, Object>> selectUserSourceColumnar(@Param("personType") String personType, @Param("startDate")Date startDate, @Param("endDate")Date endDate);
136
 
140
 
141
+    /**
142
+     * 用户来源 数据列表
143
+     */
144
+    List<Map<String,Object>> selectUserSourceData(@Param("personType") String personType, @Param("startDate")Date startDate, @Param("endDate")Date endDate);
137
 
145
 
138
     // ------------- 用户来源 end ------------
146
     // ------------- 用户来源 end ------------
139
 
147
 

+ 2
- 0
src/main/java/com/huiju/estateagents/mapper/TaPersonVisitRecordMapper.java 查看文件

7
 import com.huiju.estateagents.entity.TaPersonVisitRecord;
7
 import com.huiju.estateagents.entity.TaPersonVisitRecord;
8
 import org.apache.ibatis.annotations.Mapper;
8
 import org.apache.ibatis.annotations.Mapper;
9
 import org.apache.ibatis.annotations.Param;
9
 import org.apache.ibatis.annotations.Param;
10
+import org.apache.ibatis.annotations.ResultType;
10
 import org.apache.ibatis.annotations.Select;
11
 import org.apache.ibatis.annotations.Select;
11
 
12
 
12
 import java.util.List;
13
 import java.util.List;
37
      *
38
      *
38
      * @return
39
      * @return
39
      */
40
      */
41
+    @ResultType(TaPersonVisitRecord.class)
40
     @Select("select * from ta_person_visit_record where event = #{event} and person_id = #{personId}")
42
     @Select("select * from ta_person_visit_record where event = #{event} and person_id = #{personId}")
41
     List<TaPersonVisitRecord> selectEventAll(@Param("event") String event, @Param("personId") Integer personId);
43
     List<TaPersonVisitRecord> selectEventAll(@Param("event") String event, @Param("personId") Integer personId);
42
 
44
 

+ 2
- 0
src/main/java/com/huiju/estateagents/mapper/TdPersonFromMapper.java 查看文件

3
 
3
 
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import com.huiju.estateagents.entity.TdPersonFrom;
5
 import com.huiju.estateagents.entity.TdPersonFrom;
6
+import org.apache.ibatis.annotations.Mapper;
6
 
7
 
7
 /**
8
 /**
8
  * <p>
9
  * <p>
12
  * @author jobob
13
  * @author jobob
13
  * @since 2019-08-08
14
  * @since 2019-08-08
14
  */
15
  */
16
+@Mapper
15
 public interface TdPersonFromMapper extends BaseMapper<TdPersonFrom> {
17
 public interface TdPersonFromMapper extends BaseMapper<TdPersonFrom> {
16
 
18
 
17
 }
19
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/IStatisticalService.java 查看文件

64
      * 用户来源 首页
64
      * 用户来源 首页
65
      * @return
65
      * @return
66
      */
66
      */
67
-    ResponseBean selectUserResource();
67
+    ResponseBean selectUserResource(Date startDate, Date endDate);
68
 
68
 
69
 }
69
 }

+ 6
- 2
src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java 查看文件

215
 
215
 
216
 
216
 
217
     @Override
217
     @Override
218
-    public ResponseBean selectUserResource() {
218
+    public ResponseBean selectUserResource(Date startDate, Date endDate) {
219
         ResponseBean responseBean = new ResponseBean();
219
         ResponseBean responseBean = new ResponseBean();
220
         // 用户来源 柱状
220
         // 用户来源 柱状
221
-        List<Map<String, Object>> mapList = taPersonMapper.selectUserSourceColumnar(CommConstant.PERSON_REALTY_CONSULTANT);
221
+        List<Map<String, Object>> mapList = taPersonMapper.selectUserSourceColumnar(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
222
 
222
 
223
         // 用户来源饼状
223
         // 用户来源饼状
224
         // 来源置业顾问, 来源全民经纪人,自由进入
224
         // 来源置业顾问, 来源全民经纪人,自由进入
230
         map.put("person_estate_agent", person_estate_agent);
230
         map.put("person_estate_agent", person_estate_agent);
231
         map.put("person_null", person_null);
231
         map.put("person_null", person_null);
232
 
232
 
233
+        // 用户来源 数据列表
234
+        List<Map<String, Object>> selectUserSourceData = taPersonMapper.selectUserSourceData(CommConstant.PERSON_ESTATE_AGENT, startDate, endDate);
233
 
235
 
234
         Map<String, Object> result = new HashMap<>();
236
         Map<String, Object> result = new HashMap<>();
235
         result.put("columnar", mapList);
237
         result.put("columnar", mapList);
236
         result.put("pie", map);
238
         result.put("pie", map);
239
+        result.put("data", selectUserSourceData);
237
 
240
 
241
+        responseBean.addSuccess(result);
238
         return responseBean;
242
         return responseBean;
239
     }
243
     }
240
 }
244
 }

+ 3
- 8
src/main/resources/mapper/TaBuildingDynamicMapper.xml 查看文件

89
     <select id="selectBuildingDynamicStatistical" resultType="map">
89
     <select id="selectBuildingDynamicStatistical" resultType="map">
90
             select
90
             select
91
             sum(pv_num) as pvNum,
91
             sum(pv_num) as pvNum,
92
-            <if test="saveOrShare === 'save'">
92
+            <if test="saveOrShare == 'save'">
93
                 sum(save_num) as saveNum
93
                 sum(save_num) as saveNum
94
             </if>
94
             </if>
95
-            <if test="saveOrShare === 'share'">
95
+            <if test="saveOrShare == 'share'">
96
                 sum(share_num) as shareNum
96
                 sum(share_num) as shareNum
97
             </if>
97
             </if>
98
             from ta_building_dynamic
98
             from ta_building_dynamic
101
     <select id="selectBuildingDynamicEnlistStatistical" resultType="map">
101
     <select id="selectBuildingDynamicEnlistStatistical" resultType="map">
102
         select
102
         select
103
         sum(pv_num) as pvNum,
103
         sum(pv_num) as pvNum,
104
-        <if test="saveOrShare === 'save'">
105
-            sum(save_num) as saveNum
106
-        </if>
107
-        <if test="saveOrShare === 'share'">
108
-            sum(enlist_num) as enlistNum
109
-        </if>
104
+        IFNULL(sum(enlist_num),0) as enlistNum
110
         from ta_building_dynamic
105
         from ta_building_dynamic
111
     </select>
106
     </select>
112
 
107
 

+ 5
- 5
src/main/resources/mapper/TaBuildingMapper.xml 查看文件

27
 
27
 
28
     <select id="selectBuildingStatistical" resultType="map">
28
     <select id="selectBuildingStatistical" resultType="map">
29
         select
29
         select
30
-          sum(pv_num) as pvNum,
31
-          <if test="saveOrShare === 'save'">
32
-              sum(save_num) as saveNum
30
+        IFNULL(sum(pv_num), 0) as pvNum,
31
+          <if test="saveOrShare == 'save'">
32
+              IFNULL(sum(save_num),0) as saveNum
33
           </if>
33
           </if>
34
-          <if test="saveOrShare === 'share'">
35
-              sum(share_num) as shareNum
34
+          <if test="saveOrShare == 'share'">
35
+              IFNULL(sum(share_num),0) as shareNum
36
           </if>
36
           </if>
37
         from ta_building
37
         from ta_building
38
     </select>
38
     </select>

+ 2
- 2
src/main/resources/mapper/TaNewsMapper.xml 查看文件

6
     <select id="selectNewsStatistical" resultType="map" >
6
     <select id="selectNewsStatistical" resultType="map" >
7
         select
7
         select
8
         sum(pv_num) as pvNum,
8
         sum(pv_num) as pvNum,
9
-        <if test="saveOrShare === 'save'">
9
+        <if test="saveOrShare == 'save'">
10
             sum(save_num) as saveNum
10
             sum(save_num) as saveNum
11
         </if>
11
         </if>
12
-        <if test="saveOrShare === 'share'">
12
+        <if test="saveOrShare == 'share'">
13
             sum(share_num) as shareNum
13
             sum(share_num) as shareNum
14
         </if>
14
         </if>
15
         from ta_news
15
         from ta_news

+ 52
- 18
src/main/resources/mapper/TaPersonMapper.xml 查看文件

140
     </select>
140
     </select>
141
 
141
 
142
 
142
 
143
-    <select id="selectRecentlyCount" >
143
+    <select id="selectRecentlyCount" resultType="integer" >
144
         SELECT
144
         SELECT
145
-          SUM(activity_count)
145
+          SUM(activity_count) as activity_count
146
         FROM
146
         FROM
147
         (
147
         (
148
             SELECT
148
             SELECT
164
             FROM
164
             FROM
165
             ta_person tp
165
             ta_person tp
166
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
166
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
167
-            where tp.person_type != #{personType}
167
+            where ifnull(tp.person_type, '') != #{personType}
168
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
168
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
169
     </select>
169
     </select>
170
 
170
 
190
             SELECT
190
             SELECT
191
             COUNT(1) as activityCount,
191
             COUNT(1) as activityCount,
192
             tpvr.visit_time AS visitTime,
192
             tpvr.visit_time AS visitTime,
193
-            tpvr.activity as activity
193
+            tbet.type_name as activity
194
             FROM
194
             FROM
195
             ta_person tp
195
             ta_person tp
196
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
196
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
197
-            where tp.person_type != #{personType}
197
+            INNER JOIN td_biz_event_type tbet ON tpvr.event_type = tbet.type_id
198
+            where ifnull(tp.person_type, '') != #{personType}
198
             GROUP BY tpvr.activity
199
             GROUP BY tpvr.activity
199
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.visitTime , '%Y-%m-%d' )
200
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.visitTime , '%Y-%m-%d' )
200
     </select>
201
     </select>
205
         FROM
206
         FROM
206
         (
207
         (
207
             SELECT
208
             SELECT
208
-              <if test="dateType === 'day'">
209
+              <if test="dateType == 'day'.toString()">
209
                   DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
210
                   DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
210
               </if>
211
               </if>
211
-              <if test="dateType === 'week'">
212
+              <if test="dateType == 'week'.toString()">
212
                   DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum WEEK ), '%Y-%m-%d' ) AS date
213
                   DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum WEEK ), '%Y-%m-%d' ) AS date
213
               </if>
214
               </if>
214
-              <if test="dateType === 'month'">
215
+              <if test="dateType == 'month'.toString()">
215
                   DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum MONTH ), '%Y-%m-%d' ) AS date
216
                   DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum MONTH ), '%Y-%m-%d' ) AS date
216
               </if>
217
               </if>
217
             FROM
218
             FROM
231
             FROM
232
             FROM
232
                ta_person tp
233
                ta_person tp
233
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
234
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
234
-             where tp.person_type != #{personType}
235
+             where ifnull(tp.person_type, '') != #{personType}
235
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
236
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
236
     </select>
237
     </select>
237
 
238
 
265
                 FROM
266
                 FROM
266
                 ta_person tp
267
                 ta_person tp
267
                 INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
268
                 INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
268
-                where tp.person_type != #{personType}
269
+                where ifnull(tp.person_type, '') != #{personType}
269
                 and tp.phone is NOT NULL
270
                 and tp.phone is NOT NULL
270
             ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
271
             ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
271
         ) as authorization_count_table
272
         ) as authorization_count_table
293
             FROM
294
             FROM
294
             ta_person tp
295
             ta_person tp
295
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
296
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
296
-            where tp.person_type != #{personType}
297
+            where ifnull(tp.person_type, '') != #{personType}
297
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
298
         ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
298
 
299
 
299
         ) as user_count_table
300
         ) as user_count_table
300
         GROUP BY date
301
         GROUP BY date
301
     </select>
302
     </select>
302
 
303
 
303
-    <select id="selectUserSourcePie">
304
+    <select id="selectUserSourcePie" resultType="integer">
304
         select count(1)
305
         select count(1)
305
         FROM ta_person
306
         FROM ta_person
306
-        WHERE person_type != #{personType}
307
+        WHERE ifnull(person_type, '') != #{personType}
307
         <if test="recommendPersonType != null and recommendPersonType != ''">
308
         <if test="recommendPersonType != null and recommendPersonType != ''">
308
             and recommend_person_type = #{recommendPersonType}
309
             and recommend_person_type = #{recommendPersonType}
309
         </if>
310
         </if>
319
             LEFT JOIN td_person_from tpfs
320
             LEFT JOIN td_person_from tpfs
320
             ON tps.from_code = tpfs.from_code
321
             ON tps.from_code = tpfs.from_code
321
             WHERE tpfs.from_code = tpf.from_code and tps.phone is NOT NULL
322
             WHERE tpfs.from_code = tpf.from_code and tps.phone is NOT NULL
322
-            and tps.person_type != #{personType}
323
+            and ifnull(tps.person_type, '') != #{personType}
323
             <if test="startDate != null or endDate != null">
324
             <if test="startDate != null or endDate != null">
324
                 and tps.create_date BETWEEN #{startDate} and #{endDate}
325
                 and tps.create_date BETWEEN #{startDate} and #{endDate}
325
             </if>
326
             </if>
326
             <if test="startDate == null or endDate == null">
327
             <if test="startDate == null or endDate == null">
327
-                and tps.create_date BETWEEN DATE_SUB( tp.create_date, INTERVAL 7 DAY ) and now()
328
+                and tps.create_date BETWEEN DATE_SUB( tps.create_date, INTERVAL 7 DAY ) and now()
328
             </if>
329
             </if>
329
         ) as registered,
330
         ) as registered,
330
         (
331
         (
334
             LEFT JOIN td_person_from tpfs
335
             LEFT JOIN td_person_from tpfs
335
             ON tps.from_code = tpfs.from_code
336
             ON tps.from_code = tpfs.from_code
336
             WHERE tpfs.from_code = tpf.from_code
337
             WHERE tpfs.from_code = tpf.from_code
337
-            and tps.person_type != #{personType}
338
+            and ifnull(tps.person_type, '') != #{personType}
338
             <if test="startDate != null or endDate != null">
339
             <if test="startDate != null or endDate != null">
339
                 and tps.create_date BETWEEN #{startDate} and #{endDate}
340
                 and tps.create_date BETWEEN #{startDate} and #{endDate}
340
             </if>
341
             </if>
341
             <if test="startDate == null or endDate == null">
342
             <if test="startDate == null or endDate == null">
342
-                and tps.create_date BETWEEN DATE_SUB( tp.create_date, INTERVAL 7 DAY ) and now()
343
+                and tps.create_date BETWEEN DATE_SUB( tps.create_date, INTERVAL 7 DAY ) and now()
343
             </if>
344
             </if>
344
         ) as user_count
345
         ) as user_count
345
 
346
 
346
         FROM td_person_from tpf
347
         FROM td_person_from tpf
347
         LEFT JOIN ta_person tp
348
         LEFT JOIN ta_person tp
348
         ON tp.from_code = tpf.from_code
349
         ON tp.from_code = tpf.from_code
349
-        where tp.person_type != #{personType}
350
+        where ifnull(tp.person_type, '') != #{personType}
350
         GROUP BY tpf.from_code
351
         GROUP BY tpf.from_code
351
     </select>
352
     </select>
352
 
353
 
354
+    <select id="selectUserSourceData" resultType="map">
355
+        select
356
+        *
357
+        FROM
358
+        (
359
+            SELECT
360
+              DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
361
+            FROM
362
+              sequence a
363
+            WHERE
364
+            <if test="startDate == null or endDate == null">
365
+                a.rownum <![CDATA[ <= ]]> 7
366
+            </if>
367
+            <if test="startDate != null or endDate != null">
368
+                a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
369
+            </if>
370
+        ) AS temp_date
371
+        LEFT JOIN
372
+        (
373
+            SELECT
374
+                COUNT(1) as count,
375
+                tps.create_date as create_date,
376
+                tpfs.from_code as from_code,
377
+                tpfs.from_name as from_name
378
+            FROM ta_person tps
379
+            LEFT JOIN td_person_from tpfs
380
+              ON tps.from_code = tpfs.from_code
381
+            WHERE tpfs.from_code = tps.from_code
382
+              and ifnull(tps.person_type, '') != #{personType}
383
+            GROUP BY tpfs.from_code
384
+        ) as user_count
385
+        ON DATE_FORMAT(user_count.create_date,'%Y-%m-%d') =  temp_date.date
386
+    </select>
353
 
387
 
354
 </mapper>
388
 </mapper>