Advertisement
Guest User

Untitled

a guest
Dec 21st, 2020
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1.     @Query(value = "select resource from ResourceEntity resource "
  2.             + "join resource.resourceFiles files "
  3.             + "join resource.resourceLogs logs "
  4.             + "where "
  5.             //filtering
  6.             + "(:name='' or LOWER(resource.name) like CONCAT('%',:name,'%')) "
  7.             + "and (COALESCE(:types) is null or resource.type in (:types)) "
  8.             + "and (:comment='' or LOWER(files.comment) like LOWER(CONCAT('%',:comment,'%'))) "
  9.             + "and (:modifiedBy='' or LOWER(logs.author.firstName) like CONCAT('%',:modifiedBy,'%')  or LOWER(logs.author.lastName) like CONCAT('%',:modifiedBy,'%')) "
  10.             + "and (cast(:startDate as date) is null or logs.date between cast(:startDate as date) and cast(:endDate as date)) ")
  11.     Page<ResourceEntity> filter(Pageable pageable,
  12.                                 @Param("name") @Nullable String name,
  13.                                 @Param("types") @Nullable List<ResourceTypeEnum> types,
  14.                                 @Param("comment") @Nullable String comment,
  15.                                 @Param("modifiedBy") @Nullable String modifiedBy,
  16.                                 @Param("startDate") @Nullable @Temporal Date modifiedOnStartDate,
  17.                                 @Param("endDate") @Nullable @Temporal Date modifiedOnEndDate);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement