This commit is contained in:
insanity 2017-08-25 11:47:40 +09:00
parent a0ee8e6d95
commit 28b75b1568
2 changed files with 9 additions and 0 deletions

View File

@ -24,4 +24,7 @@ public interface HistoryDAO extends JpaRepository<History, Long> {
Page<History> findAllByProbeAndType(@Param("probe") Probe probe, @Param("type") MetaHistoryType type, Pageable pageable);
Page<History> findAllByDomain(@Param("domain") Domain domain, Pageable pageRequest);
@Query("SELECT h FROM History h WHERE h.domain.id = :#{#domain.id} and h.type.id = :#{#type.id}")
Page<History> findAllByDomainAndType(@Param("domain") Domain domain, @Param("type") MetaHistoryType type, Pageable pageRequest);
}

View File

@ -44,4 +44,10 @@ public class HistoryService {
new PageRequest(pageNo, countPerPage, new Sort(Sort.Direction.DESC, "id"));
return this.historyDAO.findAllByDomain(domain, pageRequest);
}
public Page<History> readAllByDomainAndType(Domain domain, MetaHistoryType type, int pageNo, int countPerPage) {
Pageable pageRequest =
new PageRequest(pageNo, countPerPage, new Sort(Sort.Direction.DESC, "id"));
return this.historyDAO.findAllByDomainAndType(domain, type, pageRequest);
}
}