Your Name 3 anos atrás
pai
commit
c811a74aa2
24 arquivos alterados com 347 adições e 98 exclusões
  1. 1
    1
      pom.xml
  2. 9
    0
      src/main/java/com/yunzhi/marketing/Application.java
  3. 6
    0
      src/main/java/com/yunzhi/marketing/center/taUser/entity/TaUserVO.java
  4. 7
    1
      src/main/java/com/yunzhi/marketing/controller/TaChannelController.java
  5. 5
    0
      src/main/java/com/yunzhi/marketing/controller/TaLiveActivityController.java
  6. 1
    1
      src/main/java/com/yunzhi/marketing/mapper/TaChannelMapper.java
  7. 4
    7
      src/main/java/com/yunzhi/marketing/service/impl/TaBuildingDynamicServiceImpl.java
  8. 6
    6
      src/main/java/com/yunzhi/marketing/service/impl/TaBuildingServiceImpl.java
  9. 3
    0
      src/main/java/com/yunzhi/marketing/service/impl/TaFavorServiceImpl.java
  10. 16
    16
      src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java
  11. 2
    2
      src/main/java/com/yunzhi/marketing/xlk/controller/CustomerInfoController.java
  12. 17
    18
      src/main/java/com/yunzhi/marketing/xlk/controller/SearchHouseController.java
  13. 17
    0
      src/main/java/com/yunzhi/marketing/xlk/dto/SearchHouseDTO.java
  14. 11
    0
      src/main/java/com/yunzhi/marketing/xlk/mapper/SearchHouseMapper.java
  15. 11
    0
      src/main/java/com/yunzhi/marketing/xlk/service/ISearchHouseService.java
  16. 20
    3
      src/main/java/com/yunzhi/marketing/xlk/service/impl/ChannelCustomerServiceImpl.java
  17. 110
    0
      src/main/java/com/yunzhi/marketing/xlk/service/impl/SearchHouseServiceImpl.java
  18. 56
    22
      src/main/resources/mapper/TaBuildingMapper.xml
  19. 2
    2
      src/main/resources/mapper/TaChannelMapper.xml
  20. 1
    1
      src/main/resources/mapper/TaRaiseRecordMapper.xml
  21. 1
    1
      src/main/resources/mapper/TaRecommendCustomerMapper.xml
  22. 17
    17
      src/main/resources/mapper/TaShareCountMapper.xml
  23. 1
    0
      src/main/resources/mapper/TaUserMapper.xml
  24. 23
    0
      src/main/resources/mapper/xlk/SearchHouseMapper.xml

+ 1
- 1
pom.xml Ver arquivo

@@ -10,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.yunzhi</groupId>
12 12
 	<artifactId>marketing</artifactId>
13
-	<version>v1.0.16</version>
13
+	<version>v1.0.19</version>
14 14
 	<name>marketing-cloud</name>
15 15
 	<description>新联康营销云</description>
16 16
 

+ 9
- 0
src/main/java/com/yunzhi/marketing/Application.java Ver arquivo

@@ -5,9 +5,18 @@ import org.springframework.boot.SpringApplication;
5 5
 import org.springframework.boot.autoconfigure.SpringBootApplication;
6 6
 import org.springframework.context.ConfigurableApplicationContext;
7 7
 
8
+import javax.annotation.PostConstruct;
9
+import java.util.TimeZone;
10
+
8 11
 @SpringBootApplication
9 12
 public class Application {
10 13
 
14
+	@PostConstruct
15
+	void started() {
16
+		TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
17
+
18
+	}
19
+
11 20
 	public static void main(String[] args) {
12 21
 		SpringApplication springApplication = new SpringApplication(Application.class);
13 22
 		ConfigurableApplicationContext configurableApplicationContext = springApplication.run(args);

+ 6
- 0
src/main/java/com/yunzhi/marketing/center/taUser/entity/TaUserVO.java Ver arquivo

@@ -289,4 +289,10 @@ public class TaUserVO implements Serializable {
289 289
      */
290 290
     @TableField(exist = false)
291 291
     private String bossDisplay;
292
+
293
+    /**
294
+     * ta_user 的 userId
295
+     */
296
+    @TableField(exist = false)
297
+    private Integer realUserId;
292 298
 }

+ 7
- 1
src/main/java/com/yunzhi/marketing/controller/TaChannelController.java Ver arquivo

@@ -97,9 +97,15 @@ public class TaChannelController extends BaseController {
97 97
         Integer orgId = getOrgId(request);
98 98
 
99 99
         try {
100
+            String institutionCode = null;
101
+            if (!StringUtils.isEmpty(institutionId)){
102
+                Institution institution = iInstitutionService.getById(institutionId);
103
+                institutionCode = institution.getInstitutionCode();
104
+            }
105
+
100 106
             //使用分页插件
101 107
 		    IPage<TaChannel> pg = new Page<>(pageNum, pageSize);
102
-            IPage<TaChannel> result = taChannelMapper.pageTaChannel(pg,orgId,channelId,getInstitutionIds(request),institutionId);
108
+            IPage<TaChannel> result = taChannelMapper.pageTaChannel(pg,orgId,channelId,getInstitutionIds(request),institutionCode);
103 109
             List<TaChannel> recommendCount = taChannelMapper.recommendCount(orgId, channelId, getInstitutionIds(request));
104 110
 
105 111
             result.getRecords().stream().forEach(e -> {

+ 5
- 0
src/main/java/com/yunzhi/marketing/controller/TaLiveActivityController.java Ver arquivo

@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
24 24
 import org.springframework.web.bind.annotation.*;
25 25
 
26 26
 import javax.servlet.http.HttpServletRequest;
27
+import java.time.LocalDateTime;
27 28
 import java.util.ArrayList;
28 29
 import java.util.List;
29 30
 
@@ -180,6 +181,8 @@ public class TaLiveActivityController extends BaseController {
180 181
                 taLiveActivity.setLiveAppPath(taLiveActivity.getLiveRoomParam().replace(".html", ""));
181 182
             }
182 183
 
184
+            taLiveActivity.setUpdateDate(LocalDateTime.now());
185
+            taLiveActivity.setUpdateUser(getUserId(request).toString());
183 186
             if (iTaLiveActivityService.updateById(taLiveActivity)) {
184 187
                 responseBean.addSuccess(taLiveActivity);
185 188
             } else {
@@ -209,6 +212,8 @@ public class TaLiveActivityController extends BaseController {
209 212
             }else if (CommConstant.IS_PUBLISH.equals(taLiveActivity.getStatus())) {
210 213
                 taLiveActivity.setStatus(CommConstant.NOT_PUBLISH);
211 214
             }
215
+            taLiveActivity.setUpdateDate(LocalDateTime.now());
216
+            taLiveActivity.setUpdateUser(getUserId(request).toString());
212 217
             iTaLiveActivityService.updateById(taLiveActivity);
213 218
             responseBean.addSuccess(taLiveActivity);
214 219
         } catch (Exception e) {

+ 1
- 1
src/main/java/com/yunzhi/marketing/mapper/TaChannelMapper.java Ver arquivo

@@ -44,7 +44,7 @@ public interface TaChannelMapper extends BaseMapper<TaChannel> {
44 44
      * @param pg
45 45
      * @return
46 46
      */
47
-    IPage<TaChannel> pageTaChannel(IPage<TaChannel> pg,@Param("orgId")Integer orgId,@Param("channelId")Integer channelId,@Param("institutionIds") List<String> institutionIds,@Param("institutionId") String institutionId);
47
+    IPage<TaChannel> pageTaChannel(IPage<TaChannel> pg,@Param("orgId")Integer orgId,@Param("channelId")Integer channelId,@Param("institutionIds") List<String> institutionIds,@Param("institutionCode") String institutionCode);
48 48
 
49 49
     List<TaChannel> recommendCount(@Param("orgId")Integer orgId,@Param("channelId")Integer channelId,@Param("institutionIds") List<String> institutionIds);
50 50
 

+ 4
- 7
src/main/java/com/yunzhi/marketing/service/impl/TaBuildingDynamicServiceImpl.java Ver arquivo

@@ -146,21 +146,18 @@ public class TaBuildingDynamicServiceImpl extends ServiceImpl<TaBuildingDynamicM
146 146
         QueryWrapper<TaBuildingDynamic> buildingDynamicQueryWrapper = new QueryWrapper<>();
147 147
         buildingDynamicQueryWrapper.eq("dynamic_id", dynamicId);
148 148
         buildingDynamicQueryWrapper.eq("status",1);
149
-        TaBuildingDynamic tabuildingDynamic = buildingDynamicMapper.selectOne(buildingDynamicQueryWrapper);
150
-        if (null == tabuildingDynamic){
149
+        TaBuildingDynamic buildingDynamic = buildingDynamicMapper.selectOne(buildingDynamicQueryWrapper);
150
+        if (null == buildingDynamic){
151 151
             return ResponseBean.error("当前活动已失效", ResponseBean.ERROR_UNAVAILABLE);
152 152
         }
153 153
         // 当前阅读量加1
154
-        Integer saveNum = tabuildingDynamic.getPvNum() == null ? 1:tabuildingDynamic.getPvNum()+1;
155
-        tabuildingDynamic.setPvNum(saveNum);
156
-        buildingDynamicMapper.updateById(tabuildingDynamic);
157
-        TaBuildingDynamic buildingDynamic = buildingDynamicMapper.selectOne(buildingDynamicQueryWrapper);
154
+        buildingDynamicMapper.setFieldNum(dynamicId, "pv_num", 1);
155
+
158 156
         TaPerson taPerson = taPersonMapper.selectByIdPerson(openid);
159 157
         if (null == taPerson){
160 158
             return ResponseBean.error("验证当前人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
161 159
         }
162 160
 
163
-
164 161
         setExtendInfo(buildingDynamic, taPerson);
165 162
 
166 163
         // 活动已报名人数

+ 6
- 6
src/main/java/com/yunzhi/marketing/service/impl/TaBuildingServiceImpl.java Ver arquivo

@@ -440,7 +440,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
440 440
 
441 441
         boolean isMainMoreThanTenFlag = publishCountIsMainBuilding(building, orgId, null, "update");
442 442
         if (!isMainMoreThanTenFlag) {
443
-            responseBean.addError("当前城市最多只能推荐10个项目至首页哦。");
443
+            responseBean.addError("当前城市最多只能推荐20个项目至首页哦。");
444 444
             return responseBean;
445 445
         }
446 446
 
@@ -604,7 +604,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
604 604
 
605 605
         boolean isMainMoreThanTenFlag = publishCountIsMainBuilding(building, orgId, null, "add");
606 606
         if (!isMainMoreThanTenFlag) {
607
-            responseBean.addError("当前城市最多只能推荐10个项目至首页哦。");
607
+            responseBean.addError("当前城市最多只能推荐20个项目至首页哦。");
608 608
             return responseBean;
609 609
         }
610 610
 
@@ -715,7 +715,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
715 715
 
716 716
         boolean isMainMoreThanTenFlag = publishCountIsMainBuilding(building, orgId, status, "updateStatus");
717 717
         if (!isMainMoreThanTenFlag) {
718
-            responseBean.addError("当前城市最多只能推荐10个项目至首页哦");
718
+            responseBean.addError("当前城市最多只能推荐20个项目至首页哦");
719 719
             return responseBean;
720 720
         }
721 721
         building.setStatus(status);
@@ -884,10 +884,10 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
884 884
         }
885 885
         switch (orderBy) {
886 886
             case "price-asc":
887
-                orderBy = "tb.price ASC";
887
+                orderBy = "IFNULL(tbpt.price_type,\"z\") , ifnull(CONVERT(tbpt.start_price, UNSIGNED INTEGER), 9999999999999)";
888 888
                 break;
889 889
             case "price-desc":
890
-                orderBy = "tb.price DESC";
890
+                orderBy = "tbpt.price_type desc, CONVERT(tbpt.end_price, UNSIGNED INTEGER) DESC";
891 891
                 break;
892 892
             case "openingDate-asc":
893 893
                 orderBy = "tb.opening_date ASC";
@@ -1212,7 +1212,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
1212 1212
             taBuildingQueryWrapper.ne("building_id", taBuilding.getBuildingId());
1213 1213
         }
1214 1214
         List<TaBuilding> taBuildings = taBuildingMapper.selectList(taBuildingQueryWrapper);
1215
-        if (taBuildings != null && taBuildings.size() >= 10) {
1215
+        if (taBuildings != null && taBuildings.size() >= 20) {
1216 1216
             return false;
1217 1217
         }
1218 1218
         return true;

+ 3
- 0
src/main/java/com/yunzhi/marketing/service/impl/TaFavorServiceImpl.java Ver arquivo

@@ -130,6 +130,9 @@ public class TaFavorServiceImpl extends ServiceImpl<TaFavorMapper, TaFavor> impl
130 130
         if (typeOf.equals("card")) {
131 131
             taPersonMapper.setFieldIncrement(taPerson.getPersonId(),"like_num", -1);
132 132
         }
133
+        if (typeOf.equals(CommConstant.FAVOR_CONSULTANT)) {
134
+            taPersonMapper.setFieldIncrement(like,"like_num", -1);
135
+        }
133 136
 
134 137
         // 如果是收藏资讯, 则 - 1
135 138
         if (typeOf.equals(CommConstant.FAVOR_NEWS)) {

+ 16
- 16
src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java Ver arquivo

@@ -774,22 +774,6 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
774 774
             lambdaQueryWrapper.eq(CustomerVisit::getCustomerId,taRecommendCustomer.getCustomerId());
775 775
             CustomerVisit customerVisit = customerVisitMapper.selectOne(lambdaQueryWrapper);
776 776
             taRecommendCustomerVO.setCustomerVisit(customerVisit);
777
-        }else if (CommConstant.CUSTOMER_PREPARATORY.equals(taRecommendCustomer.getStatus())) {
778
-            // 认筹状态
779
-            LambdaQueryWrapper<CustomerPreparatory> lambdaQueryWrapper = new LambdaQueryWrapper<>();
780
-            lambdaQueryWrapper.eq(CustomerPreparatory::getCustomerId,taRecommendCustomer.getCustomerId());
781
-            CustomerPreparatory customerPreparatory = customerPreparatoryMapper.selectOne(lambdaQueryWrapper);
782
-            taRecommendCustomerVO.setCustomerPreparatory(customerPreparatory);
783
-        }else if (CommConstant.CUSTOMER_SIGNED.equals(taRecommendCustomer.getStatus())) {
784
-            // 签约状态
785
-            LambdaQueryWrapper<CustomerSignatory> lambdaQueryWrapper = new LambdaQueryWrapper<>();
786
-            lambdaQueryWrapper.eq(CustomerSignatory::getCustomerId,taRecommendCustomer.getCustomerId());
787
-            List<CustomerSignatory> customerSignatories = customerSignatoryMapper.selectList(lambdaQueryWrapper);
788
-            customerSignatories.forEach(e -> {
789
-                TaBuildingApartment taBuildingApartment = taBuildingApartmentMapper.selectById(e.getHouseType());
790
-                e.setBuildingApartment(taBuildingApartment);
791
-            });
792
-            taRecommendCustomerVO.setCustomerSignatory(customerSignatories);
793 777
         }
794 778
 
795 779
         LambdaQueryWrapper<ChannelCustomer> channelCustomerLambdaQueryWrapper = new LambdaQueryWrapper<>();
@@ -798,6 +782,22 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
798 782
         if (null != customer) {
799 783
             taRecommendCustomerVO.setChannelCustomer(customer);
800 784
         }
785
+        // 认筹状态
786
+        LambdaQueryWrapper<CustomerPreparatory> lambdaQueryWrapper = new LambdaQueryWrapper<>();
787
+        lambdaQueryWrapper.eq(CustomerPreparatory::getCustomerId,taRecommendCustomer.getCustomerId());
788
+        CustomerPreparatory customerPreparatory = customerPreparatoryMapper.selectOne(lambdaQueryWrapper);
789
+        taRecommendCustomerVO.setCustomerPreparatory(customerPreparatory);
790
+
791
+        // 签约状态
792
+        LambdaQueryWrapper<CustomerSignatory> qylambdaQueryWrapper = new LambdaQueryWrapper<>();
793
+        qylambdaQueryWrapper.eq(CustomerSignatory::getCustomerId,taRecommendCustomer.getCustomerId());
794
+        List<CustomerSignatory> customerSignatories = customerSignatoryMapper.selectList(qylambdaQueryWrapper);
795
+        customerSignatories.forEach(e -> {
796
+            TaBuildingApartment taBuildingApartment = taBuildingApartmentMapper.selectById(e.getHouseType());
797
+            e.setBuildingApartment(taBuildingApartment);
798
+        });
799
+        taRecommendCustomerVO.setCustomerSignatory(customerSignatories);
800
+
801 801
         return ResponseBean.success(taRecommendCustomerVO);
802 802
     }
803 803
 

+ 2
- 2
src/main/java/com/yunzhi/marketing/xlk/controller/CustomerInfoController.java Ver arquivo

@@ -236,7 +236,7 @@ public class CustomerInfoController extends BaseController {
236 236
                 customerInfo = new CustomerInfo();
237 237
             }
238 238
             customerInfo.setName(customer.getName());
239
-            customerInfo.setSex(customer.getSex());
239
+//            customerInfo.setSex(customer.getSex());
240 240
             customerInfo.setPhone(customer.getPhone());
241 241
             customerInfo.setPicture(customer.getPicture());
242 242
 
@@ -274,7 +274,7 @@ public class CustomerInfoController extends BaseController {
274 274
                 customerInfoVO.setRealtyConsultantPerson(realtyPerson);
275 275
                 // 所属楼盘和 用户信息
276 276
                 LambdaQueryWrapper<TaPersonBuilding> taPersonBuildingLambdaQueryWrapper = new LambdaQueryWrapper<>();
277
-                taPersonBuildingLambdaQueryWrapper.eq(TaPersonBuilding::getPersonId,customer.getRealtyConsultant());
277
+                taPersonBuildingLambdaQueryWrapper.eq(TaPersonBuilding::getPersonId,customer.getRealtyConsultant()).or().eq(TaPersonBuilding::getUserId,realtyPerson.getUserId());
278 278
                 List<TaPersonBuilding> list = taPersonBuildingService.list(taPersonBuildingLambdaQueryWrapper);
279 279
                 if (list.size() > 0) {
280 280
                     TaUser taUser = taUserService.getById(list.get(0).getUserId());

+ 17
- 18
src/main/java/com/yunzhi/marketing/xlk/controller/SearchHouseController.java Ver arquivo

@@ -106,7 +106,9 @@ public class SearchHouseController extends BaseController {
106 106
      */
107 107
     @ApiOperation(value = "wx-保存帮我找房需求", notes = "wx-保存帮我找房需求")
108 108
     @RequestMapping(value="/wx/searchHouse",method= RequestMethod.POST)
109
-    public ResponseBean searchHouseAdd(@RequestBody SearchHouseDTO searchHouseDTO, @RequestHeader("authorization") String token, HttpServletRequest request){
109
+    public ResponseBean searchHouseAdd(@RequestBody SearchHouseDTO searchHouseDTO,
110
+                                       @RequestHeader("authorization") String token,
111
+                                       HttpServletRequest request){
110 112
         ResponseBean responseBean = new ResponseBean();
111 113
         String openid = getOpenId(request);
112 114
         Integer orgId = getOrgId(request);
@@ -114,6 +116,11 @@ public class SearchHouseController extends BaseController {
114 116
         if (null == persons || persons.size() == 0) {
115 117
             return ResponseBean.error("当前账户信息异常, 清除缓存重试", ResponseBean.ERROR_UNAVAILABLE);
116 118
         }
119
+
120
+        if (StringUtils.isEmpty(searchHouseDTO.getMinPrice())) {
121
+            return ResponseBean.error("请选择预算价格", ResponseBean.ERROR_UNAVAILABLE);
122
+        }
123
+
117 124
         TaPerson person = persons.get(0);
118 125
         try {
119 126
             SearchHouse searchHouse = new SearchHouse();
@@ -123,24 +130,16 @@ public class SearchHouseController extends BaseController {
123 130
             searchHouse.setStatus("0");
124 131
             searchHouse.setCreatedTime(LocalDateTime.now());
125 132
             if (iSearchHouseService.save(searchHouse)){
126
-                SearchHouseVO searchHouseVO = new SearchHouseVO();
127
-                BeanUtils.copyProperties(searchHouse,searchHouseVO);
128
-                // 获取价格相近的楼盘
129
-                LambdaQueryWrapper<TaBuilding> lambdaQueryWrapper = new LambdaQueryWrapper<>();
130
-                lambdaQueryWrapper.eq(!StringUtils.isEmpty(searchHouseDTO.getIntentArea()),TaBuilding::getBuildingArea,searchHouseDTO.getIntentArea());
131
-                lambdaQueryWrapper.between(TaBuilding::getPrice,searchHouseDTO.getMinPrice(),searchHouseDTO.getMaxPrice());
132
-                lambdaQueryWrapper.ne(TaBuilding::getStatus,-1);
133
-                lambdaQueryWrapper.last(" limit 2");
134
-                List<TaBuilding> list = taBuildingService.list(lambdaQueryWrapper);
135
-                if (list.size() < 1){
136
-                    lambdaQueryWrapper = new LambdaQueryWrapper<>();
137
-                    lambdaQueryWrapper.eq(!StringUtils.isEmpty(searchHouseDTO.getIntentArea()),TaBuilding::getBuildingArea,searchHouseDTO.getIntentArea());
138
-                    lambdaQueryWrapper.ne(TaBuilding::getStatus,-1);
139
-                    lambdaQueryWrapper.last(" limit 2");
140
-                    list = taBuildingService.list(lambdaQueryWrapper);
133
+                if (null != searchHouseDTO.getNeedRecommend() && searchHouseDTO.getNeedRecommend()) {
134
+                    List<TaBuilding> buildingList = iSearchHouseService.getRecommendBuildings(getOrgId(request), searchHouseDTO);
135
+
136
+                    SearchHouseVO searchHouseVO = new SearchHouseVO();
137
+                    BeanUtils.copyProperties(searchHouse,searchHouseVO);
138
+                    searchHouseVO.setTaBuildingList(buildingList);
139
+                    responseBean.addSuccess(searchHouseVO);
140
+                } else {
141
+                    responseBean.addSuccess(null);
141 142
                 }
142
-                searchHouseVO.setTaBuildingList(list);
143
-                responseBean.addSuccess(searchHouseVO);
144 143
             }else {
145 144
                 responseBean.addError("fail");
146 145
             }

+ 17
- 0
src/main/java/com/yunzhi/marketing/xlk/dto/SearchHouseDTO.java Ver arquivo

@@ -66,4 +66,21 @@ public class SearchHouseDTO implements Serializable {
66 66
      */
67 67
     private String questionnaire;
68 68
 
69
+    /**
70
+     * 是否需要智能推荐
71
+     */
72
+    @TableField(exist = false)
73
+    private Boolean needRecommend;
74
+
75
+    /**
76
+     * 当前人员所在城市
77
+     */
78
+    @TableField(exist = false)
79
+    private Integer cityId;
80
+
81
+    /**
82
+     * 当前人员所选的面积
83
+     */
84
+    @TableField(exist = false)
85
+    private Integer areaResultId;
69 86
 }

+ 11
- 0
src/main/java/com/yunzhi/marketing/xlk/mapper/SearchHouseMapper.java Ver arquivo

@@ -2,11 +2,14 @@ package com.yunzhi.marketing.xlk.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.yunzhi.marketing.entity.TaBuilding;
5 6
 import com.yunzhi.marketing.xlk.entity.SearchHouse;
6 7
 import com.yunzhi.marketing.xlk.vo.SearchHouseVO;
7 8
 import org.apache.ibatis.annotations.Mapper;
8 9
 import org.apache.ibatis.annotations.Param;
9 10
 
11
+import java.util.List;
12
+
10 13
 /**
11 14
  * <p>
12 15
  * 帮我找房  Mapper 接口
@@ -21,4 +24,12 @@ public interface SearchHouseMapper extends BaseMapper<SearchHouse> {
21 24
     IPage<SearchHouseVO> selectSearchHouseList(IPage<SearchHouseVO> pg,@Param("params") SearchHouseVO searchHouse);
22 25
 
23 26
     SearchHouseVO selectSearchHouseDetail(String id);
27
+
28
+    List<TaBuilding> getRecommendBuildings(@Param("orgId") Integer orgId,
29
+                                           @Param("cityId") Integer cityId,
30
+                                           @Param("areaId") Integer areaId,
31
+                                           @Param("minPriceW") Integer minPriceW,
32
+                                           @Param("maxPriceW") Integer maxPriceW,
33
+                                           @Param("minPrice") Integer minPrice,
34
+                                           @Param("maxPrice") Integer maxPrice);
24 35
 }

+ 11
- 0
src/main/java/com/yunzhi/marketing/xlk/service/ISearchHouseService.java Ver arquivo

@@ -3,9 +3,13 @@ package com.yunzhi.marketing.xlk.service;
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.baomidou.mybatisplus.extension.service.IService;
5 5
 import com.yunzhi.marketing.base.ResponseBean;
6
+import com.yunzhi.marketing.entity.TaBuilding;
7
+import com.yunzhi.marketing.xlk.dto.SearchHouseDTO;
6 8
 import com.yunzhi.marketing.xlk.entity.SearchHouse;
7 9
 import com.yunzhi.marketing.xlk.vo.SearchHouseVO;
8 10
 
11
+import java.util.List;
12
+
9 13
 /**
10 14
  * <p>
11 15
  * 帮我找房  服务类
@@ -26,4 +30,11 @@ public interface ISearchHouseService extends IService<SearchHouse> {
26 30
     ResponseBean selectSearchHouseList(IPage<SearchHouseVO> pg, SearchHouseVO searchHouse);
27 31
 
28 32
     SearchHouseVO selectSearchHouseDetail(String id);
33
+
34
+    /**
35
+     * 推荐楼盘
36
+     * @param searchHouseDTO
37
+     * @return
38
+     */
39
+    List<TaBuilding> getRecommendBuildings(Integer orgId, SearchHouseDTO searchHouseDTO);
29 40
 }

+ 20
- 3
src/main/java/com/yunzhi/marketing/xlk/service/impl/ChannelCustomerServiceImpl.java Ver arquivo

@@ -367,7 +367,12 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
367 367
         }
368 368
         customerPreparatory.setOrgId(taRecommendCustomer.getOrgId());
369 369
         customerPreparatory.setCustomerId(taRecommendCustomer.getCustomerId());
370
-        customerPreparatoryMapper.insert(customerPreparatory);
370
+        if (StringUtils.isEmpty(customerPreparatory.getCustomerPreparatoryId())) {
371
+            customerPreparatoryMapper.insert(customerPreparatory);
372
+        }else {
373
+            customerPreparatoryMapper.updateById(customerPreparatory);
374
+        }
375
+
371 376
         return ResponseBean.success("审核成功");
372 377
     }
373 378
 
@@ -406,7 +411,13 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
406 411
         customerSignatory.setOrgId(taRecommendCustomer.getOrgId());
407 412
         customerSignatory.setCreateDate(LocalDateTime.now());
408 413
         customerSignatory.setType("commission");
409
-        customerSignatoryMapper.insert(customerSignatory);
414
+        customerSignatory.setCustomerId(params.getCustomerId());
415
+        if (StringUtils.isEmpty(customerSignatory.getCustomerSignatoryId())){
416
+            customerSignatoryMapper.insert(customerSignatory);
417
+        }else {
418
+            customerSignatoryMapper.updateById(customerSignatory);
419
+        }
420
+
410 421
         return ResponseBean.success("审核成功");
411 422
     }
412 423
 
@@ -447,7 +458,13 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
447 458
         }
448 459
         customerSignatory.setOrgId(taRecommendCustomer.getOrgId());
449 460
         customerSignatory.setType("signatory");
450
-        customerSignatoryMapper.insert(customerSignatory);
461
+        customerSignatory.setCustomerId(params.getCustomerId());
462
+        if (StringUtils.isEmpty(customerSignatory.getCustomerSignatoryId())) {
463
+            customerSignatoryMapper.insert(customerSignatory);
464
+        }else {
465
+            customerSignatoryMapper.updateById(customerSignatory);
466
+        }
467
+
451 468
         return ResponseBean.success("审核成功");
452 469
     }
453 470
 

+ 110
- 0
src/main/java/com/yunzhi/marketing/xlk/service/impl/SearchHouseServiceImpl.java Ver arquivo

@@ -3,14 +3,22 @@ package com.yunzhi.marketing.xlk.service.impl;
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 5
 import com.yunzhi.marketing.base.ResponseBean;
6
+import com.yunzhi.marketing.common.StringUtils;
7
+import com.yunzhi.marketing.entity.TaBuilding;
6 8
 import com.yunzhi.marketing.entity.TaCheckin;
9
+import com.yunzhi.marketing.entity.TdCity;
10
+import com.yunzhi.marketing.mapper.TdCityMapper;
11
+import com.yunzhi.marketing.xlk.dto.SearchHouseDTO;
7 12
 import com.yunzhi.marketing.xlk.entity.SearchHouse;
8 13
 import com.yunzhi.marketing.xlk.mapper.SearchHouseMapper;
9 14
 import com.yunzhi.marketing.xlk.service.ISearchHouseService;
10 15
 import com.yunzhi.marketing.xlk.vo.SearchHouseVO;
16
+import io.swagger.models.auth.In;
11 17
 import org.springframework.beans.factory.annotation.Autowired;
12 18
 import org.springframework.stereotype.Service;
13 19
 
20
+import java.util.List;
21
+
14 22
 /**
15 23
  * <p>
16 24
  * 帮我找房  服务实现类
@@ -25,6 +33,9 @@ public class SearchHouseServiceImpl extends ServiceImpl<SearchHouseMapper, Searc
25 33
     @Autowired
26 34
     private SearchHouseMapper searchHouseMapper;
27 35
 
36
+    @Autowired
37
+    private TdCityMapper tdCityMapper;
38
+
28 39
     /**
29 40
      * 查询我的找房需求列表
30 41
      *
@@ -43,4 +54,103 @@ public class SearchHouseServiceImpl extends ServiceImpl<SearchHouseMapper, Searc
43 54
     public SearchHouseVO selectSearchHouseDetail(String id) {
44 55
         return searchHouseMapper.selectSearchHouseDetail(id);
45 56
     }
57
+
58
+    /**
59
+     * 推荐逻辑如下
60
+     * 1、先判断区域+价格,如果有符合楼盘,则推荐,如无看2;
61
+     * 2、判断城市+价格,如过有符合楼盘,则推荐,如无看3;
62
+     * 3、如选择了“不限城市”,则判断价格,在当前城市内推荐一个符合的。
63
+     * @param searchHouseDTO
64
+     * @return
65
+     */
66
+    @Override
67
+    public List<TaBuilding> getRecommendBuildings(Integer orgId, SearchHouseDTO searchHouseDTO) {
68
+        // 区域
69
+        String area = searchHouseDTO.getIntentArea();
70
+        Integer areaId = StringUtils.isEmpty(area) ? null : Integer.valueOf(area);
71
+        // 区域所属城市
72
+        Integer areaCity = null;
73
+        if (null != areaId) {
74
+            TdCity city = tdCityMapper.selectById(areaId);
75
+            areaCity = city.getParentid();
76
+        }
77
+
78
+        // 当前城市
79
+        Integer cityId = searchHouseDTO.getCityId();
80
+        // 最小总价
81
+        Integer minPriceW = Integer.parseInt(searchHouseDTO.getMinPrice());
82
+        // 最大总价
83
+        Integer maxPriceW = Integer.parseInt(searchHouseDTO.getMaxPrice());
84
+        // 面积字典
85
+        Integer areaResultId = searchHouseDTO.getAreaResultId();
86
+        //
87
+        Integer[] unitPrice = getUnitPriceRange(minPriceW, maxPriceW, areaResultId);
88
+        // 最小单价
89
+        Integer minPrice = unitPrice[0];
90
+        // 最大单价
91
+        Integer maxPrice = unitPrice[1];
92
+
93
+        if (null != areaId) {
94
+            // 1、先判断区域+价格
95
+            List<TaBuilding> lst1 = searchHouseMapper.getRecommendBuildings(orgId, null, areaId, minPriceW, maxPriceW, minPrice, maxPrice);
96
+            if (null != lst1 && lst1.size() > 0) {
97
+                return lst1;
98
+            }
99
+
100
+            // 2、判断城市+价格
101
+            List<TaBuilding> lst2 = searchHouseMapper.getRecommendBuildings(orgId, areaCity, null, minPriceW, maxPriceW, minPrice, maxPrice);
102
+            if (null != lst2 && lst2.size() > 0) {
103
+                return lst2;
104
+            }
105
+        }
106
+
107
+        // 3、当前城市
108
+        return searchHouseMapper.getRecommendBuildings(orgId, cityId, null, minPriceW, maxPriceW, minPrice, maxPrice);
109
+    }
110
+
111
+    private Integer[] getUnitPriceRange(Integer minPriceW, Integer maxPriceW, Integer areaResultId) {
112
+        Integer minPrice = minPriceW;
113
+        Integer maxPrice = maxPriceW;
114
+
115
+        // 字典过滤 - 必须与小程序端保持一致
116
+        switch (areaResultId) {
117
+            case 1:
118
+                // 60㎡ 以下, 则按照 30 - 60 处理
119
+                minPrice = minPrice / 60;
120
+                maxPrice = maxPrice / 30;
121
+                break;
122
+            case 2:
123
+                // 60 - 90
124
+                minPrice = minPrice / 90;
125
+                maxPrice = maxPrice / 60;
126
+                break;
127
+            case 3:
128
+                // 90 - 110
129
+                minPrice = minPrice / 110;
130
+                maxPrice = maxPrice / 90;
131
+                break;
132
+            case 4:
133
+                // 110 - 130
134
+                minPrice = minPrice / 130;
135
+                maxPrice = maxPrice / 110;
136
+                break;
137
+            case 5:
138
+                // 130 - 150
139
+                minPrice = minPrice / 150;
140
+                maxPrice = maxPrice / 130;
141
+                break;
142
+            case 6:
143
+                // 150 - 200
144
+                minPrice = minPrice / 200;
145
+                maxPrice = maxPrice / 150;
146
+                break;
147
+            default:
148
+                // 200 以上
149
+                minPrice = minPrice / 200;
150
+                maxPrice = maxPrice / 200;
151
+                break;
152
+        }
153
+
154
+        return new Integer[] {minPrice * 10000, maxPrice * 10000};
155
+    }
46 156
 }

+ 56
- 22
src/main/resources/mapper/TaBuildingMapper.xml Ver arquivo

@@ -49,7 +49,7 @@
49 49
         SELECT * FROM ta_building
50 50
         <where>
51 51
             1 =1
52
-            and status = 1
52
+            and status != -1
53 53
             <if test="Name != null and Name != ''">
54 54
                 and  (ta_building.name like concat('%',#{Name,jdbcType=VARCHAR},'%') or ta_building.building_name like concat('%',#{Name,jdbcType=VARCHAR},'%'))
55 55
             </if>
@@ -119,7 +119,7 @@
119 119
                 </if>
120 120
                 <if test="buildingArea != null">
121 121
                     AND building_area in
122
-                    <foreach collection="buildingAreaLisr" item="buildingList" open="(" close=")" separator=" OR ">
122
+                    <foreach collection="buildingAreaLisr" item="buildingList" open="(" close=")" separator=" , ">
123 123
                      #{buildingList}
124 124
                     </foreach>
125 125
                 </if>
@@ -147,24 +147,22 @@
147 147
                 </if>
148 148
             ) as tb
149 149
 
150
-            <if test="(priceList != null and priceList.size > 0) or (buildingTypeList != null and buildingTypeList.length > 0)">
151
-                INNER JOIN
150
+                left JOIN
152 151
                 (
153 152
                 SELECT * FROM ta_building_project_type
154 153
                 <trim prefix="where" prefixOverrides="and | or">
155
-
156
-                    <if test="priceList != null">
154
+                    <if test="priceList != null and priceList.size > 0">
157 155
                         <foreach collection="priceList" item="priceArr" open="(" close=")" separator=" OR ">
158 156
                             (
159
-                                <if test='priceArr[0] != null and priceArr[0] != ""'>
160
-                                    <![CDATA[ start_price > ${priceArr[0]}  ]]>
161
-                                </if>
162
-                                <if test='priceArr.length > 1 and priceArr[0] != null and priceArr[0] != ""'>
163
-                                    AND
164
-                                </if>
165
-                                <if test='priceArr.length > 1 and priceArr[1] != null and priceArr[1] != ""'>
166
-                                    <![CDATA[ start_price <= ${priceArr[1]}  ]]>
167
-                                </if>
157
+                            <if test='priceArr[0] != null and priceArr[0] != ""'>
158
+                                <![CDATA[ start_price > ${priceArr[0]}  ]]>
159
+                            </if>
160
+                            <if test='priceArr.length > 1 and priceArr[0] != null and priceArr[0] != ""'>
161
+                                AND
162
+                            </if>
163
+                            <if test='priceArr.length > 1 and priceArr[1] != null and priceArr[1] != ""'>
164
+                                <![CDATA[ start_price <= ${priceArr[1]}  ]]>
165
+                            </if>
168 166
                             )  or
169 167
                             (
170 168
                             <if test='priceArr[0] != null and priceArr[0] != ""'>
@@ -178,10 +176,9 @@
178 176
                             </if>
179 177
                             )
180 178
                         </foreach>
181
-                    </if>
182
-
183
-                    <if test="priceType != null and priceType != ''">
184
-                        and price_type = #{priceType}
179
+                        <if test="priceType != null and priceType != ''">
180
+                            and price_type = #{priceType}
181
+                        </if>
185 182
                     </if>
186 183
 
187 184
                     <if test="buildingTypeList != null and buildingTypeList.length > 0">
@@ -194,14 +191,13 @@
194 191
                 GROUP BY building_id
195 192
                 )
196 193
                 AS tbpt ON tb.building_id = tbpt.building_id
197
-            </if>
198 194
 
199 195
             <if test="(areaList != null and areaList.size > 0) or (houseTypeList != null and houseTypeList.length > 0)">
200 196
                 INNER JOIN
201 197
                 (
202 198
                 SELECT * FROM ta_building_apartment
203 199
                 <trim prefix="where" prefixOverrides="and | or">
204
-                    <if test="areaList != null">
200
+                    <if test="areaList != null and areaList.size > 0">
205 201
                         <foreach collection="areaList" item="areaArr" open="(" close=")" separator=" OR ">
206 202
                             (
207 203
                                 <if test='areaArr[0] != null and areaArr[0] != ""'>
@@ -227,7 +223,45 @@
227 223
                 GROUP BY building_id
228 224
                 ) as tba ON tb.building_id = tba.building_id
229 225
             </if>
230
-            WHERE tb.org_id = #{orgId}
226
+        <trim prefix="where" prefixOverrides="and | or">
227
+            <if test="priceList != null and priceList.size > 0">
228
+                <foreach collection="priceList" item="priceArr" open="(" close=")" separator=" OR ">
229
+                    (
230
+                    <if test='priceArr[0] != null and priceArr[0] != ""'>
231
+                        <![CDATA[ tbpt.start_price > ${priceArr[0]}  ]]>
232
+                    </if>
233
+                    <if test='priceArr.length > 1 and priceArr[0] != null and priceArr[0] != ""'>
234
+                        AND
235
+                    </if>
236
+                    <if test='priceArr.length > 1 and priceArr[1] != null and priceArr[1] != ""'>
237
+                        <![CDATA[ tbpt.start_price <= ${priceArr[1]}  ]]>
238
+                    </if>
239
+                    )  or
240
+                    (
241
+                    <if test='priceArr[0] != null and priceArr[0] != ""'>
242
+                        <![CDATA[ tbpt.end_price > ${priceArr[0]}  ]]>
243
+                    </if>
244
+                    <if test='priceArr.length > 1 and priceArr[0] != null and priceArr[0] != ""'>
245
+                        AND
246
+                    </if>
247
+                    <if test='priceArr.length > 1 and priceArr[1] != null and priceArr[1] != ""'>
248
+                        <![CDATA[ tbpt.end_price <= ${priceArr[1]}  ]]>
249
+                    </if>
250
+                    )
251
+                </foreach>
252
+                <if test="priceType != null and priceType != ''">
253
+                    and tbpt.price_type = #{priceType}
254
+                </if>
255
+            </if>
256
+
257
+            and tb.org_id = #{orgId}
258
+            <if test="buildingTypeList != null and buildingTypeList.length > 0">
259
+                AND tbpt.building_type_id in
260
+                <foreach collection="buildingTypeList" item="buildingType" open="(" close=")" separator=",">
261
+                    #{buildingType}
262
+                </foreach>
263
+            </if>
264
+        </trim>
231 265
             ORDER BY ${orderBy}
232 266
     </select>
233 267
 

+ 2
- 2
src/main/resources/mapper/TaChannelMapper.xml Ver arquivo

@@ -32,8 +32,8 @@
32 32
             and c.org_id = #{orgId}
33 33
             and c.status = 1
34 34
 
35
-            <if test="institutionId != null and institutionId != ''">
36
-                AND c.institution_id = #{institutionId}
35
+            <if test="institutionCode != null and institutionCode != ''">
36
+                AND i.institution_code like CONCAT(#{institutionCode}, '%')
37 37
             </if>
38 38
             <if test="institutionIds != null and institutionIds.size > 0">
39 39
                 AND c.institution_id in

+ 1
- 1
src/main/resources/mapper/TaRaiseRecordMapper.xml Ver arquivo

@@ -42,7 +42,7 @@
42 42
             AND t.house_locking_status = #{bo.lockingStatus}
43 43
         </if>
44 44
         <if test="bo.lockingStatus == 'unlocked'">
45
-            AND (t.house_locking_status = #{bo.lockingStatus} || t.house_locking_status is null)
45
+            AND (t.house_locking_status = #{bo.lockingStatus} OR t.house_locking_status is null)
46 46
         </if>
47 47
         <if test="bo.apartmentId != null and bo.apartmentId != ''">
48 48
             AND t.apartment_id = #{bo.apartmentId}

+ 1
- 1
src/main/resources/mapper/TaRecommendCustomerMapper.xml Ver arquivo

@@ -1020,7 +1020,7 @@ FROM
1020 1020
             null as channel_id,
1021 1021
             p.name as channelName,
1022 1022
             t.create_date,
1023
-            if(v.customer_visit_id is not null || t.`status` = 2 || t.realty_consultant is not null,true,false) as visitStatus
1023
+            if(v.customer_visit_id is not null OR t.`status` = 2 OR t.realty_consultant is not null,true,false) as visitStatus
1024 1024
         FROM
1025 1025
             ta_recommend_customer t
1026 1026
          left JOIN ta_person p ON t.realty_consultant = p.person_id

+ 17
- 17
src/main/resources/mapper/TaShareCountMapper.xml Ver arquivo

@@ -18,14 +18,14 @@
18 18
         select
19 19
 
20 20
         case
21
-        when a.title != null || a.title != '' then a.title
22
-        when b.title != null || b.title != '' then b.title
23
-        when c.activity_name != null || c.activity_name != '' then c.activity_name
24
-        when d.`name` != null || d.name != '' then d.`name`
25
-        when e.building_name != null || e.building_name != '' then e.building_name
26
-        when f.news_name != null || f.news_name != '' then f.news_name
27
-        when g.`name` != null || g.`name` != '' then g.`name`
28
-        when h.sales_batch_name != null || h.sales_batch_name != '' then h.sales_batch_name
21
+        when a.title != null or a.title != '' then a.title
22
+        when b.title != null or b.title != '' then b.title
23
+        when c.activity_name != null or c.activity_name != '' then c.activity_name
24
+        when d.`name` != null or d.name != '' then d.`name`
25
+        when e.building_name != null or e.building_name != '' then e.building_name
26
+        when f.news_name != null or f.news_name != '' then f.news_name
27
+        when g.`name` != null or g.`name` != '' then g.`name`
28
+        when h.sales_batch_name != null or h.sales_batch_name != '' then h.sales_batch_name
29 29
         else '空'
30 30
         end as shareTitle,t.create_date
31 31
         from ta_share_count t
@@ -39,7 +39,7 @@
39 39
         left JOIN ta_person g on t.be_share = g.person_id and t.tagert_type = 'consultant'
40 40
         where t.person_id = #{personId}
41 41
         <if test="shareType != null and shareType != ''">
42
-            and (t.tagert_type = #{shareType} || t.tagert_type like CONCAT(#{shareType} , '%'))
42
+            and (t.tagert_type = #{shareType} or t.tagert_type like CONCAT(#{shareType} , '%'))
43 43
         </if>
44 44
         <if test="shareTitle != null and shareTitle != ''">
45 45
             and
@@ -60,14 +60,14 @@
60 60
     <select id="selectClickListByParams" resultType="com.yunzhi.marketing.entity.TaShareCount">
61 61
         SELECT
62 62
             case
63
-                when g.title != null || g.title != '' then g.title
64
-                when b.title != null || b.title != '' then b.title
65
-                when c.activity_name != null || c.activity_name != '' then c.activity_name
66
-                when d.`name` != null || d.name != '' then d.`name`
67
-                when e.building_name != null || e.building_name != '' then e.building_name
68
-                when f.news_name != null || f.news_name != '' then f.news_name
69
-                when h.sales_batch_name != null || h.sales_batch_name !='' then h.sales_batch_name
70
-                WHEN y.`name` != NULL || y.`name` != '' THEN y.`name`
63
+                when g.title != null or g.title != '' then g.title
64
+                when b.title != null or b.title != '' then b.title
65
+                when c.activity_name != null or c.activity_name != '' then c.activity_name
66
+                when d.`name` != null or d.name != '' then d.`name`
67
+                when e.building_name != null or e.building_name != '' then e.building_name
68
+                when f.news_name != null or f.news_name != '' then f.news_name
69
+                when h.sales_batch_name != null or h.sales_batch_name !='' then h.sales_batch_name
70
+                WHEN y.`name` != NULL or y.`name` != '' THEN y.`name`
71 71
                 else '空'
72 72
                 end as shareTitle,
73 73
                         z.phone as personPhone,

+ 1
- 0
src/main/resources/mapper/TaUserMapper.xml Ver arquivo

@@ -161,6 +161,7 @@
161 161
     <select id="selectPageList" resultType="com.yunzhi.marketing.center.taUser.entity.TaUserVO">
162 162
         SELECT
163 163
             s.person_id as user_id,
164
+            t.user_id as real_user_id,
164 165
             t.*
165 166
         FROM
166 167
             ta_user t

+ 23
- 0
src/main/resources/mapper/xlk/SearchHouseMapper.xml Ver arquivo

@@ -26,6 +26,7 @@
26 26
         <if test="params.status != null and params.status != ''">
27 27
             and t.status = #{params.status}
28 28
         </if>
29
+        order by CREATED_TIME desc
29 30
     </select>
30 31
     <select id="selectSearchHouseDetail" resultType="com.yunzhi.marketing.xlk.vo.SearchHouseVO">
31 32
         SELECT
@@ -39,4 +40,26 @@
39 40
             LEFT JOIN ta_person p ON t.person_id = p.person_id
40 41
             WHERE t.id = #{id}
41 42
     </select>
43
+    <select id="getRecommendBuildings" resultType="com.yunzhi.marketing.entity.TaBuilding">
44
+        SELECT
45
+            DISTINCT t.*
46
+        FROM
47
+            ta_building t
48
+            INNER JOIN ta_building_project_type s ON t.building_id = s.building_id
49
+        WHERE
50
+            t.org_id = #{orgId}
51
+        <if test="cityId != null">
52
+            AND t.city_id = #{cityId}
53
+        </if>
54
+        <if test="areaId != null">
55
+            AND t.building_area = #{areaId}
56
+        </if>
57
+            AND (
58
+                ( s.start_price &gt;= #{minPriceW} AND s.end_price &lt;= #{maxPriceW} AND s.price_type = 'total' )
59
+                OR ( s.start_price &gt;= #{minPrice} AND s.end_price &lt;= #{maxPrice} AND s.price_type = 'average' )
60
+            )
61
+            AND t.`status` > - 1
62
+        ORDER BY
63
+            t.is_main ASC
64
+    </select>
42 65
 </mapper>