郑永安
2023-09-19 69185134fcfaf913ea45f1255677225a2cc311a4
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
54
55
56
package com.gk.hotwork.doublePrevention.service.baseService.impl;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gk.hotwork.Domain.Enum.ResultCodes;
import com.gk.hotwork.Domain.Exception.BusinessException;
import com.gk.hotwork.doublePrevention.entity.PreventDangerCheckContent;
import com.gk.hotwork.doublePrevention.repository.PreventDangerCheckContentRepository;
import com.gk.hotwork.doublePrevention.service.baseService.PreventDangerCheckContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
@Service("PreventDangerCheckContentService")
public class PreventDangerCheckContentServiceImpl
        extends ServiceImpl<PreventDangerCheckContentRepository, PreventDangerCheckContent> implements PreventDangerCheckContentService {
 
    @Autowired
    private PreventDangerCheckContentRepository preventDangerCheckContentRepository;
 
    /**
     * 插入管控措施,同时插入措施对应的隐患排查内容
     * */
    @Override
    public int saveDangerCheckContent(PreventDangerCheckContent checkContent) {
        int insertResult = preventDangerCheckContentRepository.insert(checkContent);
 
        return insertResult;
    }
 
    /**
     * 查询管控措施-通过关联的措施id
     * */
    @Override
    public PreventDangerCheckContent getCheckContentByMeasureId(Long measureId) {
        return preventDangerCheckContentRepository.getCheckContentByMeasureId(measureId);
    }
 
    /**
     * 修改隐患排查内容-通过关联的措施id
     * */
    @Override
    public void updateDangerCheckContent(Long measureId, String checkContent) {
 
        int result = preventDangerCheckContentRepository.updateDangerCheckContent(measureId, checkContent);
        if (result == 0){
            throw new BusinessException(ResultCodes.SERVER_ADD_ERROR);
        }
    }
 
    /**
     * 查询任隐患排查内容-根据务关联的检查内容taskId
     * */
    @Override
    public PreventDangerCheckContent getCheckContentByTaskId(Long taskId) {
        return preventDangerCheckContentRepository.getCheckContentByTaskId(taskId);
    }
}