傅行帆 3 anni fa
parent
commit
a71cb76d9d
1 ha cambiato i file con 44 aggiunte e 7 eliminazioni
  1. 44
    7
      src/main/resources/mapper/TaBuildingMapper.xml

+ 44
- 7
src/main/resources/mapper/TaBuildingMapper.xml Vedi File

@@ -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>
@@ -150,6 +150,44 @@
150 150
                 left JOIN
151 151
                 (
152 152
                 SELECT * FROM ta_building_project_type
153
+                <trim prefix="where" prefixOverrides="and | or">
154
+                    <if test="priceList != null and priceList.size > 0">
155
+                        <foreach collection="priceList" item="priceArr" open="(" close=")" separator=" OR ">
156
+                            (
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>
166
+                            )  or
167
+                            (
168
+                            <if test='priceArr[0] != null and priceArr[0] != ""'>
169
+                                <![CDATA[ end_price > ${priceArr[0]}  ]]>
170
+                            </if>
171
+                            <if test='priceArr.length > 1 and priceArr[0] != null and priceArr[0] != ""'>
172
+                                AND
173
+                            </if>
174
+                            <if test='priceArr.length > 1 and priceArr[1] != null and priceArr[1] != ""'>
175
+                                <![CDATA[ end_price <= ${priceArr[1]}  ]]>
176
+                            </if>
177
+                            )
178
+                        </foreach>
179
+                        <if test="priceType != null and priceType != ''">
180
+                            and price_type = #{priceType}
181
+                        </if>
182
+                    </if>
183
+
184
+                    <if test="buildingTypeList != null and buildingTypeList.length > 0">
185
+                        AND building_type_id in
186
+                        <foreach collection="buildingTypeList" item="buildingType" open="(" close=")" separator=",">
187
+                            #{buildingType}
188
+                        </foreach>
189
+                    </if>
190
+                </trim>
153 191
                 GROUP BY building_id
154 192
                 )
155 193
                 AS tbpt ON tb.building_id = tbpt.building_id
@@ -159,7 +197,7 @@
159 197
                 (
160 198
                 SELECT * FROM ta_building_apartment
161 199
                 <trim prefix="where" prefixOverrides="and | or">
162
-                    <if test="areaList != null">
200
+                    <if test="areaList != null and areaList.size > 0">
163 201
                         <foreach collection="areaList" item="areaArr" open="(" close=")" separator=" OR ">
164 202
                             (
165 203
                                 <if test='areaArr[0] != null and areaArr[0] != ""'>
@@ -186,7 +224,7 @@
186 224
                 ) as tba ON tb.building_id = tba.building_id
187 225
             </if>
188 226
         <trim prefix="where" prefixOverrides="and | or">
189
-            <if test="priceList != null">
227
+            <if test="priceList != null and priceList.size > 0">
190 228
                 <foreach collection="priceList" item="priceArr" open="(" close=")" separator=" OR ">
191 229
                     (
192 230
                     <if test='priceArr[0] != null and priceArr[0] != ""'>
@@ -211,13 +249,12 @@
211 249
                     </if>
212 250
                     )
213 251
                 </foreach>
252
+                <if test="priceType != null and priceType != ''">
253
+                    and tbpt.price_type = #{priceType}
254
+                </if>
214 255
             </if>
215 256
 
216 257
             and tb.org_id = #{orgId}
217
-            <if test="priceType != null and priceType != ''">
218
-                and tbpt.price_type = #{priceType}
219
-            </if>
220
-
221 258
             <if test="buildingTypeList != null and buildingTypeList.length > 0">
222 259
                 AND tbpt.building_type_id in
223 260
                 <foreach collection="buildingTypeList" item="buildingType" open="(" close=")" separator=",">