胡轶钦 5 年之前
父節點
當前提交
de8c300b1c

+ 216
- 215
src/main/java/com/huiju/estateagents/controller/TaBuildingController.java 查看文件

@@ -1,215 +1,216 @@
1
-package com.huiju.estateagents.controller;
2
-
3
-
4
-import com.huiju.estateagents.base.ResponseBean;
5
-import com.huiju.estateagents.common.CommConstant;
6
-import com.huiju.estateagents.common.JWTUtils;
7
-import com.huiju.estateagents.entity.TaBuilding;
8
-import com.huiju.estateagents.entity.TaPerson;
9
-import com.huiju.estateagents.service.ITaBuildingService;
10
-import com.huiju.estateagents.service.ITaPersonService;
11
-import com.huiju.estateagents.service.ITaSaveService;
12
-import com.huiju.estateagents.service.ITdCityService;
13
-import org.springframework.beans.factory.annotation.Autowired;
14
-import org.springframework.web.bind.annotation.*;
15
-
16
-import com.huiju.estateagents.base.BaseController;
17
-
18
-import javax.servlet.http.HttpServletRequest;
19
-import javax.servlet.http.HttpSession;
20
-import java.util.List;
21
-
22
-/**
23
- * <p>
24
- * 项目表 前端控制器
25
- * </p>
26
- *
27
- * @author jobob
28
- * @since 2019-05-10
29
- */
30
-@RestController
31
-@RequestMapping("/api")
32
-public class TaBuildingController extends BaseController {
33
-
34
-    @Autowired
35
-    ITaBuildingService taBuildingService;
36
-
37
-    @Autowired
38
-    ITaSaveService iTaSaveService;
39
-
40
-    @Autowired
41
-    ITaPersonService iTaPersonService;
42
-
43
-
44
-    /**
45
-     * 楼盘详情
46
-     * @param id
47
-     * @return
48
-     */
49
-    @GetMapping("/admin/buildingSelectId/{id}")
50
-    public ResponseBean buildingSelectId(@PathVariable(value = "id") String id){
51
-        return taBuildingService.buildingSelectId(id);
52
-    }
53
-
54
-    /**
55
-     * 楼盘列表
56
-     * @param pageNum
57
-     * @param pageSize
58
-     * @param name
59
-     * @param code
60
-     * @return
61
-     */
62
-    @GetMapping("/admin/buildinglist")
63
-    public ResponseBean buildingList(@RequestParam("pageNum")Integer pageNum,
64
-                                     @RequestParam("pageSize")Integer pageSize,
65
-                                     @RequestParam(value = "name", required = false)String name,
66
-                                     @RequestParam(value = "code", required = false)String code){
67
-        return taBuildingService.buildingList(pageNum,pageSize,name,code);
68
-    }
69
-
70
-    /**
71
-     * 更新楼盘
72
-     * @param parameter
73
-     * @return
74
-     */
75
-    @PutMapping("/admin/building/update")
76
-    public ResponseBean buildingUpdate(@RequestBody String parameter){
77
-        return taBuildingService.buildingUpdate(parameter);
78
-    }
79
-
80
-    /**
81
-     * 楼盘添加
82
-     * @param parameter
83
-     * @return
84
-     */
85
-    @RequestMapping(value = "/admin/building/add", method = RequestMethod.POST)
86
-    public ResponseBean buildingAdd(@RequestBody String parameter){
87
-        return taBuildingService.buildingAdd(parameter);
88
-    }
89
-
90
-    /**
91
-     * 楼盘发布
92
-     * @param parameter
93
-     * @return
94
-     */
95
-    @RequestMapping(value = "/admin/building/update/status", method = RequestMethod.PUT)
96
-    public ResponseBean buildingUpdateStatus(@RequestBody String parameter){
97
-        return taBuildingService.buildingUpdateStatus(parameter);
98
-    }
99
-
100
-    /**
101
-     * 楼盘删除
102
-     * @param id
103
-     * @param session
104
-     * @return
105
-     */
106
-    @RequestMapping(value = "/admin/building/delete/{id}", method = RequestMethod.DELETE)
107
-    public ResponseBean buildingdelete(@PathVariable("id") String id, HttpSession session){
108
-        return taBuildingService.buildingdelete(id);
109
-    }
110
-
111
-    /**
112
-     * 添加户型
113
-     * @param parameter
114
-     * @param session
115
-     * @return
116
-     */
117
-    @RequestMapping(value = "/admin/buildingApartment/add", method = RequestMethod.POST)
118
-    public ResponseBean buildingApartment(@RequestBody String parameter, HttpSession session){
119
-        return taBuildingService.buildingApartmentAdd(parameter);
120
-    }
121
-
122
-    /**
123
-     * 户型编辑
124
-     * @param parameter
125
-     * @return
126
-     */
127
-    @RequestMapping(value = "/admin/buildingApartment/update", method = RequestMethod.PUT)
128
-    public ResponseBean buildingApartmentUpdate(@RequestBody String parameter){
129
-        return taBuildingService.buildingApartmentUpdate(parameter);
130
-    }
131
-
132
-    /**
133
-     * 楼盘详情
134
-     * @param id
135
-     * @return
136
-     */
137
-    @RequestMapping(value = "/admin/buildingApartment/{id}", method = RequestMethod.GET)
138
-    public ResponseBean buildingApartmentSelectId(@PathVariable(value = "id") String id){
139
-        return taBuildingService.buildingApartmentSelectId(id);
140
-    }
141
-
142
-    /**
143
-     * 依据项目ID 查户型
144
-     * @param id
145
-     * @return
146
-     */
147
-    @RequestMapping(value = "/admin/buildingApartment/buildingId/{id}", method = RequestMethod.GET)
148
-    public ResponseBean buildingApartmentBuildingId(@PathVariable(value = "id") String id){
149
-        return taBuildingService.buildingApartmentBuildingId(id);
150
-    }
151
-
152
-    /**
153
-     * 微信楼盘列表
154
-     * @return
155
-     */
156
-    @RequestMapping(value = "/wx/building/list", method = RequestMethod.GET)
157
-    public ResponseBean getWxBuildingList(
158
-            @RequestParam(defaultValue = "1") Integer pageNum,
159
-            @RequestParam(defaultValue = "10")Integer pageSize,
160
-            @RequestParam(defaultValue = "false") Boolean mine,
161
-            @RequestParam(required = false) Integer cityId,
162
-            String name,
163
-            HttpServletRequest request
164
-    ){
165
-        List<String> targets = null;
166
-        if (null != mine && mine) {
167
-            String openid = JWTUtils.getSubject(request);
168
-            List<TaPerson> persons = iTaPersonService.getPersonsByOpenId(openid);
169
-            if (null == persons || persons.size() == 0) {
170
-                return ResponseBean.error("当前账户信息异常, 清除缓存重试", ResponseBean.ERROR_UNAVAILABLE);
171
-            }
172
-
173
-            targets = iTaSaveService.getTargesOfPerson(persons.get(0).getPersonId(), CommConstant.FAVOR_PROJECT);
174
-        }
175
-
176
-        return taBuildingService.getWxBuildingList(pageNum, pageSize, name, targets, cityId,mine);
177
-    }
178
-
179
-    /**
180
-     * 微信推荐楼盘列表
181
-     * @return
182
-     */
183
-    @RequestMapping(value = "/wx/building/mian", method = RequestMethod.GET)
184
-    public ResponseBean getWxMainBuildingList(){
185
-        return taBuildingService.getWxMainBuildingList();
186
-    }
187
-
188
-    /**
189
-     * 删除户型
190
-     * @param id
191
-     * @return
192
-     */
193
-    @RequestMapping(value = "/admin/apartment/deleted/{id}", method = RequestMethod.DELETE)
194
-    public ResponseBean apartmentDeleted(@PathVariable(value = "id") String id){
195
-        return taBuildingService.apartmentDel(id);
196
-    }
197
-
198
-    /**
199
-     * 微信楼盘详情
200
-     * @param id
201
-     * @return
202
-     */
203
-    @RequestMapping(value = "/wx/buildingSelectId/{id}", method = RequestMethod.GET)
204
-    public ResponseBean wxBuildingSelectId(@PathVariable(value = "id") String id){
205
-        return taBuildingService.buildingAllSelectId(id);
206
-    }
207
-    /**
208
-     * 查询当前所有项目
209
-     */
210
-    @RequestMapping(value = "/admin/buildingAll", method = RequestMethod.GET)
211
-    public  ResponseBean buildingAll(){
212
-        ResponseBean taBuilding= taBuildingService.buildingAll();
213
-        return taBuilding;
214
-    }
215
-}
1
+package com.huiju.estateagents.controller;
2
+
3
+
4
+import com.huiju.estateagents.base.ResponseBean;
5
+import com.huiju.estateagents.common.CommConstant;
6
+import com.huiju.estateagents.common.JWTUtils;
7
+import com.huiju.estateagents.entity.TaBuilding;
8
+import com.huiju.estateagents.entity.TaPerson;
9
+import com.huiju.estateagents.service.ITaBuildingService;
10
+import com.huiju.estateagents.service.ITaPersonService;
11
+import com.huiju.estateagents.service.ITaSaveService;
12
+import com.huiju.estateagents.service.ITdCityService;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.web.bind.annotation.*;
15
+
16
+import com.huiju.estateagents.base.BaseController;
17
+
18
+import javax.servlet.http.HttpServletRequest;
19
+import javax.servlet.http.HttpSession;
20
+import java.util.List;
21
+
22
+/**
23
+ * <p>
24
+ * 项目表 前端控制器
25
+ * </p>
26
+ *
27
+ * @author jobob
28
+ * @since 2019-05-10
29
+ */
30
+@RestController
31
+@RequestMapping("/api")
32
+public class TaBuildingController extends BaseController {
33
+
34
+    @Autowired
35
+    ITaBuildingService taBuildingService;
36
+
37
+    @Autowired
38
+    ITaSaveService iTaSaveService;
39
+
40
+    @Autowired
41
+    ITaPersonService iTaPersonService;
42
+
43
+
44
+    /**
45
+     * 楼盘详情
46
+     * @param id
47
+     * @return
48
+     */
49
+    @GetMapping("/admin/buildingSelectId/{id}")
50
+    public ResponseBean buildingSelectId(@PathVariable(value = "id") String id){
51
+        return taBuildingService.buildingSelectId(id);
52
+    }
53
+
54
+    /**
55
+     * 楼盘列表
56
+     * @param pageNum
57
+     * @param pageSize
58
+     * @param name
59
+     * @param code
60
+     * @return
61
+     */
62
+    @GetMapping("/admin/buildinglist")
63
+    public ResponseBean buildingList(@RequestParam(value = "pageNum", defaultValue = "1")Integer pageNum,
64
+                                     @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
65
+                                     @RequestParam(value = "name", required = false)String name,
66
+                                     @RequestParam(value = "code", required = false)String code){
67
+        return taBuildingService.buildingList(pageNum,pageSize,name,code);
68
+    }
69
+
70
+    /**
71
+     * 更新楼盘
72
+     * @param parameter
73
+     * @return
74
+     */
75
+    @PutMapping("/admin/building/update")
76
+    public ResponseBean buildingUpdate(@RequestBody String parameter){
77
+        return taBuildingService.buildingUpdate(parameter);
78
+    }
79
+
80
+    /**
81
+     * 楼盘添加
82
+     * @param parameter
83
+     * @return
84
+     */
85
+    @RequestMapping(value = "/admin/building/add", method = RequestMethod.POST)
86
+    public ResponseBean buildingAdd(@RequestBody String parameter){
87
+        return taBuildingService.buildingAdd(parameter);
88
+    }
89
+
90
+    /**
91
+     * 楼盘发布
92
+     * @param parameter
93
+     * @return
94
+     */
95
+    @RequestMapping(value = "/admin/building/update/status", method = RequestMethod.PUT)
96
+    public ResponseBean buildingUpdateStatus(@RequestBody String parameter){
97
+        return taBuildingService.buildingUpdateStatus(parameter);
98
+    }
99
+
100
+    /**
101
+     * 楼盘删除
102
+     * @param id
103
+     * @param session
104
+     * @return
105
+     */
106
+    @RequestMapping(value = "/admin/building/delete/{id}", method = RequestMethod.DELETE)
107
+    public ResponseBean buildingdelete(@PathVariable("id") String id, HttpSession session){
108
+        return taBuildingService.buildingdelete(id);
109
+    }
110
+
111
+    /**
112
+     * 添加户型
113
+     * @param parameter
114
+     * @param session
115
+     * @return
116
+     */
117
+    @RequestMapping(value = "/admin/buildingApartment/add", method = RequestMethod.POST)
118
+    public ResponseBean buildingApartment(@RequestBody String parameter, HttpSession session){
119
+        return taBuildingService.buildingApartmentAdd(parameter);
120
+    }
121
+
122
+    /**
123
+     * 户型编辑
124
+     * @param parameter
125
+     * @return
126
+     */
127
+    @RequestMapping(value = "/admin/buildingApartment/update", method = RequestMethod.PUT)
128
+    public ResponseBean buildingApartmentUpdate(@RequestBody String parameter){
129
+        return taBuildingService.buildingApartmentUpdate(parameter);
130
+    }
131
+
132
+    /**
133
+     * 楼盘详情
134
+     * @param id
135
+     * @return
136
+     */
137
+    @RequestMapping(value = "/admin/buildingApartment/{id}", method = RequestMethod.GET)
138
+    public ResponseBean buildingApartmentSelectId(@PathVariable(value = "id") String id){
139
+        return taBuildingService.buildingApartmentSelectId(id);
140
+    }
141
+
142
+    /**
143
+     * 依据项目ID 查户型
144
+     * @param id
145
+     * @return
146
+     */
147
+    @RequestMapping(value = "/admin/buildingApartment/buildingId/{id}", method = RequestMethod.GET)
148
+    public ResponseBean buildingApartmentBuildingId(@PathVariable(value = "id") String id){
149
+        return taBuildingService.buildingApartmentBuildingId(id);
150
+    }
151
+
152
+    /**
153
+     * 微信楼盘列表
154
+     * @return
155
+     */
156
+    @RequestMapping(value = "/wx/building/list", method = RequestMethod.GET)
157
+    public ResponseBean getWxBuildingList(
158
+            @RequestParam(defaultValue = "1") Integer pageNum,
159
+            @RequestParam(defaultValue = "10")Integer pageSize,
160
+            @RequestParam(defaultValue = "false") Boolean mine,
161
+            @RequestParam(required = false) Integer cityId,
162
+            String name,
163
+            HttpServletRequest request
164
+    ){
165
+        List<String> targets = null;
166
+        if (null != mine && mine) {
167
+            String openid = JWTUtils.getSubject(request);
168
+            List<TaPerson> persons = iTaPersonService.getPersonsByOpenId(openid);
169
+            if (null == persons || persons.size() == 0) {
170
+                return ResponseBean.error("当前账户信息异常, 清除缓存重试", ResponseBean.ERROR_UNAVAILABLE);
171
+            }
172
+
173
+            targets = iTaSaveService.getTargesOfPerson(persons.get(0).getPersonId(), CommConstant.FAVOR_PROJECT);
174
+        }
175
+
176
+        return taBuildingService.getWxBuildingList(pageNum, pageSize, name, targets, cityId,mine);
177
+    }
178
+
179
+    /**
180
+     * 微信推荐楼盘列表
181
+     * @return
182
+     */
183
+    @RequestMapping(value = "/wx/building/mian", method = RequestMethod.GET)
184
+    public ResponseBean getWxMainBuildingList(){
185
+        return taBuildingService.getWxMainBuildingList();
186
+    }
187
+
188
+    /**
189
+     * 删除户型
190
+     * @param id
191
+     * @return
192
+     */
193
+    @RequestMapping(value = "/admin/apartment/deleted/{id}", method = RequestMethod.DELETE)
194
+    public ResponseBean apartmentDeleted(@PathVariable(value = "id") String id){
195
+        return taBuildingService.apartmentDel(id);
196
+    }
197
+
198
+    /**
199
+     * 微信楼盘详情
200
+     * @param id
201
+     * @return
202
+     */
203
+    @RequestMapping(value = "/wx/buildingSelectId/{id}", method = RequestMethod.GET)
204
+    public ResponseBean wxBuildingSelectId(@PathVariable(value = "id") String id){
205
+        return taBuildingService.buildingAllSelectId(id);
206
+    }
207
+    /**
208
+     * 查询当前所有项目
209
+     */
210
+    @RequestMapping(value = "/admin/buildingAll", method = RequestMethod.GET)
211
+    public  ResponseBean buildingAll(){
212
+        ResponseBean taBuilding= taBuildingService.buildingAll();
213
+        return taBuilding;
214
+    }
215
+}
216
+

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

@@ -24,7 +24,7 @@
24 24
         <if test="buildingId != null and buildingId !=''">
25 25
             and building_id = #{buildingId}
26 26
         </if>
27
-        <if test="cityId != 0">
27
+        <if test="cityId != 0 and cityId != null">
28 28
             and city_id = #{cityId}
29 29
         </if>
30 30
         ORDER BY create_date DESC