Przeglądaj źródła

首页和项目详情轮播图

dingxin 5 lat temu
rodzic
commit
abc6a78246

+ 2
- 3
src/main/java/com/huiju/estateagents/controller/HelpActivityController.java Wyświetl plik

@@ -512,9 +512,8 @@ public class HelpActivityController extends BaseController {
512 512
     })
513 513
     @RequestMapping(value = "/wx/helpActivityAndGroup", method = RequestMethod.GET)
514 514
     public ResponseBean wxhelpActivityAndGroup(HttpServletRequest request,
515
-                                               @RequestParam(value = "buildingId",required = false) String buildingId,
516
-                                               @RequestParam(value = "type",required = false)Integer type) {
517
-            ResponseBean lsit = taHelpActivityService.wxhelpActivityAndGroup(getOrgId(request),type,buildingId);
515
+                                               @RequestParam(value = "buildingId",required = false) String buildingId) {
516
+            ResponseBean lsit = taHelpActivityService.wxhelpActivityAndGroup(getOrgId(request),buildingId);
518 517
                 return lsit;
519 518
         }
520 519
 

+ 2
- 1
src/main/java/com/huiju/estateagents/mapper/HelpActivityMapper.java Wyświetl plik

@@ -40,9 +40,10 @@ public interface HelpActivityMapper extends BaseMapper<HelpActivity> {
40 40
     /**
41 41
      * 微信端查询拼团和助力推首页的活动的
42 42
      * @param orgId
43
+     * @param buildingId
43 44
      * @return
44 45
      */
45
-    List<HelpActivity> selectWxhelpActivityAndGroup(Integer orgId);
46
+    List<HelpActivity> selectWxhelpActivityAndGroup(@Param("orgId")Integer orgId,@Param("buildingId") String buildingId);
46 47
 
47 48
     /**
48 49
      * 列表 已开始 和 未开始

+ 1
- 1
src/main/java/com/huiju/estateagents/service/IHelpActivityService.java Wyświetl plik

@@ -130,7 +130,7 @@ public interface IHelpActivityService extends IService<HelpActivity> {
130 130
      * @param orgId
131 131
      * @return
132 132
      */
133
-    ResponseBean wxhelpActivityAndGroup(Integer orgId,Integer type,String buildingId);
133
+    ResponseBean wxhelpActivityAndGroup(Integer orgId,String buildingId);
134 134
 
135 135
     /**
136 136
      * 列表  已开始 和 未开始

+ 3
- 21
src/main/java/com/huiju/estateagents/service/impl/HelpActivityServiceImpl.java Wyświetl plik

@@ -207,28 +207,10 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
207 207
     }
208 208
 
209 209
     @Override
210
-    public ResponseBean wxhelpActivityAndGroup(Integer orgId,Integer type,String buildingId) {
210
+    public ResponseBean wxhelpActivityAndGroup(Integer orgId,String buildingId) {
211 211
         ResponseBean responseBean = new ResponseBean<>();
212
-        // 根据楼盘id查助力
213
-        if ("1".equals(type)){
214
-            QueryWrapper<HelpActivity> helpActivityQuery= new QueryWrapper<>();
215
-            helpActivityQuery.eq("building_id",buildingId);
216
-            helpActivityQuery.eq("org_id",orgId);
217
-            List<HelpActivity> list = taHelpActivityMapper.selectList(helpActivityQuery);
218
-            responseBean.addSuccess(list);
219
-            return responseBean;
220
-        }
221
-        // 根据楼盘id查拼团
222
-        if ("2".equals(type)){
223
-            QueryWrapper<TaShareActivity> taShareActivityQuery= new QueryWrapper<>();
224
-            taShareActivityQuery.eq("building_id",buildingId);
225
-            taShareActivityQuery.eq("org_id",orgId);
226
-            List<TaShareActivity> list = taShareActivityMapper.selectList(taShareActivityQuery);
227
-            responseBean.addSuccess(list);
228
-            return responseBean;
229
-        }
230
-
231
-        List<HelpActivity> HelpActivity = taHelpActivityMapper.selectWxhelpActivityAndGroup(orgId);
212
+        // buildingId 楼盘ID为空时首页只查置顶的活动,楼盘ID不为空查所有拼团和助力
213
+        List<HelpActivity> HelpActivity = taHelpActivityMapper.selectWxhelpActivityAndGroup(orgId,buildingId);
232 214
         responseBean.addSuccess(HelpActivity);
233 215
         return responseBean;
234 216
     }

+ 16
- 4
src/main/resources/mapper/HelpActivityMapper.xml Wyświetl plik

@@ -86,8 +86,14 @@
86 86
 				1 AS type
87 87
 			FROM
88 88
 				ta_help_activity a
89
-				WHERE a.is_main = 1
90
-				and org_id =#{orgId}
89
+				WHERE
90
+                  org_id =#{orgId}
91
+                <if test="buildingId  == null ">
92
+                  and  a.is_main = 1
93
+                </if>
94
+                <if test="buildingId != null and buildingId != ''">
95
+                  and a.building_id = #{buildingId}
96
+                </if>
91 97
 		)
92 98
 		UNION ALL
93 99
 			(
@@ -97,8 +103,14 @@
97 103
 					2 AS type
98 104
 				FROM
99 105
 					ta_share_activity s
100
-					WHERE s.sort = 1
101
-					and org_id =#{orgId}
106
+					WHERE
107
+                        org_id =#{orgId}
108
+                <if test="buildingId  == null ">
109
+                    and  s.sort = 1
110
+                </if>
111
+                <if test="buildingId != null and buildingId != ''">
112
+                    and s.building_id = #{buildingId}
113
+                </if>
102 114
 			)
103 115
     </select>
104 116