You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
1.4 KiB
27 lines
1.4 KiB
package app.repositories;
|
|
|
|
import app.entities.report.Report;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.data.jpa.repository.Query;
|
|
import org.springframework.data.repository.PagingAndSortingRepository;
|
|
import org.springframework.data.repository.query.Param;
|
|
|
|
public interface ReportRepository extends PagingAndSortingRepository<Report, Long> {
|
|
@Query(value = "select r from Report r where " +
|
|
"(:authors_ne = true or position(r.a_steam2 in :authors) > 0) and " +
|
|
"(:reportes_ne = true or position(r.r_steam2 in :reportes) > 0) and " +
|
|
"(:begin_date is null or r.utime >= :begin_date) and " +
|
|
"(:end_date is null or :end_date >= r.utime) and " +
|
|
"(:server_id is null or r.srv like :server_id) order by r.id desc"
|
|
)
|
|
Page<Report> getReports(Pageable pageable,
|
|
@Param("authors_ne") boolean authors_ne,//a
|
|
@Param("authors") String authors,
|
|
@Param("reportes_ne") boolean reportes_ne,//r
|
|
@Param("reportes") String reportes,
|
|
//
|
|
@Param("server_id") String server_id,
|
|
@Param(value = "begin_date") Long begin_date,
|
|
@Param(value = "end_date") Long end_date);
|
|
}
|
|
|