瀏覽代碼

Merge branch 'master' of http://git.ycjcjy.com/zhiyuxing/estateagents

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

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

@@ -188,7 +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
-            String name,
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, // 最大面积
192 198
             HttpServletRequest request
193 199
     ){
194 200
         List<String> targets = null;
@@ -202,7 +208,7 @@ public class TaBuildingController extends BaseController {
202 208
             targets = iTaSaveService.getTargesOfPerson(persons.get(0).getPersonId(), CommConstant.FAVOR_PROJECT);
203 209
         }
204 210
 
205
-        return taBuildingService.getWxBuildingList(pageNum, pageSize, name, targets, cityId,mine);
211
+        return taBuildingService.getWxBuildingList(pageNum, pageSize, name, targets, cityId,mine, houseType, buildingTypeId, minPrice, maxPrice, minBuildingArea, maxBuildingArea);
206 212
     }
207 213
 
208 214
     /**

+ 28
- 0
src/main/java/com/huiju/estateagents/controller/TdBuildingTypeController.java 查看文件

@@ -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 实体对象

+ 87
- 87
src/main/java/com/huiju/estateagents/entity/TaBuildingApartment.java 查看文件

@@ -1,87 +1,87 @@
1
-package com.huiju.estateagents.entity;
2
-
3
-import java.time.LocalDateTime;
4
-import java.io.Serializable;
5
-import java.util.List;
6
-
7
-import com.baomidou.mybatisplus.annotation.IdType;
8
-import com.baomidou.mybatisplus.annotation.TableField;
9
-import com.baomidou.mybatisplus.annotation.TableId;
10
-import lombok.Data;
11
-import lombok.EqualsAndHashCode;
12
-import lombok.experimental.Accessors;
13
-
14
-/**
15
- * <p>
16
- * 项目户型表
17
- * </p>
18
- *
19
- * @author jobob
20
- * @since 2019-05-10
21
- */
22
-@Data
23
-@EqualsAndHashCode(callSuper = false)
24
-@Accessors(chain = true)
25
-public class TaBuildingApartment implements Serializable {
26
-
27
-    private static final long serialVersionUID = 1L;
28
-
29
-    /**
30
-     * 户型id
31
-     */
32
-    @TableId(value = "apartment_id", type = IdType.UUID)
33
-    private String apartmentId;
34
-
35
-    /**
36
-     * 楼盘id
37
-     */
38
-    private String buildingId;
39
-
40
-    /**
41
-     * 名称
42
-     */
43
-    private String apartmentName;
44
-
45
-    /**
46
-     * 类型
47
-     */
48
-    private String apartmentType;
49
-
50
-    /**
51
-     * 备注
52
-     */
53
-    private String remark;
54
-
55
-    /**
56
-     * 状态
57
-     */
58
-    private Integer status;
59
-
60
-    /**
61
-     * 创建时间
62
-     */
63
-    private LocalDateTime createDate;
64
-
65
-    /**
66
-     * 销售状态
67
-     */
68
-    private Integer marketStatus;
69
-
70
-    private String insideArea;
71
-
72
-    private String buildingArea;
73
-
74
-    private String apartmentPrice;
75
-
76
-    private String apartmentDescription;
77
-
78
-    private String houseType;
79
-
80
-    /**
81
-     * 户型图片列表
82
-     */
83
-    @TableField(exist = false)
84
-    private List<TaBuildingImg> buildingImgList;
85
-
86
-
87
-}
1
+package com.huiju.estateagents.entity;
2
+
3
+import java.time.LocalDateTime;
4
+import java.io.Serializable;
5
+import java.util.List;
6
+
7
+import com.baomidou.mybatisplus.annotation.IdType;
8
+import com.baomidou.mybatisplus.annotation.TableField;
9
+import com.baomidou.mybatisplus.annotation.TableId;
10
+import lombok.Data;
11
+import lombok.EqualsAndHashCode;
12
+import lombok.experimental.Accessors;
13
+
14
+/**
15
+ * <p>
16
+ * 项目户型表
17
+ * </p>
18
+ *
19
+ * @author jobob
20
+ * @since 2019-05-10
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+public class TaBuildingApartment implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    /**
30
+     * 户型id
31
+     */
32
+    @TableId(value = "apartment_id", type = IdType.UUID)
33
+    private String apartmentId;
34
+
35
+    /**
36
+     * 楼盘id
37
+     */
38
+    private String buildingId;
39
+
40
+    /**
41
+     * 名称
42
+     */
43
+    private String apartmentName;
44
+
45
+    /**
46
+     * 类型
47
+     */
48
+    private String apartmentType;
49
+
50
+    /**
51
+     * 备注
52
+     */
53
+    private String remark;
54
+
55
+    /**
56
+     * 状态
57
+     */
58
+    private Integer status;
59
+
60
+    /**
61
+     * 创建时间
62
+     */
63
+    private LocalDateTime createDate;
64
+
65
+    /**
66
+     * 销售状态
67
+     */
68
+    private Integer marketStatus;
69
+
70
+    private Double insideArea;
71
+
72
+    private Double buildingArea;
73
+
74
+    private String apartmentPrice;
75
+
76
+    private String apartmentDescription;
77
+
78
+    private String houseType;
79
+
80
+    /**
81
+     * 户型图片列表
82
+     */
83
+    @TableField(exist = false)
84
+    private List<TaBuildingImg> buildingImgList;
85
+
86
+
87
+}

+ 16
- 0
src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java 查看文件

@@ -55,4 +55,20 @@ public interface TaBuildingMapper extends BaseMapper<TaBuilding> {
55 55
      * @return
56 56
      */
57 57
     Map<String, Object> selectBuildingStatistical(@Param("saveOrShare") String saveOrShare);
58
+
59
+    /**
60
+     * 查询楼盘
61
+     * @param page
62
+     * @param name
63
+     * @param cityId
64
+     * @param targets
65
+     * @param houseType
66
+     * @param buildingTypeId
67
+     * @return
68
+     */
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);
73
+
58 74
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaBuildingService.java 查看文件

@@ -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);
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
      * 微信小程序 楼盘列表

+ 14
- 11
src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java 查看文件

@@ -374,26 +374,29 @@ 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) {
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
-        QueryWrapper<TaBuilding> buildingQueryWrapper = new QueryWrapper<>();
381
-        buildingQueryWrapper.nested(null != name && !"".equals(name.trim()), i -> i.like("name", name).or().like("building_name", name));
382
-        buildingQueryWrapper.eq("status", 1);
383
-        buildingQueryWrapper.eq(null != cityId && cityId != 0,"city_id", cityId);
384
-        buildingQueryWrapper.in(null != targets && targets.size() > 0, "building_id", targets);
385
-//        buildingQueryWrapper.like(null != name && !"".equals(name.trim()), "name", name);
386
-        buildingQueryWrapper.orderByAsc("order_no");
380
+//        QueryWrapper<TaBuilding> buildingQueryWrapper = new QueryWrapper<>();
381
+//        buildingQueryWrapper.nested(null != name && !"".equals(name.trim()), i -> i.like("name", name).or().like("building_name", name));
382
+//        buildingQueryWrapper.eq("status", 1);
383
+//        buildingQueryWrapper.eq(null != cityId && cityId != 0,"city_id", cityId);
384
+//        buildingQueryWrapper.in(null != targets && targets.size() > 0, "building_id", targets);
385
+////        buildingQueryWrapper.like(null != name && !"".equals(name.trim()), "name", name);
386
+//        buildingQueryWrapper.orderByAsc("order_no");
387
+//        buildingQueryWrapper.eq(null != buildingTypeId,"building_type", buildingTypeId);
388
+//
389
+//        IPage<TaBuilding> result = taBuildingMapper.selectPage(page, buildingQueryWrapper);
387 390
 
388
-        IPage<TaBuilding> result = taBuildingMapper.selectPage(page, buildingQueryWrapper);
391
+        IPage<TaBuilding> result = taBuildingMapper.selectBuildingPage(page, name, cityId, targets, houseType,buildingTypeId, minPrice, maxPrice, minBuildingArea, maxBuildingArea);
389 392
 
390 393
         List<TaBuilding> buildingList = result.getRecords();
391
-        if (null != buildingList && buildingList.size() > 0) {
394
+        if (CollectionUtils.isNotEmpty(buildingList)) {
392 395
             for (TaBuilding build:buildingList) {
393 396
                 getBuildingAttaches(build);
394 397
             }
395 398
         }
396
-        if(null!=targets&&targets.size()<=0 && mine){
399
+        if(CollectionUtils.isEmpty(targets) && mine){
397 400
             return ResponseBean.success(null);
398 401
         }else {
399 402
             return ResponseBean.success(result);

+ 65
- 0
src/main/resources/mapper/TaBuildingMapper.xml 查看文件

@@ -78,4 +78,69 @@
78 78
         from ta_building
79 79
     </select>
80 80
 
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
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
144
+    </select>
145
+
81 146
 </mapper>