|
1 | 1 | /* |
2 | | - * Copyright 2016-2021 the original author or authors. |
| 2 | + * Copyright 2016-2022 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -214,82 +214,109 @@ static WhereDSL where() { |
214 | 214 | return WhereDSL.where(); |
215 | 215 | } |
216 | 216 |
|
217 | | - static <T> WhereDSL where(BindableColumn<T> column, VisitableCondition<T> condition) { |
218 | | - return WhereDSL.where().where(column, condition); |
219 | | - } |
220 | | - |
221 | 217 | static <T> WhereDSL where(BindableColumn<T> column, VisitableCondition<T> condition, |
222 | | - SqlCriterion... subCriteria) { |
| 218 | + AndOrCriteriaGroup... subCriteria) { |
223 | 219 | return WhereDSL.where().where(column, condition, subCriteria); |
224 | 220 | } |
225 | 221 |
|
226 | | - static WhereDSL where(ExistsPredicate existsPredicate) { |
227 | | - return WhereDSL.where().where(existsPredicate); |
| 222 | + static WhereDSL where(CriteriaGroup criteriaGroup, AndOrCriteriaGroup... subCriteria) { |
| 223 | + return WhereDSL.where().where(criteriaGroup, subCriteria); |
228 | 224 | } |
229 | 225 |
|
230 | | - static WhereDSL where(ExistsPredicate existsPredicate, SqlCriterion... subCriteria) { |
| 226 | + static WhereDSL where(ExistsPredicate existsPredicate, AndOrCriteriaGroup... subCriteria) { |
231 | 227 | return WhereDSL.where().where(existsPredicate, subCriteria); |
232 | 228 | } |
233 | 229 |
|
234 | 230 | // where condition connectors |
235 | | - static <T> SqlCriterion or(BindableColumn<T> column, VisitableCondition<T> condition) { |
236 | | - return ColumnAndConditionCriterion.withColumn(column) |
237 | | - .withConnector("or") //$NON-NLS-1$ |
238 | | - .withCondition(condition) |
| 231 | + static <T> CriteriaGroup group(BindableColumn<T> column, VisitableCondition<T> condition, |
| 232 | + AndOrCriteriaGroup...subCriteria) { |
| 233 | + return group(column, condition, Arrays.asList(subCriteria)); |
| 234 | + } |
| 235 | + |
| 236 | + static <T> CriteriaGroup group(BindableColumn<T> column, VisitableCondition<T> condition, |
| 237 | + List<AndOrCriteriaGroup> subCriteria) { |
| 238 | + return new CriteriaGroup.Builder() |
| 239 | + .withInitialCriterion(new ColumnAndConditionCriterion.Builder<T>().withColumn(column) |
| 240 | + .withCondition(condition).build()) |
| 241 | + .withSubCriteria(subCriteria) |
239 | 242 | .build(); |
240 | 243 | } |
241 | 244 |
|
242 | | - static <T> SqlCriterion or(BindableColumn<T> column, VisitableCondition<T> condition, |
243 | | - SqlCriterion...subCriteria) { |
244 | | - return ColumnAndConditionCriterion.withColumn(column) |
245 | | - .withConnector("or") //$NON-NLS-1$ |
246 | | - .withCondition(condition) |
247 | | - .withSubCriteria(Arrays.asList(subCriteria)) |
| 245 | + static CriteriaGroup group(ExistsPredicate existsPredicate, AndOrCriteriaGroup...subCriteria) { |
| 246 | + return group(existsPredicate, Arrays.asList(subCriteria)); |
| 247 | + } |
| 248 | + |
| 249 | + static CriteriaGroup group(ExistsPredicate existsPredicate, List<AndOrCriteriaGroup> subCriteria) { |
| 250 | + return new CriteriaGroup.Builder() |
| 251 | + .withInitialCriterion(new ExistsCriterion.Builder() |
| 252 | + .withExistsPredicate(existsPredicate).build()) |
| 253 | + .withSubCriteria(subCriteria) |
248 | 254 | .build(); |
249 | 255 | } |
250 | 256 |
|
251 | | - static SqlCriterion or(ExistsPredicate existsPredicate) { |
252 | | - return new ExistsCriterion.Builder() |
| 257 | + static CriteriaGroup group(CriteriaGroup criteriaGroup, AndOrCriteriaGroup...subCriteria) { |
| 258 | + return group(criteriaGroup, Arrays.asList(subCriteria)); |
| 259 | + } |
| 260 | + |
| 261 | + static CriteriaGroup group(CriteriaGroup criteriaGroup, List<AndOrCriteriaGroup> subCriteria) { |
| 262 | + return new CriteriaGroup.Builder() |
| 263 | + .withInitialCriterion(criteriaGroup) |
| 264 | + .withSubCriteria(subCriteria) |
| 265 | + .build(); |
| 266 | + } |
| 267 | + |
| 268 | + static <T> AndOrCriteriaGroup or(BindableColumn<T> column, VisitableCondition<T> condition, |
| 269 | + AndOrCriteriaGroup...subCriteria) { |
| 270 | + return new AndOrCriteriaGroup.Builder() |
| 271 | + .withInitialCriterion(ColumnAndConditionCriterion.withColumn(column) |
| 272 | + .withCondition(condition) |
| 273 | + .build()) |
253 | 274 | .withConnector("or") //$NON-NLS-1$ |
254 | | - .withExistsPredicate(existsPredicate) |
| 275 | + .withSubCriteria(Arrays.asList(subCriteria)) |
255 | 276 | .build(); |
256 | 277 | } |
257 | 278 |
|
258 | | - static SqlCriterion or(ExistsPredicate existsPredicate, SqlCriterion...subCriteria) { |
259 | | - return new ExistsCriterion.Builder() |
| 279 | + static AndOrCriteriaGroup or(ExistsPredicate existsPredicate, AndOrCriteriaGroup...subCriteria) { |
| 280 | + return new AndOrCriteriaGroup.Builder() |
| 281 | + .withInitialCriterion(new ExistsCriterion.Builder() |
| 282 | + .withExistsPredicate(existsPredicate).build()) |
260 | 283 | .withConnector("or") //$NON-NLS-1$ |
261 | | - .withExistsPredicate(existsPredicate) |
262 | 284 | .withSubCriteria(Arrays.asList(subCriteria)) |
263 | 285 | .build(); |
264 | 286 | } |
265 | 287 |
|
266 | | - static <T> SqlCriterion and(BindableColumn<T> column, VisitableCondition<T> condition) { |
267 | | - return ColumnAndConditionCriterion.withColumn(column) |
268 | | - .withConnector("and") //$NON-NLS-1$ |
269 | | - .withCondition(condition) |
| 288 | + static AndOrCriteriaGroup or(CriteriaGroup criteriaGroup, AndOrCriteriaGroup...subCriteria) { |
| 289 | + return new AndOrCriteriaGroup.Builder() |
| 290 | + .withConnector("or") //$NON-NLS-1$ |
| 291 | + .withInitialCriterion(criteriaGroup) |
| 292 | + .withSubCriteria(Arrays.asList(subCriteria)) |
270 | 293 | .build(); |
271 | 294 | } |
272 | 295 |
|
273 | | - static <T> SqlCriterion and(BindableColumn<T> column, VisitableCondition<T> condition, |
274 | | - SqlCriterion...subCriteria) { |
275 | | - return ColumnAndConditionCriterion.withColumn(column) |
| 296 | + static <T> AndOrCriteriaGroup and(BindableColumn<T> column, VisitableCondition<T> condition, |
| 297 | + AndOrCriteriaGroup...subCriteria) { |
| 298 | + return new AndOrCriteriaGroup.Builder() |
| 299 | + .withInitialCriterion(ColumnAndConditionCriterion.withColumn(column) |
| 300 | + .withCondition(condition) |
| 301 | + .build()) |
276 | 302 | .withConnector("and") //$NON-NLS-1$ |
277 | | - .withCondition(condition) |
278 | 303 | .withSubCriteria(Arrays.asList(subCriteria)) |
279 | 304 | .build(); |
280 | 305 | } |
281 | 306 |
|
282 | | - static SqlCriterion and(ExistsPredicate existsPredicate) { |
283 | | - return new ExistsCriterion.Builder() |
| 307 | + static AndOrCriteriaGroup and(ExistsPredicate existsPredicate, AndOrCriteriaGroup...subCriteria) { |
| 308 | + return new AndOrCriteriaGroup.Builder() |
| 309 | + .withInitialCriterion(new ExistsCriterion.Builder() |
| 310 | + .withExistsPredicate(existsPredicate).build()) |
284 | 311 | .withConnector("and") //$NON-NLS-1$ |
285 | | - .withExistsPredicate(existsPredicate) |
| 312 | + .withSubCriteria(Arrays.asList(subCriteria)) |
286 | 313 | .build(); |
287 | 314 | } |
288 | 315 |
|
289 | | - static SqlCriterion and(ExistsPredicate existsPredicate, SqlCriterion...subCriteria) { |
290 | | - return new ExistsCriterion.Builder() |
| 316 | + static AndOrCriteriaGroup and(CriteriaGroup criteriaGroup, AndOrCriteriaGroup...subCriteria) { |
| 317 | + return new AndOrCriteriaGroup.Builder() |
291 | 318 | .withConnector("and") //$NON-NLS-1$ |
292 | | - .withExistsPredicate(existsPredicate) |
| 319 | + .withInitialCriterion(criteriaGroup) |
293 | 320 | .withSubCriteria(Arrays.asList(subCriteria)) |
294 | 321 | .build(); |
295 | 322 | } |
|
0 commit comments