package com.estate.expert.admin.domain.exam.record;
|
|
import com.estate.expert.admin.domain.common.EntityBaseRepository;
|
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.repository.query.Param;
|
|
import java.util.List;
|
|
public interface RecordRepository extends EntityBaseRepository<Record> {
|
|
@Query("select r.problem.id, count(r) from Record r " +
|
"where r.deleted = false " +
|
"and r.device is null " +
|
"and r.problem is not null " +
|
"and r.problem.id in :problemIds " +
|
"and r.checkTask.id in :taskIds " +
|
"group by r.problem.id")
|
List<Object[]> countSystemChecksByTaskIdsAndProblemIds(@Param("taskIds") List<Integer> taskIds,
|
@Param("problemIds") List<Integer> problemIds);
|
|
@Query(value = "select r.device_id, r.problem_id, count(*) " +
|
"from record r " +
|
"where r.deleted = false " +
|
"and r.device_id is not null " +
|
"and r.problem_id is not null " +
|
"and r.check_task_id in (:taskIds) " +
|
"group by r.device_id, r.problem_id", nativeQuery = true)
|
List<Object[]> countDeviceChecksByTaskIds(@Param("taskIds") List<Integer> taskIds);
|
}
|