Skip to content

Commit

Permalink
feat: fix permission seaerch criteria
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejpetras committed Mar 7, 2024
1 parent f6ca445 commit 2f81a15
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.tkit.onecx.permission.domain.criteria;

import java.util.Set;

import lombok.Getter;
import lombok.Setter;

Expand All @@ -8,6 +10,7 @@
public class PermissionSearchCriteria {

private String appId;
private Set<String> productNames;
private Integer pageNumber = 0;
private Integer pageSize = 100;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public PageResult<Permission> findByCriteria(PermissionSearchCriteria criteria)

List<Predicate> 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[] {}));
}
Expand Down

0 comments on commit 2f81a15

Please sign in to comment.