package com.estate.expert.admin.domain.exam.record.warning;
|
|
import com.estate.expert.admin.domain.common.EntityBaseRepository;
|
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.repository.query.Param;
|
|
import java.time.LocalDateTime;
|
import java.util.List;
|
|
public interface WarningRecordRepository extends EntityBaseRepository<WarningRecord> {
|
|
@Query("select w from WarningRecord w where w.checkTask.id = :checkTaskId " +
|
"and (:creatorId is null or w.creator.id = :creatorId) " +
|
"and w.deleted = false " +
|
"order by w.updateTime desc")
|
Page<WarningRecord> list(@Param("checkTaskId") Integer checkTaskId,
|
@Param("creatorId") Integer creatorId,
|
Pageable pageable);
|
|
@Query("select w from WarningRecord w where w.checkTask.id = :checkTaskId " +
|
"and w.deleted = false " +
|
"order by w.updateTime desc")
|
List<WarningRecord> list(Integer checkTaskId);
|
|
@Query("select w.problem.id, count(w) from WarningRecord w " +
|
"where w.deleted = false " +
|
"and w.device is null " +
|
"and w.problem is not null " +
|
"and w.problem.id in :problemIds " +
|
"and w.checkTask.project.id = :projectId " +
|
"and w.checkTask.state in :taskStates " +
|
"group by w.problem.id")
|
List<Object[]> countSystemWarningsByProjectAndProblemIds(@Param("projectId") Integer projectId,
|
@Param("taskStates") List<com.estate.expert.admin.domain.exam.task.check.CheckTaskState> taskStates,
|
@Param("problemIds") List<Integer> problemIds);
|
|
@Query("select w from WarningRecord w where ( :clientId is null or w.checkTask.project.client.id = :clientId) " +
|
"and ( :planId is null or w.checkTask.plan.id = :planId) " +
|
"and ( :taskId is null or w.checkTask.id = :taskId) " +
|
"and ( :startDate is null or w.createTime >= :startDate) " +
|
"and ( :endDate is null or w.createTime < :endDate) " +
|
"and w.deleted = false " +
|
"order by w.updateTime desc")
|
Page<WarningRecord> list(@Param("clientId") Integer clientId,
|
@Param("planId") Integer planId,
|
@Param("taskId") Integer taskId,
|
@Param("startDate") LocalDateTime startDate,
|
@Param("endDate") LocalDateTime endDate,
|
Pageable pageable);
|
|
@Query("select w from WarningRecord w where ( :clientId is null or w.checkTask.project.client.id = :clientId) " +
|
"and ( :planId is null or w.checkTask.plan.id = :planId) " +
|
"and ( :taskId is null or w.checkTask.id = :taskId) " +
|
"and ( :startDate is null or w.createTime >= :startDate) " +
|
"and ( :endDate is null or w.createTime < :endDate) " +
|
"and w.deleted = false " +
|
"order by w.updateTime desc")
|
List<WarningRecord> list(@Param("clientId") Integer clientId,
|
@Param("planId") Integer planId,
|
@Param("taskId") Integer taskId,
|
@Param("startDate") LocalDateTime startDate,
|
@Param("endDate") LocalDateTime endDate);
|
}
|