瀏覽代碼

用户行为 时间区间

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

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

10
 import org.apache.ibatis.annotations.ResultType;
10
 import org.apache.ibatis.annotations.ResultType;
11
 import org.apache.ibatis.annotations.Select;
11
 import org.apache.ibatis.annotations.Select;
12
 
12
 
13
+import java.time.LocalDate;
13
 import java.util.List;
14
 import java.util.List;
14
 
15
 
15
 /**
16
 /**
31
      * @return
32
      * @return
32
      */
33
      */
33
     IPage<TaPersonVisitRecord> selectAll(IPage<TaPersonVisitRecord> page,
34
     IPage<TaPersonVisitRecord> selectAll(IPage<TaPersonVisitRecord> page,
35
+                                         @Param("startDate") LocalDate startDate,
36
+                                         @Param("endDate")LocalDate endDate,
34
                                          @Param("buildingId") String buildingId,
37
                                          @Param("buildingId") String buildingId,
35
                                          @Param("eventType") String eventType,
38
                                          @Param("eventType") String eventType,
36
                                          @Param("event") String event,
39
                                          @Param("event") String event,

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

177
         List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate, buildingId, eventType, event, activity);
177
         List<PersonPO> selectUserBehavior = taPersonMapper.selectUserBehavior(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate, buildingId, eventType, event, activity);
178
 
178
 
179
         IPage<TaPersonVisitRecord> page = new Page<>(pageNum, pageSize);
179
         IPage<TaPersonVisitRecord> page = new Page<>(pageNum, pageSize);
180
-        IPage<TaPersonVisitRecord> visitRecordIPage = taPersonVisitRecordMapper.selectAll(page, buildingId, eventType, event, activity);
180
+        IPage<TaPersonVisitRecord> visitRecordIPage = taPersonVisitRecordMapper.selectAll(page, startDate, endDate, buildingId, eventType, event, activity);
181
 
181
 
182
         Map<String, Object> map = new HashMap<>();
182
         Map<String, Object> map = new HashMap<>();
183
         map.put("selectUserBehavior", selectUserBehavior);
183
         map.put("selectUserBehavior", selectUserBehavior);

+ 6
- 0
src/main/resources/mapper/TaPersonVisitRecordMapper.xml 查看文件

13
             tpvr.person_type as personType,
13
             tpvr.person_type as personType,
14
             tpvr.building_id as buildingId,
14
             tpvr.building_id as buildingId,
15
             tpvr.activity as activity,
15
             tpvr.activity as activity,
16
+            tpvr.event as event,
17
+            tpvr.event_type as eventType,
18
+            tpvr.visit_duration as visitDuration,
16
             (SELECT MIN(t.visit_time) FROM ta_person_visit_record t WHERE t.person_id = tpvr.person_id and t.event = tpvr.event ) as visitTime,
19
             (SELECT MIN(t.visit_time) FROM ta_person_visit_record t WHERE t.person_id = tpvr.person_id and t.event = tpvr.event ) as visitTime,
17
             (SELECT MAX(t.leave_time) FROM ta_person_visit_record t WHERE t.person_id = tpvr.person_id and t.event = tpvr.event ) as leaveTime,
20
             (SELECT MAX(t.leave_time) FROM ta_person_visit_record t WHERE t.person_id = tpvr.person_id and t.event = tpvr.event ) as leaveTime,
18
             ifnull(tp.name, tp.nickname) as userName,
21
             ifnull(tp.name, tp.nickname) as userName,
23
             LEFT JOIN ta_person tp ON tpvr.person_id = tp.person_id
26
             LEFT JOIN ta_person tp ON tpvr.person_id = tp.person_id
24
             LEFT JOIN td_biz_event tbe on tpvr.event = tbe.event_code
27
             LEFT JOIN td_biz_event tbe on tpvr.event = tbe.event_code
25
             <trim prefix="where" prefixOverrides="and | or">
28
             <trim prefix="where" prefixOverrides="and | or">
29
+                <if test="startDate != null and endDate != null">
30
+                    and tpvr.visit_time between #{startDate} and #{endDate}
31
+                </if>
26
                 <if test="buildingId != null and buildingId != ''">
32
                 <if test="buildingId != null and buildingId != ''">
27
                     and tpvr.building_id = #{buildingId}
33
                     and tpvr.building_id = #{buildingId}
28
                 </if>
34
                 </if>