Parcourir la source

活动报名统计

魏熙美 il y a 5 ans
Parent
révision
01e9a56f57

+ 1
- 8
src/main/java/com/huiju/estateagents/service/impl/TaBuildingDynamicServiceImpl.java Voir le fichier

@@ -78,16 +78,9 @@ public class TaBuildingDynamicServiceImpl extends ServiceImpl<TaBuildingDynamicM
78 78
         page.setCurrent(pageNum == null ? 1 : pageNum);
79 79
 
80 80
         IPage<TaBuildingDynamic> buildingDynamic = buildingDynamicMapper.buildingDynamicList(page, name, buildingId,cityId,isEnlist,time,title,orgId);
81
-        List<TaBuildingDynamic> buildingDynamicList = buildingDynamic.getRecords();
82
-        for (TaBuildingDynamic taBuildingDynamic:buildingDynamicList){
83
-            QueryWrapper<TaActivityDynamicEnlist> taActivityDynamicEnlist= new QueryWrapper<>();
84
-            taActivityDynamicEnlist.eq("dynamic_id",taBuildingDynamic.getDynamicId());
85
-            int singCount= taActivityDynamicEnlistMapper.selectCount(taActivityDynamicEnlist);
86
-            taBuildingDynamic.setCount(singCount);
87
-        }
88 81
 
89 82
         HashMap hashMap= new HashMap<>();
90
-        hashMap.put("list",buildingDynamicList);
83
+        hashMap.put("list",buildingDynamic.getRecords());
91 84
         hashMap.put("total",buildingDynamic.getTotal());
92 85
         hashMap.put("pageNum",buildingDynamic.getCurrent());
93 86
         hashMap.put("pageSize",buildingDynamic.getSize());

+ 12
- 9
src/main/resources/mapper/TaBuildingDynamicMapper.xml Voir le fichier

@@ -17,29 +17,32 @@
17 17
           )
18 18
     </insert>
19 19
     <select id="buildingDynamicList" resultType="com.huiju.estateagents.entity.TaBuildingDynamic">
20
-        select * from ta_building_dynamic where status>-1
20
+        select
21
+        *,
22
+        (select sum(tade.attend_num) from ta_activity_dynamic_enlist tade where tade.dynamic_id = tbd.dynamic_id ) as count
23
+        from ta_building_dynamic tbd where tbd.status>-1
21 24
         <if test="name != null and name !=''">
22
-            and title like CONCAT('%', #{name} , '%')
25
+            and tbd.title like CONCAT('%', #{name} , '%')
23 26
         </if>
24 27
         <if test="buildingId != null and buildingId !=''">
25
-            and building_id = #{buildingId}
28
+            and tbd.building_id = #{buildingId}
26 29
         </if>
27 30
         <if test="isEnlist != null and isEnlist !=''">
28
-            and is_enlist = #{isEnlist}
31
+            and tbd.is_enlist = #{isEnlist}
29 32
         </if>
30 33
         <if test="cityId != 0 and cityId != null">
31
-            and city_id = #{cityId}
34
+            and tbd.city_id = #{cityId}
32 35
         </if>
33 36
         <if test="title != null and title != ''">
34
-            and title like CONCAT('%', #{title} , '%')
37
+            and tbd.title like CONCAT('%', #{title} , '%')
35 38
         </if>
36 39
         <if test="orgId != null and orgId != ''">
37
-            and org_id = #{orgId}
40
+            and tbd.org_id = #{orgId}
38 41
         </if>
39 42
         <if test="time != null">
40
-            and TO_DAYS(create_date) = TO_DAYS(#{time})
43
+            and TO_DAYS(tbd.create_date) = TO_DAYS(#{time})
41 44
         </if>
42
-        ORDER BY create_date DESC
45
+        ORDER BY tbd.create_date DESC
43 46
   </select>
44 47
 
45 48
     <select id="iBuildingDynamicSelectId" parameterType="string" resultType="com.huiju.estateagents.entity.TaBuildingDynamic">