Ver código fonte

* 房源价格查询优化

顾绍勇 5 anos atrás
pai
commit
b5f8fc5f74

+ 5
- 0
src/main/java/com/huiju/estateagents/controller/TaHousingResourcesController.java Ver arquivo

@@ -7,6 +7,7 @@ import com.huiju.estateagents.common.CommConstant;
7 7
 import com.huiju.estateagents.entity.TaBuildingRoom;
8 8
 import com.huiju.estateagents.entity.TaHousingResources;
9 9
 import com.huiju.estateagents.entity.TaPreselectionRecord;
10
+import com.huiju.estateagents.po.TaHousingResourcesPO;
10 11
 import com.huiju.estateagents.service.ITaBuildingRoomService;
11 12
 import com.huiju.estateagents.service.ITaHousingResourcesService;
12 13
 import com.huiju.estateagents.service.ITaPreselectionRecordService;
@@ -219,6 +220,10 @@ public class TaHousingResourcesController extends BaseController {
219 220
                                              HttpServletRequest request) {
220 221
         ResponseBean responseBean = new ResponseBean();
221 222
         Integer orgId = getOrgId(request);
223
+
224
+        logger.info("TaHouseingResourcesController.listHousingResources 接收参数:orgId:{},salesBatchId:{},startPrice:{},endPrice:{},apartmentId:{}",
225
+                orgId, salesBatchId, startPrice, endPrice, apartmentId);
226
+
222 227
         try {
223 228
             responseBean.addSuccess(iTaHousingResourcesService.listHousingResources(orgId, salesBatchId, startPrice, endPrice, apartmentId));
224 229
         } catch (Exception e) {

+ 13
- 3
src/main/resources/mapper/TaHousingResourcesMapper.xml Ver arquivo

@@ -37,9 +37,19 @@
37 37
         LEFT JOIN ta_building_term t4 ON t3.term_id = t4.term_id
38 38
         WHERE
39 39
             t.sales_batch_id = #{salesBatchId}
40
-            <if test="startPrice != null and startPrice != '' and endPrice != null and endPrice != ''">
41
-                AND ( t.price BETWEEN #{startPrice} AND #{endPrice} )
42
-            </if>
40
+            <choose>
41
+                <when test=" endPrice != null and startPrice == null">
42
+                    AND t.price &lt;= #{endPrice}
43
+                </when>
44
+                <when test=" startPrice != null and endPrice == null">
45
+                    AND t.price &gt;= #{startPrice}
46
+                </when>
47
+                <when test="startPrice != null and endPrice != null ">
48
+                    AND ( t.price BETWEEN #{startPrice} AND #{endPrice} )
49
+                </when>
50
+                <otherwise>
51
+                </otherwise>
52
+            </choose>
43 53
             <if test="apartmentId != null and apartmentId != ''">
44 54
                 AND t.apartment_id = #{apartmentId}
45 55
             </if>