#2847 - Add support for Sub-query EQ, NE, LT, LE, GT, GE expressions

This commit is contained in:
Rob Bygrave
2022-11-03 00:22:48 +13:00
parent 6f5e144a93
commit 0a61852711
18 changed files with 373 additions and 62 deletions
@@ -1,6 +1,8 @@
package io.ebean.typequery;
import io.ebean.Query;
/**
* Base property for all comparable types.
*
@@ -301,4 +303,47 @@ public class PBaseCompareable<R, T> extends PBaseValueEqual<R, T> {
return _root;
}
/**
* Property is Less Than or Equal To the result of a sub-query.
*
* @param subQuery value provided by a subQuery
* @return the root query bean instance
*/
public final R le(Query<?> subQuery) {
expr().le(_name, subQuery);
return _root;
}
/**
* Property is Less Than the result of a sub-query.
*
* @param subQuery value provided by a subQuery
* @return the root query bean instance
*/
public final R lt(Query<?> subQuery) {
expr().lt(_name, subQuery);
return _root;
}
/**
* Property is Greater Than or Equal To the result of a sub-query.
*
* @param subQuery value provided by a subQuery
* @return the root query bean instance
*/
public final R ge(Query<?> subQuery) {
expr().ge(_name, subQuery);
return _root;
}
/**
* Property is Greater Than the result of a sub-query.
*
* @param subQuery value provided by a subQuery
* @return the root query bean instance
*/
public final R gt(Query<?> subQuery) {
expr().gt(_name, subQuery);
return _root;
}
}
@@ -281,7 +281,7 @@ public abstract class PBaseValueEqual<R, T> extends TQPropertyBase<R> {
}
/**
* Is in the result of a subquery. Synonym for in().
* Is in the result of a sub-query. Synonym for in().
*
* @param subQuery values provided by a subQuery
* @return the root query bean instance
@@ -291,7 +291,7 @@ public abstract class PBaseValueEqual<R, T> extends TQPropertyBase<R> {
}
/**
* Is NOT in the result of a subquery.
* Is NOT in the result of a sub-query.
*
* @param subQuery values provided by a subQuery
* @return the root query bean instance
@@ -300,4 +300,26 @@ public abstract class PBaseValueEqual<R, T> extends TQPropertyBase<R> {
expr().notIn(_name, subQuery);
return _root;
}
/**
* Property is equal to the result of a sub-query.
*
* @param subQuery value provided by a subQuery
* @return the root query bean instance
*/
public final R eq(Query<?> subQuery) {
expr().eq(_name, subQuery);
return _root;
}
/**
* Property is not equal to the result of a sub-query.
*
* @param subQuery value provided by a subQuery
* @return the root query bean instance
*/
public final R ne(Query<?> subQuery) {
expr().ne(_name, subQuery);
return _root;
}
}