Browse Source

微信楼盘查询改造

魏熙美 5 years ago
parent
commit
da4e6d0f99

+ 8
- 4
src/main/java/com/huiju/estateagents/controller/TaBuildingController.java View File

@@ -188,9 +188,13 @@ public class TaBuildingController extends BaseController {
188 188
             @RequestParam(defaultValue = "10")Integer pageSize,
189 189
             @RequestParam(defaultValue = "false") Boolean mine,
190 190
             @RequestParam(required = false) Integer cityId,
191
-            @RequestParam String name,
192
-            @RequestParam String apartmentId, // 户型Id
193
-            @RequestParam Integer buildingTypeId, // 项目类型Id
191
+            @RequestParam(required = false) String name,
192
+            @RequestParam(required = false) String houseType, // 户型
193
+            @RequestParam(required = false) Integer buildingTypeId, // 项目类型Id
194
+            @RequestParam(required = false) Integer minPrice, // 最低价格
195
+            @RequestParam(required = false) Integer maxPrice, // 最高价格
196
+            @RequestParam(required = false) Double minBuildingArea, // 最小面积
197
+            @RequestParam(required = false) Double maxBuildingArea, // 最大面积
194 198
             HttpServletRequest request
195 199
     ){
196 200
         List<String> targets = null;
@@ -204,7 +208,7 @@ public class TaBuildingController extends BaseController {
204 208
             targets = iTaSaveService.getTargesOfPerson(persons.get(0).getPersonId(), CommConstant.FAVOR_PROJECT);
205 209
         }
206 210
 
207
-        return taBuildingService.getWxBuildingList(pageNum, pageSize, name, targets, cityId,mine, apartmentId, buildingTypeId);
211
+        return taBuildingService.getWxBuildingList(pageNum, pageSize, name, targets, cityId,mine, houseType, buildingTypeId, minPrice, maxPrice, minBuildingArea, maxBuildingArea);
208 212
     }
209 213
 
210 214
     /**

+ 1
- 1
src/main/java/com/huiju/estateagents/controller/TaPointsRecordsController.java View File

@@ -208,7 +208,7 @@ public class TaPointsRecordsController extends BaseController {
208 208
         try {
209 209
             IPage<TaPointsRecords> pg = new Page<>(pageNum, pageSize);
210 210
             QueryWrapper<TaPointsRecords> queryWrapper = new QueryWrapper<>();
211
-            queryWrapper.eq("person_id",recommendCustomerService.getById(id).getPersonId());
211
+            queryWrapper.eq("person_id",id);
212 212
             queryWrapper.orderByDesc("create_date");
213 213
             IPage<TaPointsRecords> result = iTaPointsRecordsService.page(pg, queryWrapper);
214 214
             Integer totalPoints = 0;

+ 28
- 0
src/main/java/com/huiju/estateagents/controller/TdBuildingTypeController.java View File

@@ -50,6 +50,7 @@ public class TdBuildingTypeController extends BaseController {
50 50
             //使用分页插件
51 51
 		    IPage<TdBuildingType> pg = new Page<>(pageNum, pageSize);
52 52
             QueryWrapper<TdBuildingType> queryWrapper = new QueryWrapper<>();
53
+            queryWrapper.eq("status", 1);
53 54
             queryWrapper.orderByDesc("create_date");
54 55
 
55 56
             IPage<TdBuildingType> result = iTdBuildingTypeService.page(pg, queryWrapper);
@@ -61,6 +62,33 @@ public class TdBuildingTypeController extends BaseController {
61 62
         return responseBean;
62 63
     }
63 64
 
65
+    /**
66
+     * 分页查询列表
67
+     * @param pageNum
68
+     * @param pageSize
69
+     * @return
70
+     */
71
+    @RequestMapping(value="/wx/tdBuildingType",method= RequestMethod.GET)
72
+    public ResponseBean tdWxBuildingTypeList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
73
+                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
74
+        ResponseBean responseBean = new ResponseBean();
75
+        try {
76
+            //使用分页插件
77
+            IPage<TdBuildingType> pg = new Page<>(pageNum, pageSize);
78
+            QueryWrapper<TdBuildingType> queryWrapper = new QueryWrapper<>();
79
+            queryWrapper.eq("status", 1);
80
+            queryWrapper.orderByDesc("create_date");
81
+
82
+            IPage<TdBuildingType> result = iTdBuildingTypeService.page(pg, queryWrapper);
83
+            responseBean.addSuccess(result);
84
+        }catch (Exception e){
85
+            logger.error("tdBuildingTypeList -=- {}",e.toString());
86
+            responseBean.addError(e.getMessage());
87
+        }
88
+        return responseBean;
89
+    }
90
+
91
+
64 92
     /**
65 93
      * 保存对象
66 94
      * @param tdBuildingType 实体对象

+ 2
- 0
src/main/java/com/huiju/estateagents/entity/TaBuildingApartment.java View File

@@ -75,6 +75,8 @@ public class TaBuildingApartment implements Serializable {
75 75
 
76 76
     private String apartmentDescription;
77 77
 
78
+    private String houseType;
79
+
78 80
     /**
79 81
      * 户型图片列表
80 82
      */

+ 5
- 2
src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java View File

@@ -62,10 +62,13 @@ public interface TaBuildingMapper extends BaseMapper<TaBuilding> {
62 62
      * @param name
63 63
      * @param cityId
64 64
      * @param targets
65
-     * @param doorModel
65
+     * @param houseType
66 66
      * @param buildingTypeId
67 67
      * @return
68 68
      */
69
-    IPage<TaBuilding> selectBuildingPage(IPage<TaBuilding> page, @Param("name") String name, @Param("cityId") Integer cityId, @Param("targets") List<String> targets, @Param("doorModel") String doorModel, @Param("buildingTypeId") Integer buildingTypeId);
69
+    IPage<TaBuilding> selectBuildingPage(IPage<TaBuilding> page, @Param("name") String name, @Param("cityId") Integer cityId,
70
+                                         @Param("targets") List<String> targets, @Param("houseType") String houseType, @Param("buildingTypeId") Integer buildingTypeId,
71
+                                         @Param("minPrice") Integer minPrice, @Param("maxPrice") Integer maxPrice,
72
+                                         @Param("minBuildingArea") Double minBuildingArea, @Param("maxBuildingArea") Double maxBuildingArea);
70 73
 
71 74
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaBuildingService.java View File

@@ -117,7 +117,7 @@ public interface ITaBuildingService extends IService<TaBuilding> {
117 117
      * @param pageSize
118 118
      * @param name
119 119
      */
120
-    ResponseBean getWxBuildingList(Integer pageNum, Integer pageSize, String name, List<String> targets,Integer cityId,boolean mine, String apartmentId, Integer buildingTypeId);
120
+    ResponseBean getWxBuildingList(Integer pageNum, Integer pageSize, String name, List<String> targets,Integer cityId,boolean mine, String houseType, Integer buildingTypeId, Integer minPrice, Integer maxPrice, Double minBuildingArea, Double maxBuildingArea);
121 121
 
122 122
     /**
123 123
      * 微信小程序 楼盘列表

+ 2
- 2
src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java View File

@@ -374,7 +374,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
374 374
     }
375 375
 
376 376
     @Override
377
-    public ResponseBean getWxBuildingList(Integer pageNum, Integer pageSize, String name, List<String> targets,Integer cityId,boolean mine, String doorModel, Integer buildingTypeId) {
377
+    public ResponseBean getWxBuildingList(Integer pageNum, Integer pageSize, String name, List<String> targets,Integer cityId,boolean mine, String houseType, Integer buildingTypeId, Integer minPrice, Integer maxPrice, Double minBuildingArea, Double maxBuildingArea) {
378 378
         IPage<TaBuilding> page = new Page<>(pageNum, pageSize);
379 379
 
380 380
 //        QueryWrapper<TaBuilding> buildingQueryWrapper = new QueryWrapper<>();
@@ -388,7 +388,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
388 388
 //
389 389
 //        IPage<TaBuilding> result = taBuildingMapper.selectPage(page, buildingQueryWrapper);
390 390
 
391
-        IPage<TaBuilding> result = taBuildingMapper.selectBuildingPage(page, name, cityId, targets, doorModel,buildingTypeId);
391
+        IPage<TaBuilding> result = taBuildingMapper.selectBuildingPage(page, name, cityId, targets, houseType,buildingTypeId, minPrice, maxPrice, minBuildingArea, maxBuildingArea);
392 392
 
393 393
         List<TaBuilding> buildingList = result.getRecords();
394 394
         if (CollectionUtils.isNotEmpty(buildingList)) {

+ 2
- 3
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java View File

@@ -373,13 +373,12 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
373 373
 
374 374
     @Override
375 375
     public IPage<TaRecommendCustomer>getCustomersIRecommended(int pageNumber, int pageSize,String customerId,String building){
376
-        String personId = taRecommendCustomerMapper.getCustomerById(customerId).getPersonId();
377 376
         QueryWrapper<TaRecommendCustomer>queryWrapper = new QueryWrapper<>();
378 377
         // todo
379 378
         // 此处可能不是 person_id 而是 recommend_person
380
-        queryWrapper.eq("recommend_person",personId);
379
+        queryWrapper.eq("recommend_person",customerId);
381 380
 //        queryWrapper.eq("building_id",building);
382
-        queryWrapper.gt("status", CommConstant.MESSAGE_UNREAD);
381
+        queryWrapper.eq("status", CommConstant.VERIFY_AGREE);
383 382
         IPage<TaRecommendCustomer>page = new Page<>(pageNumber,pageSize);
384 383
         return taRecommendCustomerMapper.selectPage(page,queryWrapper);
385 384
     }

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

@@ -78,8 +78,69 @@
78 78
         from ta_building
79 79
     </select>
80 80
 
81
-    <select id="selectBuildingPage">
81
+    <select id="selectBuildingPage" resultType="com.huiju.estateagents.entity.TaBuilding">
82
+      SELECT
83
+            tb.*
84
+        FROM
85
+            (
86
+             select * from  ta_building
87
+                WHERE
88
+                `status` = 1
89
+                <if test="cityId != null">
90
+                    AND city_id = #{cityId}
91
+                </if>
92
+                <if test="buildingTypeId != null">
93
+                    AND building_type = #{buildingTypeId}
94
+                </if>
95
+                <if test="targets != null">
96
+                    AND building_id IN (#{targets})
97
+                </if>
98
+                <if test="name != null and name !=''">
99
+                    AND `name` LIKE CONCAT('%',#{name},'%')
100
+                    OR `building_name` LIKE CONCAT('%',#{name},'%')
101
+                </if>
102
+            ) as tb
82 103
 
104
+            <if test="minPrice != null or maxPrice != null or buildingTypeId != null">
105
+                INNER JOIN
106
+                (
107
+                SELECT * FROM ta_building_project_type
108
+                <trim prefix="where" prefixOverrides="and | or">
109
+                    <if test="minPrice != null and maxPrice != null">
110
+                        and price BETWEEN #{minPrice} AND #{maxPrice}
111
+                    </if>
112
+                    <if test="minPrice != null and maxPrice == null">
113
+                        <![CDATA[  and price >= #{minPrice}  ]]>
114
+                    </if>
115
+                    <if test="minPrice == null and maxPrice != null">
116
+                        <![CDATA[  and price <= #{maxPrice}  ]]>
117
+                    </if>
118
+                    <if test="buildingTypeId != null">
119
+                        AND building_type_id = #{buildingTypeId}
120
+                    </if>
121
+                </trim>
122
+                GROUP BY building_id
123
+                )
124
+                AS tbpt ON tb.building_id = tbpt.building_id
125
+            </if>
126
+
127
+            <if test="minBuildingArea != null or maxBuildingArea != null or (houseType != null and houseType != '')">
128
+                INNER JOIN
129
+                (
130
+                SELECT * FROM ta_building_apartment
131
+                <trim prefix="where" prefixOverrides="and | or">
132
+                    <if test="minBuildingArea != null and maxBuildingArea != null">
133
+                        and building_area BETWEEN #{minBuildingArea} AND #{maxBuildingArea}
134
+                    </if>
135
+                    <if test="houseType != null and houseType != ''">
136
+                        AND house_type = #{houseType}
137
+                    </if>
138
+                </trim>
139
+                GROUP BY building_id
140
+                ) as tba ON tb.building_id = tba.building_id
141
+            </if>
142
+
143
+            ORDER BY tb.order_no DESC
83 144
     </select>
84 145
 
85 146
 </mapper>