mirror of
https://github.com/dalbodeule/snap-admin.git
synced 2025-06-08 21:38:21 +00:00
Changed search query to also exact match primary key
This commit is contained in:
parent
c17d80514a
commit
3ee6497d09
@ -87,11 +87,13 @@ public class CustomJpaRepository extends SimpleJpaRepository {
|
|||||||
|
|
||||||
query.select(root)
|
query.select(root)
|
||||||
.where(
|
.where(
|
||||||
cb.and(
|
cb.or(
|
||||||
finalPredicates.toArray(new Predicate[finalPredicates.size()]) // query search on String fields
|
cb.and(finalPredicates.toArray(new Predicate[finalPredicates.size()])), // query search on String fields
|
||||||
|
cb.equal(root.get(schema.getPrimaryKey().getName()), q)
|
||||||
)
|
)
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (sortKey != null)
|
if (sortKey != null)
|
||||||
query.orderBy(sortOrder.equals("DESC") ? cb.desc(root.get(sortKey)) : cb.asc(root.get(sortKey)));
|
query.orderBy(sortOrder.equals("DESC") ? cb.desc(root.get(sortKey)) : cb.asc(root.get(sortKey)));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user