郑永安
2023-06-19 9d488beac4ff8bdb47f90e2ddd5fd9d907371797
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.gkhy.labRiskManage.domain.riskReport.repository.jpa;
 
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlanEvaluateLec;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
 
import java.util.List;
 
/**
 * 评价方法LEC
 */
@Repository
public interface RiskAssessPlanEvaluateLecRepository extends JpaRepository<RiskAssessPlanEvaluateLec, Long>, JpaSpecificationExecutor<RiskAssessPlanEvaluateLec> {
 
    /**
     * 评价方法LEC 查询 - by id
     */
    @Query(value = "select t from RiskAssessPlanEvaluateLec t where t.id = :id and t.deleteStatus = 0")
    RiskAssessPlanEvaluateLec getLecById(Long id);
    /**
     * 评价方法LEC 删除 - by id
     */
    @Query(value = "update RiskAssessPlanEvaluateLec set delete_status = 1 where id = :id and delete_status = 0", nativeQuery = true)
    RiskAssessPlanEvaluateLec deleteLecByPlanId(Long id);
    /**
     * 评价方法LEC  查询 by 辨识方法
     */
    @Query(value = "select t from RiskAssessPlanEvaluateLec t where t.identificationId = :identificationId and t.identificationMethod = :identificationMethod and t.deleteStatus = 0")
    RiskAssessPlanEvaluateLec getLecByIdentification(Long identificationId, Byte identificationMethod);
    /**
     * 评价方法LEC - list
     */
    @Query(value = "select t from RiskAssessPlanEvaluateLec t where t.assessPlanId = :id and t.deleteStatus = 0")
    List<RiskAssessPlanEvaluateLec> listLecByPlanId(Long id);
 
//    select t from BasicRiskUnit t where t.id in (?1) and t.deleteStatus = 0
    @Query(value = "select t from RiskAssessPlanEvaluateLec t where t.assessPlanId in(?1) and t.deleteStatus = 0")
    List<RiskAssessPlanEvaluateLec> getLecByIds(List<Long> assessPlanIds);
 
    @Query(value = "select t from RiskAssessPlanEvaluateLec t where t.assessPlanId = :assessPlanId and t.deleteStatus = 0")
    List<RiskAssessPlanEvaluateLec> getbyByAssessPlanId(Long assessPlanId);
 
    @Query(value = "select t from RiskAssessPlanEvaluateLec t where t.assessPlanId = :id and t.deleteStatus = 0")
    List<RiskAssessPlanEvaluateLec>  getLecByPlanId(Long id);
}