郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
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
48
49
50
51
52
53
package com.gkhy.safePlatform.doublePrevention.service.baseService.impl;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.safePlatform.commons.enums.E;
import com.gkhy.safePlatform.commons.exception.AusinessException;
import com.gkhy.safePlatform.doublePrevention.entity.PreventWorkAndMeasure;
import com.gkhy.safePlatform.doublePrevention.repository.PreventWorkAndMeasureRepository;
import com.gkhy.safePlatform.doublePrevention.service.baseService.PreventWorkAndMeasureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service("PreventWorkAndMeasureService")
public class PreventWorkAndMeasureServiceImpl extends ServiceImpl<PreventWorkAndMeasureRepository, PreventWorkAndMeasure> implements PreventWorkAndMeasureService {
 
    @Autowired
    private PreventWorkAndMeasureRepository preventWorkAndMeasureRepository;
 
    /**
     * 插入作业与措施的关联
     * */
    @Override
    public int insertWorkAndMeasure(PreventWorkAndMeasure workAndMeasure) {
        return preventWorkAndMeasureRepository.insert(workAndMeasure);
    }
 
    /**
     * 重置作业与措施的关联
     * */
    @Override
    public void updateWorkAndMeasure(String workUuid) {
        int i = preventWorkAndMeasureRepository.updateWorkAndMeasure(workUuid);
        if (i< 1){
            throw new AusinessException(E.UPDATE_FAIL, "重置关联关系失败");
        }
    }
 
    /**
     * 查询作业与措施关联表
     * */
    @Override
    public PreventWorkAndMeasure getWorkAndMeasure(String workUuid, String measureUuid) {
        return preventWorkAndMeasureRepository.getWorkAndMeasure(workUuid, measureUuid);
    }
    /**
     * 查询作业与措施关联表
     * */
    @Override
    public List<PreventWorkAndMeasure> getWorkAndMeasureByWorkUuid(String workUuid) {
        return preventWorkAndMeasureRepository.getWorkAndMeasureByWorkUuid(workUuid);
    }
}