Commit fc56d8af3c6abd55fb46ba84cca1575948c7ed68
1 parent
ee7b2ce1
feature(*): 查询的bug修复
- 查询的bug修复
Showing
1 changed file
with
46 additions
and
42 deletions
fw-valhalla-dao/src/main/resources/mapper/CustomerMapper.xml
... | ... | @@ -168,61 +168,65 @@ |
168 | 168 | </if> |
169 | 169 | <if test="condition.andCondition==true"> |
170 | 170 | and ( |
171 | - t1.adviser_id is not null | |
172 | - <if test="condition.minMileage !=null and condition.maxMileage !=null"> | |
173 | - <if test="condition.minMileage !=null"> | |
174 | - and t1.current_mileage >= #{condition.minMileage} | |
171 | + t1.adviser_id is not null and | |
172 | + <trim prefixOverrides="and"> | |
173 | + <if test="condition.minMileage !=null and condition.maxMileage !=null"> | |
174 | + <if test="condition.minMileage !=null"> | |
175 | + and t1.current_mileage >= #{condition.minMileage} | |
176 | + </if> | |
177 | + <if test="condition.maxMileage !=null"> | |
178 | + and t1.current_mileage <= #{condition.maxMileage} | |
179 | + </if> | |
175 | 180 | </if> |
176 | - <if test="condition.maxMileage !=null"> | |
177 | - and t1.current_mileage <= #{condition.maxMileage} | |
178 | - </if> | |
179 | - </if> | |
180 | 181 | |
181 | - <if test="condition.minBuyDate !=null and condition.maxBuyDate !=null"> | |
182 | - <if test="condition.minBuyDate !=null"> | |
183 | - and t1.buy_date >= #{condition.minBuyDate} | |
182 | + <if test="condition.minBuyDate !=null and condition.maxBuyDate !=null"> | |
183 | + <if test="condition.minBuyDate !=null"> | |
184 | + and t1.buy_date >= #{condition.minBuyDate} | |
185 | + </if> | |
186 | + <if test="condition.maxBuyDate !=null"> | |
187 | + and t1.buy_date <= #{condition.maxBuyDate} | |
188 | + </if> | |
184 | 189 | </if> |
185 | - <if test="condition.maxBuyDate !=null"> | |
186 | - and t1.buy_date <= #{condition.maxBuyDate} | |
187 | - </if> | |
188 | - </if> | |
189 | 190 | |
190 | - <if test="condition.level !=null"> | |
191 | - and t1.cus_level = #{condition.level} | |
192 | - </if> | |
191 | + <if test="condition.level !=null"> | |
192 | + and t1.cus_level = #{condition.level} | |
193 | + </if> | |
194 | + </trim> | |
193 | 195 | ) |
194 | 196 | </if> |
195 | 197 | |
196 | 198 | <if test="condition.andCondition==false"> |
197 | 199 | and ( |
198 | - t1.adviser_id is not null | |
199 | - <if test="condition.minMileage !=null and condition.maxMileage !=null"> | |
200 | - or ( | |
201 | - t1.current_mileage is not null | |
202 | - <if test="condition.minMileage !=null"> | |
203 | - and t1.current_mileage >= #{condition.minMileage} | |
204 | - </if> | |
205 | - <if test="condition.maxMileage !=null"> | |
206 | - and t1.current_mileage <= #{condition.maxMileage} | |
200 | + t1.adviser_id is not null and | |
201 | + <trim prefixOverrides="or"> | |
202 | + <if test="condition.minMileage !=null and condition.maxMileage !=null"> | |
203 | + or ( | |
204 | + t1.current_mileage is not null | |
205 | + <if test="condition.minMileage !=null"> | |
206 | + and t1.current_mileage >= #{condition.minMileage} | |
207 | + </if> | |
208 | + <if test="condition.maxMileage !=null"> | |
209 | + and t1.current_mileage <= #{condition.maxMileage} | |
210 | + </if> | |
211 | + ) | |
207 | 212 | </if> |
208 | - ) | |
209 | - </if> | |
210 | 213 | |
211 | - <if test="condition.minBuyDate !=null and condition.maxBuyDate !=null"> | |
212 | - or ( | |
213 | - t1.buy_date is not null | |
214 | - <if test="condition.minBuyDate !=null"> | |
215 | - and t1.buy_date >= #{condition.minBuyDate} | |
216 | - </if> | |
217 | - <if test="condition.maxBuyDate !=null"> | |
218 | - and t1.buy_date <= #{condition.maxBuyDate} | |
214 | + <if test="condition.minBuyDate !=null and condition.maxBuyDate !=null"> | |
215 | + or ( | |
216 | + t1.buy_date is not null | |
217 | + <if test="condition.minBuyDate !=null"> | |
218 | + and t1.buy_date >= #{condition.minBuyDate} | |
219 | + </if> | |
220 | + <if test="condition.maxBuyDate !=null"> | |
221 | + and t1.buy_date <= #{condition.maxBuyDate} | |
222 | + </if> | |
223 | + ) | |
219 | 224 | </if> |
220 | - ) | |
221 | - </if> | |
222 | 225 | |
223 | - <if test="condition.level !=null"> | |
224 | - or t1.cus_level = #{condition.level} | |
225 | - </if> | |
226 | + <if test="condition.level !=null"> | |
227 | + or t1.cus_level = #{condition.level} | |
228 | + </if> | |
229 | + </trim> | |
226 | 230 | ) |
227 | 231 | </if> |
228 | 232 | </select> | ... | ... |