yansen 5 年之前
父節點
當前提交
6fd20910a9
共有 1 個文件被更改,包括 13 次插入13 次删除
  1. 13
    13
      src/main/resources/mapper/TaBuildingMapper.xml

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

@@ -89,7 +89,7 @@
89 89
                 <if test="cityId != null">
90 90
                     AND city_id = #{cityId}
91 91
                 </if>
92
-                <if test="targets != null">
92
+                <if test="targets != null and targets.size > 0">
93 93
                     AND building_id IN
94 94
                     <foreach collection="targets" item="buildingId" open="(" close=")" separator=",">
95 95
                         #{buildingId}
@@ -101,8 +101,8 @@
101 101
                 </if>
102 102
             ) as tb
103 103
 
104
-            <if test="priceList != null or buildingTypeList != null">
105
-                LEFT JOIN
104
+            <if test="(priceList != null and priceList.size > 0) or (buildingTypeList != null and buildingTypeList.length > 0)">
105
+                INNER JOIN
106 106
                 (
107 107
                 SELECT * FROM ta_building_project_type
108 108
                 <trim prefix="where" prefixOverrides="and | or">
@@ -110,20 +110,20 @@
110 110
                     <if test="priceList != null">
111 111
                         <foreach collection="priceList" item="priceArr" open="(" close=")" separator=" OR ">
112 112
                             (
113
-                                <if test="priceArr[0] != null and priceArr[0] > 0">
113
+                                <if test='priceArr[0] != null and priceArr[0] != ""'>
114 114
                                     <![CDATA[ price >= ${priceArr[0]}  ]]>
115 115
                                 </if>
116
-                                <if test="priceArr.length > 1 and priceArr[0] != null">
116
+                                <if test='priceArr.length > 1 and priceArr[0] != null and priceArr[0] != ""'>
117 117
                                     AND
118 118
                                 </if>
119
-                                <if test="priceArr[1] != null and priceArr[1] > 0">
119
+                                <if test='priceArr.length > 1 and priceArr[1] != null and priceArr[1] != ""'>
120 120
                                     <![CDATA[ price <= ${priceArr[1]}  ]]>
121 121
                                 </if>
122 122
                             )
123 123
                         </foreach>
124 124
                     </if>
125 125
 
126
-                    <if test="buildingTypeList != null">
126
+                    <if test="buildingTypeList != null and buildingTypeList.length > 0">
127 127
                         AND building_type_id in
128 128
                         <foreach collection="buildingTypeList" item="buildingType" open="(" close=")" separator=",">
129 129
                             #{buildingType}
@@ -135,28 +135,28 @@
135 135
                 AS tbpt ON tb.building_id = tbpt.building_id
136 136
             </if>
137 137
 
138
-            <if test="areaList != null or houseTypeList != null">
139
-                LEFT JOIN
138
+            <if test="(areaList != null and areaList.size > 0) or (houseTypeList != null and houseTypeList.length > 0)">
139
+                INNER JOIN
140 140
                 (
141 141
                 SELECT * FROM ta_building_apartment
142 142
                 <trim prefix="where" prefixOverrides="and | or">
143 143
                     <if test="areaList != null">
144 144
                         <foreach collection="areaList" item="areaArr" open="(" close=")" separator=" OR ">
145 145
                             (
146
-                                <if test="areaArr[0] != null and areaArr[0] > 0">
146
+                                <if test='areaArr[0] != null and areaArr[0] != ""'>
147 147
                                     <![CDATA[ building_area >= ${areaArr[0]}  ]]>
148 148
                                 </if>
149
-                                <if test="areaArr.length > 1 and areaArr[0] != null">
149
+                                <if test='areaArr.length > 1 and areaArr[0] != null and areaArr[0] != ""'>
150 150
                                     AND
151 151
                                 </if>
152
-                                <if test="areaArr[1] != null and areaArr[1] > 0">
152
+                                <if test='areaArr.length > 1 and areaArr[1] != null and areaArr[1] != ""'>
153 153
                                     <![CDATA[ building_area <= ${areaArr[1]}  ]]>
154 154
                                 </if>
155 155
                             )
156 156
                         </foreach>
157 157
                     </if>
158 158
 
159
-                    <if test="houseTypeList != null">
159
+                    <if test="houseTypeList != null and houseTypeList.length > 0">
160 160
                         AND house_type in
161 161
                         <foreach collection="houseTypeList" item="houseType" open="(" close=")" separator=",">
162 162
                             #{houseType}