郑永安
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
57
58
59
60
61
62
63
64
package com.gk.hotwork.doublePrevention.service.baseService.impl;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.PreventRiskMap;
import com.gk.hotwork.doublePrevention.repository.PreventRiskMapRepository;
import com.gk.hotwork.doublePrevention.repository.param.PreventRiskMapUpdateParams;
import com.gk.hotwork.doublePrevention.service.baseService.PreventRiskMapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
@Service("PreventRiskMapService")
public class PreventRiskMapServiceImpl extends ServiceImpl<PreventRiskMapRepository, PreventRiskMap> implements PreventRiskMapService{
 
    @Autowired
    private PreventRiskMapRepository preventRiskMapRepository;
    /**
     * 风险分布图-分页查询详细信息
     */
    @Override
    public IPage<PreventRiskMap> getMapPage(Page<Object> mapPage) {
 
        return preventRiskMapRepository.getMapPage(mapPage);
    }
 
    /**
     * 风险分布图-新增
     */
    @Override
    public int saveRiskMap(PreventRiskMap riskMap) {
        int result = preventRiskMapRepository.insert(riskMap);
        if (result == 0){
            throw new BusinessException(ResultCodes.SERVER_ADD_ERROR);
        }
        return result;
    }
 
    /**
     * 风险分布图-删除
     */
    @Override
    public int deleteRiskMap(Long id) {
        int result =  preventRiskMapRepository.deleteRiskMap(id);
        if (result == 0){
            throw new BusinessException(ResultCodes.SERVER_DEL_ERROR);
        }
        return result;
    }
 
    /**
     * 风险分布图-修改
     */
    @Override
    public int updateRiskMap(PreventRiskMapUpdateParams params) {
        int result =  preventRiskMapRepository.updateRiskMap(params);
        if (result == 0){
            throw new BusinessException(ResultCodes.SERVER_UPDATE_ERROR);
        }
        return result;
    }
}