“mitao”
2026-03-25 8f30811c233b02eb692107c03befaef8a55ca45a
feat:报告导出
1个文件已添加
29 ■■■■■ 已修改文件
admin-server/src/main/java/com/estate/expert/admin/domain/exam/record/RecordRepository.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-server/src/main/java/com/estate/expert/admin/domain/exam/record/RecordRepository.java
New file
@@ -0,0 +1,29 @@
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);
}