Commit 77d74af75018e0c7ede2f651adba30d8b2a4edcc
1 parent
fc56d8af
feature(*): 查询的bug修复
- 查询的bug修复
Showing
1 changed file
with
47 additions
and
42 deletions
fw-valhalla-dao/src/main/resources/mapper/CustomerMapper.xml
@@ -264,60 +264,65 @@ | @@ -264,60 +264,65 @@ | ||
264 | </if> | 264 | </if> |
265 | <if test="condition.andCondition==true"> | 265 | <if test="condition.andCondition==true"> |
266 | and ( | 266 | and ( |
267 | - t1.adviser_id is not null | ||
268 | - <if test="condition.minMileage !=null and condition.maxMileage !=null"> | ||
269 | - <if test="condition.minMileage !=null"> | ||
270 | - and t1.current_mileage >= #{condition.minMileage} | ||
271 | - </if> | ||
272 | - <if test="condition.maxMileage !=null"> | ||
273 | - and t1.current_mileage <= #{condition.maxMileage} | ||
274 | - </if> | ||
275 | - </if> | ||
276 | - <if test="condition.minBuyDate !=null and condition.maxBuyDate !=null"> | ||
277 | - <if test="condition.minBuyDate !=null"> | ||
278 | - and t1.buy_date >= #{condition.minBuyDate} | 267 | + t1.adviser_id is not null and |
268 | + <trim prefixOverrides="and"> | ||
269 | + <if test="condition.minMileage !=null and condition.maxMileage !=null"> | ||
270 | + <if test="condition.minMileage !=null"> | ||
271 | + and t1.current_mileage >= #{condition.minMileage} | ||
272 | + </if> | ||
273 | + <if test="condition.maxMileage !=null"> | ||
274 | + and t1.current_mileage <= #{condition.maxMileage} | ||
275 | + </if> | ||
279 | </if> | 276 | </if> |
280 | - <if test="condition.maxBuyDate !=null"> | ||
281 | - and t1.buy_date <= #{condition.maxBuyDate} | 277 | + |
278 | + <if test="condition.minBuyDate !=null and condition.maxBuyDate !=null"> | ||
279 | + <if test="condition.minBuyDate !=null"> | ||
280 | + and t1.buy_date >= #{condition.minBuyDate} | ||
281 | + </if> | ||
282 | + <if test="condition.maxBuyDate !=null"> | ||
283 | + and t1.buy_date <= #{condition.maxBuyDate} | ||
284 | + </if> | ||
282 | </if> | 285 | </if> |
283 | - </if> | ||
284 | 286 | ||
285 | - <if test="condition.level !=null"> | ||
286 | - and t1.cus_level = #{condition.level} | ||
287 | - </if> | 287 | + <if test="condition.level !=null"> |
288 | + and t1.cus_level = #{condition.level} | ||
289 | + </if> | ||
290 | + </trim> | ||
288 | ) | 291 | ) |
289 | </if> | 292 | </if> |
290 | 293 | ||
291 | <if test="condition.andCondition==false"> | 294 | <if test="condition.andCondition==false"> |
292 | and ( | 295 | and ( |
293 | - t1.adviser_id is not null | ||
294 | - <if test="condition.minMileage !=null and condition.maxMileage !=null"> | ||
295 | - or ( | ||
296 | - t1.current_mileage is not null | ||
297 | - <if test="condition.minMileage !=null"> | ||
298 | - and t1.current_mileage >= #{condition.minMileage} | ||
299 | - </if> | ||
300 | - <if test="condition.maxMileage !=null"> | ||
301 | - and t1.current_mileage <= #{condition.maxMileage} | 296 | + t1.adviser_id is not null and |
297 | + <trim prefixOverrides="or"> | ||
298 | + <if test="condition.minMileage !=null and condition.maxMileage !=null"> | ||
299 | + or ( | ||
300 | + t1.current_mileage is not null | ||
301 | + <if test="condition.minMileage !=null"> | ||
302 | + and t1.current_mileage >= #{condition.minMileage} | ||
303 | + </if> | ||
304 | + <if test="condition.maxMileage !=null"> | ||
305 | + and t1.current_mileage <= #{condition.maxMileage} | ||
306 | + </if> | ||
307 | + ) | ||
302 | </if> | 308 | </if> |
303 | - ) | ||
304 | - </if> | ||
305 | 309 | ||
306 | - <if test="condition.minBuyDate !=null and condition.maxBuyDate !=null"> | ||
307 | - or ( | ||
308 | - t1.buy_date is not null | ||
309 | - <if test="condition.minBuyDate !=null"> | ||
310 | - and t1.buy_date >= #{condition.minBuyDate} | ||
311 | - </if> | ||
312 | - <if test="condition.maxBuyDate !=null"> | ||
313 | - and t1.buy_date <= #{condition.maxBuyDate} | 310 | + <if test="condition.minBuyDate !=null and condition.maxBuyDate !=null"> |
311 | + or ( | ||
312 | + t1.buy_date is not null | ||
313 | + <if test="condition.minBuyDate !=null"> | ||
314 | + and t1.buy_date >= #{condition.minBuyDate} | ||
315 | + </if> | ||
316 | + <if test="condition.maxBuyDate !=null"> | ||
317 | + and t1.buy_date <= #{condition.maxBuyDate} | ||
318 | + </if> | ||
319 | + ) | ||
314 | </if> | 320 | </if> |
315 | - ) | ||
316 | - </if> | ||
317 | 321 | ||
318 | - <if test="condition.level !=null"> | ||
319 | - or t1.cus_level = #{condition.level} | ||
320 | - </if> | 322 | + <if test="condition.level !=null"> |
323 | + or t1.cus_level = #{condition.level} | ||
324 | + </if> | ||
325 | + </trim> | ||
321 | ) | 326 | ) |
322 | </if> | 327 | </if> |
323 | </select> | 328 | </select> |