This commit is contained in:
@@ -25,4 +25,16 @@ public interface ComplaintEntityRepository extends JpaRepository<ComplaintEntity
|
||||
@Transactional
|
||||
@Query("UPDATE ComplaintEntity c SET c.status = :status WHERE c.id = :id")
|
||||
int updateStatus(Long id, ComplaintStatus status);
|
||||
|
||||
@Query("SELECT COUNT(c.id) FROM ComplaintEntity c")
|
||||
Long getTotalComplaintsCount();
|
||||
|
||||
@Query("""
|
||||
SELECT COUNT(c.id)
|
||||
FROM ComplaintEntity c
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM LawCase lc WHERE lc.violationId = c.violation.id
|
||||
)
|
||||
""")
|
||||
Long getComplaintsWithoutLawCaseCount();
|
||||
}
|
||||
|
||||
@@ -39,4 +39,7 @@ public interface LawCaseRepository extends JpaRepository<LawCase, Long> {
|
||||
@Param("priority") LawCasePriority priority,
|
||||
@Param("violationId") Long violationId,
|
||||
Pageable pageable);
|
||||
|
||||
@Query("SELECT COUNT(lc.id) FROM LawCase lc")
|
||||
Long getTotalLawCasesCount();
|
||||
}
|
||||
|
||||
@@ -74,4 +74,10 @@ public interface ViolationRepository extends JpaRepository<Violation, Long> {
|
||||
List<Violation> findByFileEntityInAndStatusAndCreatedDateBetween(List<FileEntity> files, String status,
|
||||
LocalDateTime startDate, LocalDateTime endDate,
|
||||
Sort sort);
|
||||
|
||||
@Query("SELECT COUNT(v.id) FROM Violation v")
|
||||
Long getTotalViolationsCount();
|
||||
|
||||
@Query("SELECT COUNT(DISTINCT c.violation.id) FROM ComplaintEntity c WHERE c.violation IS NOT NULL")
|
||||
Long getViolationsWithComplaintCount();
|
||||
}
|
||||
Reference in New Issue
Block a user