From ee4077d88a783cf05965c042bd33ed2ac77b5cff Mon Sep 17 00:00:00 2001 From: grabdoc Date: Tue, 19 Dec 2023 22:49:44 -0600 Subject: [PATCH] working #25 --- .../handler/LessThanOperatorHandler.java | 1 + .../jooq/JooqLessThanOperatorHandler.java | 21 +++++++++++++++++++ .../jooq/JooqRSQLOperatorHandlers.java | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/homihq/db2rest/rsql/operators/handler/jooq/JooqLessThanOperatorHandler.java diff --git a/src/main/java/com/homihq/db2rest/rsql/operators/handler/LessThanOperatorHandler.java b/src/main/java/com/homihq/db2rest/rsql/operators/handler/LessThanOperatorHandler.java index 013b3dff..28528318 100644 --- a/src/main/java/com/homihq/db2rest/rsql/operators/handler/LessThanOperatorHandler.java +++ b/src/main/java/com/homihq/db2rest/rsql/operators/handler/LessThanOperatorHandler.java @@ -1,5 +1,6 @@ package com.homihq.db2rest.rsql.operators.handler; +@Deprecated public class LessThanOperatorHandler implements OperatorHandler { private static final String OPERATOR = " < "; diff --git a/src/main/java/com/homihq/db2rest/rsql/operators/handler/jooq/JooqLessThanOperatorHandler.java b/src/main/java/com/homihq/db2rest/rsql/operators/handler/jooq/JooqLessThanOperatorHandler.java new file mode 100644 index 00000000..2735dff3 --- /dev/null +++ b/src/main/java/com/homihq/db2rest/rsql/operators/handler/jooq/JooqLessThanOperatorHandler.java @@ -0,0 +1,21 @@ +package com.homihq.db2rest.rsql.operators.handler.jooq; + +import com.homihq.db2rest.rsql.operators.handler.OperatorHandler; +import org.jooq.Condition; + +import static org.jooq.impl.DSL.field; +import static org.jooq.impl.DSL.val; + +public class JooqLessThanOperatorHandler implements JooqOperatorHandler { + + private static final String OPERATOR = " < "; + + @Override + public Condition handle(String columnName, String value, Class type) { + // return columnName + OPERATOR + parseValue(value, type); + + return + field(columnName).lt(val(value)); + } + +} diff --git a/src/main/java/com/homihq/db2rest/rsql/operators/handler/jooq/JooqRSQLOperatorHandlers.java b/src/main/java/com/homihq/db2rest/rsql/operators/handler/jooq/JooqRSQLOperatorHandlers.java index aa96c103..ddc37e15 100644 --- a/src/main/java/com/homihq/db2rest/rsql/operators/handler/jooq/JooqRSQLOperatorHandlers.java +++ b/src/main/java/com/homihq/db2rest/rsql/operators/handler/jooq/JooqRSQLOperatorHandlers.java @@ -2,7 +2,6 @@ - import java.util.HashMap; import java.util.Map; @@ -16,6 +15,7 @@ public class JooqRSQLOperatorHandlers { OPERATOR_HANDLER_MAP.put(EQUAL.getSymbol(), new JooqEqualToOperatorHandler()); OPERATOR_HANDLER_MAP.put(GREATER_THAN.getSymbol(), new JooqGreaterThanOperatorHandler()); OPERATOR_HANDLER_MAP.put(GREATER_THAN_OR_EQUAL.getSymbol(), new JooqGreaterThanEqualToOperatorHandler()); + OPERATOR_HANDLER_MAP.put(LESS_THAN.getSymbol(), new JooqLessThanOperatorHandler()); } public static JooqOperatorHandler getOperatorHandler(String symbol) {