diff --git a/.gitignore b/.gitignore
index a0d6e2d..92f3dd8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,21 +20,7 @@ dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
-.idea/**/workspace.xml
-.idea/**/tasks.xml
-.idea/**/usage.statistics.xml
-.idea/**/dictionaries
-.idea/**/shelf
-.idea/**/contentModel.xml
-.idea/**/dataSources/
-.idea/**/dataSources.ids
-.idea/**/dataSources.local.xml
-.idea/**/sqlDataSources.xml
-.idea/**/dynamic.xml
-.idea/**/uiDesigner.xml
-.idea/**/dbnavigator.xml
-.idea/**/gradle.xml
-.idea/**/libraries
+.idea/
cmake-build-*/
.idea/**/mongoSettings.xml
*.iws
@@ -46,8 +32,6 @@ com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
-.idea/httpRequests
-.idea/caches/build_file_checksums.ser
*~
.fuse_hidden*
.directory
diff --git a/pom.xml b/pom.xml
index 3e2f67d..cfd0e22 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
dev.struchkov.haiti.filter
haiti-filter-jooq
- 0.8.0
+ 0.9.0-SNAPSHOT
jar
Haiti Filter JOOQ
@@ -24,13 +24,14 @@
- 11
+ 17
${java.version}
${java.version}
UTF-8
UTF-8
- 3.15.5
+
+ 3.18.3
1.6.8
3.2.1
diff --git a/src/main/java/dev/struchkov/haiti/filter/jooq/CriteriaJooqFilter.java b/src/main/java/dev/struchkov/haiti/filter/jooq/CriteriaJooqFilter.java
index 742f78b..c56b592 100644
--- a/src/main/java/dev/struchkov/haiti/filter/jooq/CriteriaJooqFilter.java
+++ b/src/main/java/dev/struchkov/haiti/filter/jooq/CriteriaJooqFilter.java
@@ -31,9 +31,9 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
-import java.util.stream.Collectors;
import static dev.struchkov.haiti.filter.jooq.exception.FilterJooqHaitiException.filterJooqException;
+import static java.util.stream.Collectors.toList;
import static org.jooq.impl.DSL.condition;
import static org.jooq.impl.DSL.field;
@@ -41,7 +41,6 @@ public class CriteriaJooqFilter {
private final List andConditions = new ArrayList<>();
private final List orConditions = new ArrayList<>();
- private final List notConditions = new ArrayList<>();
private final List joinTables = new ArrayList<>();
private final Table generalTable;
@@ -85,17 +84,6 @@ public class CriteriaJooqFilter {
return this;
}
-// FIXME: Добавить поддержку
-// public CriteriaJooqFilter not(FilterQuery filterQuery) {
-// throw new IllegalStateException("Операция отрицания пока не поддерживается");
-// }
-
-
-// FIXME: Добавить поддержку
-// public CriteriaJooqFilter not(Consumer query) {
-// throw new IllegalStateException("Операция отрицания пока не поддерживается");
-// }
-
public CriteriaJooqFilter page(PageableOffset offset) {
Inspector.isNotNull(offset);
Inspector.isNull(seek, filterJooqException("Нельзя установить два типа пагинации одновременно"));
@@ -154,7 +142,7 @@ public class CriteriaJooqFilter {
public CriteriaJooqFilter join(JoinTable... joinTables) {
Inspector.isNotNull(joinTables);
- this.joinTables.addAll(Arrays.stream(joinTables).collect(Collectors.toList()));
+ this.joinTables.addAll(Arrays.stream(joinTables).collect(toList()));
return this;
}
@@ -167,7 +155,7 @@ public class CriteriaJooqFilter {
}
public Query generateQuery(String... fields) {
- final List> selectFields = Arrays.stream(fields).map(DSL::field).collect(Collectors.toList());
+ final List> selectFields = Arrays.stream(fields).map(DSL::field).collect(toList());
final SelectSelectStep mainSelect = !selectFields.isEmpty() ? dsl.select(selectFields) : dsl.select();
final SelectLimitStep extends Record> selectSeekStepN = generate(mainSelect);
return setPaginationOffset(selectSeekStepN);
@@ -201,7 +189,7 @@ public class CriteriaJooqFilter {
return where.groupBy(
groupByFields.stream()
.map(DSL::field)
- .collect(Collectors.toList())
+ .collect(toList())
);
}
return where;
diff --git a/src/main/java/dev/struchkov/haiti/filter/jooq/CriteriaJooqQuery.java b/src/main/java/dev/struchkov/haiti/filter/jooq/CriteriaJooqQuery.java
index a511257..f5c092a 100644
--- a/src/main/java/dev/struchkov/haiti/filter/jooq/CriteriaJooqQuery.java
+++ b/src/main/java/dev/struchkov/haiti/filter/jooq/CriteriaJooqQuery.java
@@ -10,6 +10,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import static dev.struchkov.haiti.utils.Checker.checkNotEmpty;
import static org.jooq.impl.DSL.condition;
import static org.jooq.impl.DSL.field;
@@ -34,6 +35,15 @@ public class CriteriaJooqQuery {
return this;
}
+ public > CriteriaJooqQuery notBetween(String field, Y from, Y to) {
+ Inspector.isNotNull(field);
+ if (from != null && to != null) {
+ Condition condition = DSL.field(field).notBetween(from, to);
+ conditions.add(condition);
+ }
+ return this;
+ }
+
public CriteriaJooqQuery matchPhrase(String field, Object value) {
Inspector.isNotNull(field);
if (value != null) {
@@ -43,6 +53,14 @@ public class CriteriaJooqQuery {
return this;
}
+ public CriteriaJooqQuery matchPhrase(String field, Object... values) {
+ Inspector.isNotNull(field);
+ if (checkNotEmpty(values)) {
+ conditions.add(DSL.field(field).in(values));
+ }
+ return this;
+ }
+
public CriteriaJooqQuery matchPhrase(String field, Set values) {
Inspector.isNotNull(field);
if (values != null) {
@@ -55,6 +73,35 @@ public class CriteriaJooqQuery {
return this;
}
+ public CriteriaJooqQuery notMatchPhrase(String field, Object value) {
+ Inspector.isNotNull(field);
+ if (value != null) {
+ final Condition condition = condition(Map.of(field(field), value)).not();
+ conditions.add(condition);
+ }
+ return this;
+ }
+
+ public CriteriaJooqQuery notMatchPhrase(String field, Set values) {
+ Inspector.isNotNull(field);
+ if (values != null) {
+ if (values.isEmpty()) {
+ conditions.add(DSL.field(field).isNull().not());
+ } else {
+ conditions.add(DSL.field(field).in(values).not());
+ }
+ }
+ return this;
+ }
+
+ public CriteriaJooqQuery notMatchPhrase(String field, Object... values) {
+ Inspector.isNotNull(field);
+ if (checkNotEmpty(values)) {
+ conditions.add(DSL.field(field).in(values).not());
+ }
+ return this;
+ }
+
public CriteriaJooqQuery exists(String field) {
if (field != null) {
conditions.add(DSL.field(field).isNotNull());
@@ -62,6 +109,13 @@ public class CriteriaJooqQuery {
return this;
}
+ public CriteriaJooqQuery notExists(String field) {
+ if (field != null) {
+ conditions.add(DSL.field(field).isNull());
+ }
+ return this;
+ }
+
public CriteriaJooqQuery like(String field, String value) {
like(field, value, false);
return this;
@@ -72,6 +126,16 @@ public class CriteriaJooqQuery {
return this;
}
+ public CriteriaJooqQuery notLike(String field, String value) {
+ notLike(field, value, false);
+ return this;
+ }
+
+ public CriteriaJooqQuery notLikeIgnoreCase(String field, String value) {
+ notLike(field, value, true);
+ return this;
+ }
+
public CriteriaJooqQuery like(String field, String value, boolean ignoreCase) {
Inspector.isNotNull(field);
final Field