From 2f81a15a1614d3618d44d67eb2d8a7c27b676235 Mon Sep 17 00:00:00 2001 From: Andrej Petras Date: Thu, 7 Mar 2024 09:20:37 +0100 Subject: [PATCH] feat: fix permission seaerch criteria --- .../permission/domain/criteria/PermissionSearchCriteria.java | 3 +++ .../org/tkit/onecx/permission/domain/daos/PermissionDAO.java | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/org/tkit/onecx/permission/domain/criteria/PermissionSearchCriteria.java b/src/main/java/org/tkit/onecx/permission/domain/criteria/PermissionSearchCriteria.java index c6e2c2c..7f1e433 100644 --- a/src/main/java/org/tkit/onecx/permission/domain/criteria/PermissionSearchCriteria.java +++ b/src/main/java/org/tkit/onecx/permission/domain/criteria/PermissionSearchCriteria.java @@ -1,5 +1,7 @@ package org.tkit.onecx.permission.domain.criteria; +import java.util.Set; + import lombok.Getter; import lombok.Setter; @@ -8,6 +10,7 @@ public class PermissionSearchCriteria { private String appId; + private Set productNames; private Integer pageNumber = 0; private Integer pageSize = 100; } diff --git a/src/main/java/org/tkit/onecx/permission/domain/daos/PermissionDAO.java b/src/main/java/org/tkit/onecx/permission/domain/daos/PermissionDAO.java index a9daae0..96f8f95 100644 --- a/src/main/java/org/tkit/onecx/permission/domain/daos/PermissionDAO.java +++ b/src/main/java/org/tkit/onecx/permission/domain/daos/PermissionDAO.java @@ -31,6 +31,11 @@ public PageResult findByCriteria(PermissionSearchCriteria criteria) List predicates = new ArrayList<>(); addSearchStringPredicate(predicates, cb, root.get(Permission_.appId), criteria.getAppId()); + + if (criteria.getProductNames() != null) { + predicates.add(root.get(Permission_.PRODUCT_NAME).in(criteria.getProductNames())); + } + if (!predicates.isEmpty()) { cq.where(predicates.toArray(new Predicate[] {})); }