mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
Merge branch 'feature/CTLE-207-query-joins' into integration/sprint-25
# Conflicts: # qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/actions/tables/query/QueryInput.java # qqq-middleware-api/src/main/java/com/kingsrook/qqq/api/javalin/QJavalinApiHandler.java
This commit is contained in:
@ -788,6 +788,7 @@ public class QJavalinImplementation
|
||||
}
|
||||
|
||||
countInput.setQueryJoins(processQueryJoinsParam(context));
|
||||
countInput.setIncludeDistinctCount(QJavalinUtils.queryParamIsTrue(context, "includeDistinct"));
|
||||
|
||||
CountAction countAction = new CountAction();
|
||||
CountOutput countOutput = countAction.execute(countInput);
|
||||
@ -842,8 +843,6 @@ public class QJavalinImplementation
|
||||
queryInput.setTableName(table);
|
||||
queryInput.setShouldGenerateDisplayValues(true);
|
||||
queryInput.setShouldTranslatePossibleValues(true);
|
||||
queryInput.setSkip(QJavalinUtils.integerQueryParam(context, "skip"));
|
||||
queryInput.setLimit(QJavalinUtils.integerQueryParam(context, "limit"));
|
||||
|
||||
PermissionsHelper.checkTablePermissionThrowing(queryInput, TablePermissionSubType.READ);
|
||||
|
||||
@ -857,6 +856,18 @@ public class QJavalinImplementation
|
||||
queryInput.setFilter(JsonUtils.toObject(filter, QQueryFilter.class));
|
||||
}
|
||||
|
||||
Integer skip = QJavalinUtils.integerQueryParam(context, "skip");
|
||||
Integer limit = QJavalinUtils.integerQueryParam(context, "limit");
|
||||
if(skip != null || limit != null)
|
||||
{
|
||||
if(queryInput.getFilter() == null)
|
||||
{
|
||||
queryInput.setFilter(new QQueryFilter());
|
||||
}
|
||||
queryInput.getFilter().setSkip(skip);
|
||||
queryInput.getFilter().setLimit(limit);
|
||||
}
|
||||
|
||||
queryInput.setQueryJoins(processQueryJoinsParam(context));
|
||||
|
||||
QueryAction queryAction = new QueryAction();
|
||||
|
@ -254,8 +254,7 @@ public class QJavalinScriptsHandler
|
||||
queryInput.setFilter(new QQueryFilter()
|
||||
.withCriteria(new QFilterCriteria("scriptRevisionId", QCriteriaOperator.EQUALS, List.of(scriptRevisionId)))
|
||||
.withOrderBy(new QFilterOrderBy("id", false))
|
||||
);
|
||||
queryInput.setLimit(100);
|
||||
.withLimit(100));
|
||||
QueryOutput queryOutput = new QueryAction().execute(queryInput);
|
||||
|
||||
if(CollectionUtils.nullSafeHasContents(queryOutput.getRecords()))
|
||||
|
@ -22,6 +22,7 @@
|
||||
package com.kingsrook.qqq.backend.javalin;
|
||||
|
||||
|
||||
import java.util.Objects;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QValueException;
|
||||
import com.kingsrook.qqq.backend.core.utils.StringUtils;
|
||||
import com.kingsrook.qqq.backend.core.utils.ValueUtils;
|
||||
@ -52,6 +53,23 @@ public class QJavalinUtils
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Returns true iff context has a valid query parameter by the given name, with
|
||||
** a value of "true".
|
||||
*******************************************************************************/
|
||||
public static boolean queryParamIsTrue(Context context, String name) throws QValueException
|
||||
{
|
||||
String value = context.queryParam(name);
|
||||
if(Objects.equals(value, "true"))
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Returns Integer if context has a valid int form parameter by the given name,
|
||||
** Returns null if no param (or empty value).
|
||||
|
Reference in New Issue
Block a user