Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Query(value = "select resource from ResourceEntity resource "
- + "join resource.resourceFiles files "
- + "join resource.resourceLogs logs "
- + "where resource.id in ("
- + "select distinct resource.id from ResourceEntity resource "
- + "join resource.resourceFiles files "
- + "join resource.resourceLogs logs "
- + "where "
- //filtering
- + "(:name='' or LOWER(resource.name) like CONCAT('%',:name,'%')) "
- + "and (COALESCE(:types) is null or resource.type in (:types)) "
- + "and (:comment='' or LOWER(files.comment) like LOWER(CONCAT('%',:comment,'%'))) "
- + "and (:modifiedBy='' or LOWER(logs.author.firstName) like CONCAT('%',:modifiedBy,'%') or LOWER(logs.author.lastName) like CONCAT('%',:modifiedBy,'%')) "
- + "and (cast(:startDate as date) is null or logs.date between cast(:startDate as date) and cast(:endDate as date)))" )
- // + "group by (resource.id, logs.author.firstName, logs.date, files.comment)")
- Page<ResourceEntity> filter(Pageable pageable,
- @Param("name") @Nullable String name,
- @Param("types") @Nullable List<ResourceTypeEnum> types,
- @Param("comment") @Nullable String comment,
- @Param("modifiedBy") @Nullable String modifiedBy,
- @Param("startDate") @Nullable @Temporal Date modifiedOnStartDate,
- @Param("endDate") @Nullable @Temporal Date modifiedOnEndDate);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement