傅行帆 3 years ago
parent
commit
0d05ec77a0

+ 1
- 1
src/main/java/com/yunzhi/marketing/controller/TaRecommendCustomerController.java View File

578
     public ResponseBean getCustomersIRecommended(@RequestParam int pageNumber, @RequestParam int pageSize, @PathVariable String customerId, HttpServletRequest request) {
578
     public ResponseBean getCustomersIRecommended(@RequestParam int pageNumber, @RequestParam int pageSize, @PathVariable String customerId, HttpServletRequest request) {
579
         Integer orgId = getOrgId(request);
579
         Integer orgId = getOrgId(request);
580
         try {
580
         try {
581
-            return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber, pageSize, customerId, orgId, getTaPersonBuildingListByUserId(request),null,null,null));
581
+            return ResponseBean.success(taRecommendCustomerService.getCustomersRecommended(pageNumber, pageSize, customerId, orgId, getTaPersonBuildingListByUserId(request),null,null,null));
582
         } catch (Exception e) {
582
         } catch (Exception e) {
583
             e.printStackTrace();
583
             e.printStackTrace();
584
             return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
584
             return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);

+ 20
- 20
src/main/java/com/yunzhi/marketing/excel/TaActivityDynamicEnlistExport.java View File

37
     @ExcelProperty(value = "报名时间", index = 3)
37
     @ExcelProperty(value = "报名时间", index = 3)
38
     private Date createDate;
38
     private Date createDate;
39
 
39
 
40
-    /**
41
-     * 推广人
42
-     */
43
-    @ColumnWidth(15)
44
-    @ExcelProperty(value = "引流人", index = 4)
45
-    private String sharePersonName;
46
-
47
-    /*
48
-     * 公司
49
-     */
50
-    @ColumnWidth(15)
51
-    @ExcelProperty(value = "公司", index = 5)
52
-    private String orgName;
53
-
54
-    /**
55
-     * 公司
56
-     */
57
-    @ColumnWidth(15)
58
-    @ExcelProperty(value = "签到状态", index = 6)
59
-    private String isCheckin;
40
+//    /**
41
+//     * 推广人
42
+//     */
43
+//    @ColumnWidth(15)
44
+//    @ExcelProperty(value = "引流人", index = 4)
45
+//    private String sharePersonName;
46
+//
47
+//    /*
48
+//     * 公司
49
+//     */
50
+//    @ColumnWidth(15)
51
+//    @ExcelProperty(value = "公司", index = 5)
52
+//    private String orgName;
53
+//
54
+//    /**
55
+//     * 公司
56
+//     */
57
+//    @ColumnWidth(15)
58
+//    @ExcelProperty(value = "签到状态", index = 6)
59
+//    private String isCheckin;
60
 
60
 
61
 
61
 
62
 
62
 

+ 2
- 0
src/main/java/com/yunzhi/marketing/mapper/TaRecommendCustomerMapper.java View File

312
      * @return
312
      * @return
313
      */
313
      */
314
     IPage<TaRecommendCustomerPO> getMarkingCustList(IPage<TaRecommendCustomerPO> page,@Param("keywords") String keywords,@Param("buildingId") String buildingId);
314
     IPage<TaRecommendCustomerPO> getMarkingCustList(IPage<TaRecommendCustomerPO> page,@Param("keywords") String keywords,@Param("buildingId") String buildingId);
315
+
316
+    IPage<TaRecommendCustomerPO> getCustomersRecommended(IPage<TaRecommendCustomerPO> page, @Param("customerId") String customerId, @Param("status") Integer status, @Param("orgId") Integer orgId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,@Param("startDate") LocalDateTime startDate,@Param("endDate") LocalDateTime endDate);
315
 }
317
 }

+ 2
- 0
src/main/java/com/yunzhi/marketing/service/ITaRecommendCustomerService.java View File

55
 
55
 
56
     TaRecommendCustomer getCustomerById(String customerId);
56
     TaRecommendCustomer getCustomerById(String customerId);
57
 
57
 
58
+    IPage<TaRecommendCustomerPO> getCustomersRecommended(int pageNumber, int pageSize, String customerId, Integer orgId, List<TaPersonBuilding> taPersonBuildingList, LocalDateTime startDate,LocalDateTime endDate,Integer status);
59
+
58
     IPage<TaRecommendCustomerPO> getCustomersIRecommended(int pageNumber, int pageSize, String customerId, Integer orgId, List<TaPersonBuilding> taPersonBuildingList, LocalDateTime startDate,LocalDateTime endDate,Integer status);
60
     IPage<TaRecommendCustomerPO> getCustomersIRecommended(int pageNumber, int pageSize, String customerId, Integer orgId, List<TaPersonBuilding> taPersonBuildingList, LocalDateTime startDate,LocalDateTime endDate,Integer status);
59
 
61
 
60
     TaRecommendCustomer newByPerson(TaPerson person);
62
     TaRecommendCustomer newByPerson(TaPerson person);

+ 24
- 0
src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java View File

1366
         return customersIRecommended;
1366
         return customersIRecommended;
1367
     }
1367
     }
1368
 
1368
 
1369
+    @Override
1370
+    public IPage<TaRecommendCustomerPO> getCustomersRecommended(int pageNumber, int pageSize, String customerId, Integer orgId, List<TaPersonBuilding> taPersonBuildingList, LocalDateTime startDate,LocalDateTime endDate,Integer status) {
1371
+
1372
+//        QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();
1373
+        // todo
1374
+        // 此处可能不是 person_id 而是 recommend_person
1375
+        IPage<TaRecommendCustomerPO> page = new Page<>(pageNumber, pageSize);
1376
+        IPage<TaRecommendCustomerPO> customersIRecommended = taRecommendCustomerMapper.getCustomersRecommended(page, customerId, status, orgId, taPersonBuildingList, startDate, endDate);
1377
+        List<TaRecommendCustomerPO> records = customersIRecommended.getRecords();
1378
+        records.forEach(e -> {
1379
+            LambdaQueryWrapper<BuildingChannel> lambdaQueryWrapper = new LambdaQueryWrapper<>();
1380
+            lambdaQueryWrapper.eq(BuildingChannel::getBuildingId,e.getBuildingId());
1381
+            lambdaQueryWrapper.last("limit 1");
1382
+            BuildingChannel buildingChannel = buildingChannelMapper.selectOne(lambdaQueryWrapper);
1383
+
1384
+            if (null != buildingChannel) {
1385
+                Integer expirationDay = buildingChannel.getExpirationDate();
1386
+                LocalDateTime expirationDate = e.getCreateDate().plusDays(expirationDay);
1387
+                e.setExpirationDate(expirationDate);
1388
+            }
1389
+        });
1390
+        return customersIRecommended;
1391
+    }
1392
+
1369
     @Override
1393
     @Override
1370
     public TaRecommendCustomer newByPerson(TaPerson person) {
1394
     public TaRecommendCustomer newByPerson(TaPerson person) {
1371
         // 没有手机号, 暂时不生成客户信息
1395
         // 没有手机号, 暂时不生成客户信息

+ 25
- 0
src/main/java/com/yunzhi/marketing/xlk/controller/PcIndexStatisticsController.java View File

86
      * 项目排行统计图
86
      * 项目排行统计图
87
      * @return
87
      * @return
88
      */
88
      */
89
+    @ApiOperation(value = "admin-项目排行统计图", notes = "admin-项目排行统计图")
89
     @GetMapping(value = "/admin/statistics/barList")
90
     @GetMapping(value = "/admin/statistics/barList")
90
     public ResponseBean selectBuildingBar(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime startDate,
91
     public ResponseBean selectBuildingBar(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime startDate,
91
                                           @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDateTime endDate,
92
                                           @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDateTime endDate,
100
         pcStatisticsDTO.setCityId(cityId);
101
         pcStatisticsDTO.setCityId(cityId);
101
         return pcStatisticsService.getStatsBarList(taUser, pcStatisticsDTO);
102
         return pcStatisticsService.getStatsBarList(taUser, pcStatisticsDTO);
102
     }
103
     }
104
+
105
+    /**
106
+     * 活动统计
107
+     * @return
108
+     */
109
+    @ApiOperation(value = "admin-活动统计", notes = "admin-活动统计")
110
+    @GetMapping(value = "/admin/statistics/activityList")
111
+    public ResponseBean selectActivityList(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime startDate,
112
+                                          @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDateTime endDate,
113
+                                          @RequestParam(value = "buildingId", required = false) String buildingId,
114
+                                           @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
115
+                                           @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
116
+                                          HttpServletRequest request) {
117
+        Integer userId = getUserId(request);
118
+        TaUser taUser = iTaUserService.getById(userId);
119
+        PcStatisticsDTO pcStatisticsDTO = new PcStatisticsDTO();
120
+        pcStatisticsDTO.setOrgId(taUser.getOrgId());
121
+        pcStatisticsDTO.setStartTime(startDate);
122
+        pcStatisticsDTO.setEndTime(endDate);
123
+        pcStatisticsDTO.setBuildingId(buildingId);
124
+        pcStatisticsDTO.setPageNum(pageNum);
125
+        pcStatisticsDTO.setPageSize(pageSize);
126
+        return pcStatisticsService.selectActivityList(taUser, pcStatisticsDTO);
127
+    }
103
 }
128
 }

+ 10
- 0
src/main/java/com/yunzhi/marketing/xlk/dto/PcStatisticsDTO.java View File

33
      * 结束时间
33
      * 结束时间
34
      */
34
      */
35
     private LocalDateTime endTime;
35
     private LocalDateTime endTime;
36
+
37
+    /**
38
+     * 楼盘id
39
+     *
40
+     */
41
+    private String buildingId;
42
+
43
+    private Integer pageSize;
44
+
45
+    private Integer pageNum;
36
 }
46
 }

+ 10
- 0
src/main/java/com/yunzhi/marketing/xlk/mapper/PcStatisticsMapper.java View File

1
 package com.yunzhi.marketing.xlk.mapper;
1
 package com.yunzhi.marketing.xlk.mapper;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.yunzhi.marketing.center.taUser.entity.TaUser;
4
 import com.yunzhi.marketing.center.taUser.entity.TaUser;
4
 import com.yunzhi.marketing.xlk.dto.PcStatisticsDTO;
5
 import com.yunzhi.marketing.xlk.dto.PcStatisticsDTO;
6
+import com.yunzhi.marketing.xlk.vo.PcStatisticsActivityVO;
5
 import com.yunzhi.marketing.xlk.vo.PcStatisticsGenderVO;
7
 import com.yunzhi.marketing.xlk.vo.PcStatisticsGenderVO;
6
 import com.yunzhi.marketing.xlk.vo.PcStatisticsLeaderboardVO;
8
 import com.yunzhi.marketing.xlk.vo.PcStatisticsLeaderboardVO;
7
 import com.yunzhi.marketing.xlk.vo.PcStatisticsVO;
9
 import com.yunzhi.marketing.xlk.vo.PcStatisticsVO;
92
      * @return
94
      * @return
93
      */
95
      */
94
     List<PcStatisticsLeaderboardVO> getSuccessLeaderboard(@Param("params") PcStatisticsDTO pcStatisticsDTO);
96
     List<PcStatisticsLeaderboardVO> getSuccessLeaderboard(@Param("params") PcStatisticsDTO pcStatisticsDTO);
97
+
98
+    /**
99
+     * 活动列表
100
+     * @param page
101
+     * @param pcStatisticsDTO
102
+     * @return
103
+     */
104
+    IPage<PcStatisticsActivityVO> selectActivityList(IPage<PcStatisticsActivityVO> page,@Param("params") PcStatisticsDTO pcStatisticsDTO);
95
 }
105
 }

+ 8
- 0
src/main/java/com/yunzhi/marketing/xlk/service/IPcStatisticsService.java View File

41
      * @return
41
      * @return
42
      */
42
      */
43
     ResponseBean getStatsBarList(TaUser taUser, PcStatisticsDTO pcStatisticsDTO);
43
     ResponseBean getStatsBarList(TaUser taUser, PcStatisticsDTO pcStatisticsDTO);
44
+
45
+    /**
46
+     * 获取活动列表接口
47
+     * @param taUser
48
+     * @param pcStatisticsDTO
49
+     * @return
50
+     */
51
+    ResponseBean selectActivityList(TaUser taUser, PcStatisticsDTO pcStatisticsDTO);
44
 }
52
 }

+ 22
- 0
src/main/java/com/yunzhi/marketing/xlk/service/impl/IPcStatisticsServiceimpl.java View File

1
 package com.yunzhi.marketing.xlk.service.impl;
1
 package com.yunzhi.marketing.xlk.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
3
 import com.yunzhi.marketing.base.ResponseBean;
5
 import com.yunzhi.marketing.base.ResponseBean;
6
+import com.yunzhi.marketing.center.taUser.entity.TaTagUser;
4
 import com.yunzhi.marketing.center.taUser.entity.TaUser;
7
 import com.yunzhi.marketing.center.taUser.entity.TaUser;
5
 import com.yunzhi.marketing.common.CommConstant;
8
 import com.yunzhi.marketing.common.CommConstant;
6
 import com.yunzhi.marketing.dto.StatisticsDTO;
9
 import com.yunzhi.marketing.dto.StatisticsDTO;
10
+import com.yunzhi.marketing.entity.TaRecommendCustomer;
7
 import com.yunzhi.marketing.xlk.dto.PcStatisticsDTO;
11
 import com.yunzhi.marketing.xlk.dto.PcStatisticsDTO;
8
 import com.yunzhi.marketing.xlk.entity.Institution;
12
 import com.yunzhi.marketing.xlk.entity.Institution;
9
 import com.yunzhi.marketing.xlk.mapper.InstitutionMapper;
13
 import com.yunzhi.marketing.xlk.mapper.InstitutionMapper;
10
 import com.yunzhi.marketing.xlk.mapper.PcStatisticsMapper;
14
 import com.yunzhi.marketing.xlk.mapper.PcStatisticsMapper;
11
 import com.yunzhi.marketing.xlk.service.IInstitutionService;
15
 import com.yunzhi.marketing.xlk.service.IInstitutionService;
12
 import com.yunzhi.marketing.xlk.service.IPcStatisticsService;
16
 import com.yunzhi.marketing.xlk.service.IPcStatisticsService;
17
+import com.yunzhi.marketing.xlk.vo.PcStatisticsActivityVO;
13
 import com.yunzhi.marketing.xlk.vo.PcStatisticsGenderVO;
18
 import com.yunzhi.marketing.xlk.vo.PcStatisticsGenderVO;
14
 import com.yunzhi.marketing.xlk.vo.PcStatisticsLeaderboardVO;
19
 import com.yunzhi.marketing.xlk.vo.PcStatisticsLeaderboardVO;
15
 import com.yunzhi.marketing.xlk.vo.PcStatisticsVO;
20
 import com.yunzhi.marketing.xlk.vo.PcStatisticsVO;
149
         map.put("successList",successList);
154
         map.put("successList",successList);
150
         return ResponseBean.success(map);
155
         return ResponseBean.success(map);
151
     }
156
     }
157
+
158
+    /**
159
+     * 获取活动列表接口
160
+     *
161
+     * @param taUser
162
+     * @param pcStatisticsDTO
163
+     * @return
164
+     */
165
+    @Override
166
+    public ResponseBean selectActivityList(TaUser taUser, PcStatisticsDTO pcStatisticsDTO) {
167
+        Institution institution = institutionMapper.selectById(taUser.getInstitutionId());
168
+        pcStatisticsDTO.setInstitutionCode(institution.getInstitutionCode());
169
+
170
+        IPage<PcStatisticsActivityVO> page = new Page<>(pcStatisticsDTO.getPageNum(),pcStatisticsDTO.getPageSize());
171
+        IPage<PcStatisticsActivityVO> result = pcStatisticsMapper.selectActivityList(page,pcStatisticsDTO);
172
+        return ResponseBean.success(result);
173
+    }
152
 }
174
 }

+ 38
- 0
src/main/java/com/yunzhi/marketing/xlk/vo/PcStatisticsActivityVO.java View File

1
+package com.yunzhi.marketing.xlk.vo;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class PcStatisticsActivityVO {
7
+
8
+    /**
9
+     * 访问人数
10
+     */
11
+    private Integer visitPersonNum;
12
+
13
+    /**
14
+     * 访问次数
15
+     */
16
+    private Integer visitNum;
17
+
18
+    /**
19
+     * 报名人数
20
+     */
21
+    private Integer signNum;
22
+
23
+    /**
24
+     * 楼盘id
25
+     *
26
+     */
27
+    private String buildingId;
28
+
29
+    /**
30
+     * 活动id
31
+     */
32
+    private String dynamicId;
33
+
34
+    /**
35
+     * 活动标题
36
+     */
37
+    private String title;
38
+}

+ 1
- 1
src/main/resources/mapper/TaPersonMapper.xml View File

520
         p.*,
520
         p.*,
521
         COUNT(rc.person_id) AS recommendCount
521
         COUNT(rc.person_id) AS recommendCount
522
         from ta_channel_person tch
522
         from ta_channel_person tch
523
-        left join  ta_person p on  tch.person_id = p.person_id and p.person_type = 'estate agent' and tch.status = 1
523
+        left join  ta_person p on  tch.person_id = p.person_id and p.person_type in ( 'estate agent', 'channel agent') and tch.status = 1
524
         LEFT JOIN ta_recommend_customer rc ON p.person_id = rc.person_id
524
         LEFT JOIN ta_recommend_customer rc ON p.person_id = rc.person_id
525
         <where>
525
         <where>
526
         <if test="name !=null and name !=''">
526
         <if test="name !=null and name !=''">

+ 29
- 0
src/main/resources/mapper/TaRecommendCustomerMapper.xml View File

1041
             and t.name like CONCAT('%',#{keywords}, '%')
1041
             and t.name like CONCAT('%',#{keywords}, '%')
1042
         </if>
1042
         </if>
1043
     </select>
1043
     </select>
1044
+    <select id="getCustomersRecommended" resultType="com.yunzhi.marketing.po.TaRecommendCustomerPO">
1045
+        select a.customer_id AS id,
1046
+        a.NAME,
1047
+        a.phone,
1048
+        a.picture,
1049
+        a.sex,
1050
+        a.building_id AS buildingId,
1051
+        "customer" AS type,
1052
+        a.create_date as createDate,
1053
+        a.realty_consultant AS consultant,
1054
+        a.STATUS AS customerStatus,
1055
+        NULL AS channelStatus,
1056
+        b.avatarurl
1057
+        from ta_recommend_customer a left join ta_person b on a.person_id = b.person_id
1058
+        where a.recommend_person = #{customerId}
1059
+        <if test="status != null and status !=''">
1060
+            and a.status = #{status}
1061
+        </if>
1062
+        <if test="startDate != null or endDate != null">
1063
+            AND a.create_date BETWEEN #{startDate} and #{endDate}
1064
+        </if>
1065
+        and a.org_id = #{orgId}
1066
+        <if test="personBuildingList != null and personBuildingList.size > 0">
1067
+            AND a.building_id in
1068
+            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
1069
+                #{personBuilding.buildingId}
1070
+            </foreach>
1071
+        </if>
1072
+    </select>
1044
 </mapper>
1073
 </mapper>

+ 56
- 4
src/main/resources/mapper/xlk/PcStatisticsMapper.xml View File

69
             LEFT JOIN xlk_institution i ON b.institution_id = i.institution_id
69
             LEFT JOIN xlk_institution i ON b.institution_id = i.institution_id
70
         WHERE
70
         WHERE
71
             b.STATUS > 0
71
             b.STATUS > 0
72
-            AND b.org_id = 1
72
+            AND b.org_id = #{params.orgId}
73
             AND b.verify_status = 1
73
             AND b.verify_status = 1
74
             AND ( b.realty_consultant IS NULL OR b.realty_consultant = '' )
74
             AND ( b.realty_consultant IS NULL OR b.realty_consultant = '' )
75
             AND b.building_id IS NOT NULL
75
             AND b.building_id IS NOT NULL
98
         LEFT JOIN xlk_institution i ON b.institution_id = i.institution_id
98
         LEFT JOIN xlk_institution i ON b.institution_id = i.institution_id
99
         WHERE
99
         WHERE
100
             b.STATUS > 0
100
             b.STATUS > 0
101
-        AND b.org_id = 1
101
+        AND b.org_id = #{params.orgId}
102
         AND b.verify_status = 1
102
         AND b.verify_status = 1
103
         AND b.realty_consultant IS NOT NULL
103
         AND b.realty_consultant IS NOT NULL
104
         AND b.realty_consultant != ''
104
         AND b.realty_consultant != ''
128
             LEFT JOIN xlk_institution i ON d.institution_id = i.institution_id
128
             LEFT JOIN xlk_institution i ON d.institution_id = i.institution_id
129
         WHERE
129
         WHERE
130
             a.tagert_type = 'project'
130
             a.tagert_type = 'project'
131
-            AND d.org_id = 1
131
+            AND d.org_id = #{params.orgId}
132
             AND a.be_uv != "undefined"
132
             AND a.be_uv != "undefined"
133
         <if test="params.cityId != null">
133
         <if test="params.cityId != null">
134
             and d.city_id = #{params.cityId}
134
             and d.city_id = #{params.cityId}
157
         LEFT JOIN xlk_institution i ON b.institution_id = i.institution_id
157
         LEFT JOIN xlk_institution i ON b.institution_id = i.institution_id
158
         WHERE
158
         WHERE
159
             b.STATUS > 3
159
             b.STATUS > 3
160
-        AND b.org_id = 1
160
+        AND b.org_id = #{params.orgId}
161
         AND b.verify_status = 1
161
         AND b.verify_status = 1
162
         AND b.building_id IS NOT NULL
162
         AND b.building_id IS NOT NULL
163
         <if test="params.cityId != null">
163
         <if test="params.cityId != null">
174
         ORDER BY num desc
174
         ORDER BY num desc
175
         LIMIT 6
175
         LIMIT 6
176
     </select>
176
     </select>
177
+    <select id="selectActivityList" resultType="com.yunzhi.marketing.xlk.vo.PcStatisticsActivityVO">
178
+        SELECT
179
+            p.visit_num,
180
+            v.visit_person_num,
181
+            d.sign_num,
182
+            t.title,
183
+            t.dynamic_id,
184
+            t.building_id
185
+        FROM
186
+        ta_building_dynamic t
187
+        LEFT JOIN (
188
+            SELECT
189
+            count( * ) AS visit_num,
190
+            a.target_id
191
+            FROM
192
+            ta_person_visit_record a
193
+            WHERE
194
+            a.event_type = 'activity'
195
+            AND a.`event` = 'detail'
196
+            AND a.org_id = #{params.orgId}
197
+            GROUP BY
198
+            a.target_id
199
+        ) p ON t.dynamic_id = p.target_id
200
+        LEFT JOIN (
201
+        SELECT
202
+        count( DISTINCT ( a.person_id ) ) AS visit_person_num,
203
+        a.target_id
204
+        FROM
205
+        ta_person_visit_record a
206
+        WHERE
207
+        a.event_type = 'activity'
208
+        AND a.`event` = 'detail'
209
+        AND a.org_id = #{params.orgId}
210
+        GROUP BY
211
+        a.target_id
212
+        ) v ON t.dynamic_id = v.target_id
213
+        LEFT JOIN ( SELECT COUNT( 1 ) AS sign_num, dynamic_id FROM ta_activity_dynamic_enlist GROUP BY dynamic_id ) d ON t.dynamic_id = d.dynamic_id
214
+        LEFT JOIN xlk_institution i ON b.institution_id = i.institution_id
215
+        where
216
+        t.org_id = #{params.orgId}
217
+        <if test="params.startTime != null">
218
+            and  TO_DAYS(t.create_date) >= TO_DAYS(#{params.startTime})
219
+        </if>
220
+        <if test="params.endTime != null">
221
+            and  TO_DAYS(t.create_date) &lt;= TO_DAYS(#{params.endTime})
222
+        </if>
223
+        <if test="params.buildingId != null and params.buildingId != ''">
224
+            and  t.building_id = #{params.buildingId}
225
+        </if>
226
+        AND i.institution_code like CONCAT(#{params.institutionCode}, '%')
227
+        order by t.create_date desc
228
+    </select>
177
 </mapper>
229
 </mapper>