郑永安
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package com.gkhy.safePlatform.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.gkhy.safePlatform.commons.enums.E;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.exception.AusinessException;
import com.gkhy.safePlatform.commons.exception.BusinessException;
import com.gkhy.safePlatform.doublePrevention.entity.PreventProduceDevice;
import com.gkhy.safePlatform.doublePrevention.entity.statistics.DeviceEveryLevelCountDO;
import com.gkhy.safePlatform.doublePrevention.repository.PreventProduceDeviceRepository;
import com.gkhy.safePlatform.doublePrevention.repository.param.PreventProduceDeviceDeleteParams;
import com.gkhy.safePlatform.doublePrevention.repository.param.PreventProduceDeviceQueryParams;
import com.gkhy.safePlatform.doublePrevention.repository.param.PreventProduceDeviceUpdateParams;
import com.gkhy.safePlatform.doublePrevention.service.baseService.PreventProduceDeviceService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
 
/**
 * (PreventProduceDevice)表服务实现类
 *
 * @author makejava
 * @since 2022-06-25 10:40:17
 */
@Service("preventProduceDeviceService")
public class PreventProduceDeviceServiceImpl extends ServiceImpl<PreventProduceDeviceRepository, PreventProduceDevice> implements PreventProduceDeviceService {
 
    @Resource
    private PreventProduceDeviceRepository preventProduceDeviceRepository;
 
    /**
     * 生产装置-分页查询
     * */
    @Override
    public IPage<PreventProduceDevice> getDevicePage(Page<Object> page, @Param("queryParams") PreventProduceDeviceQueryParams queryParams) {
        return preventProduceDeviceRepository.getDevicePage(page, queryParams);
    }
 
    /**
     * 生产装置-根绝设备名称和所在位置查询
     * */
    @Override
    public PreventProduceDevice selectByNameAndLocation(String produceDeviceName, String location) {
 
        return selectByNameAndLocation(produceDeviceName, location);
    }
 
    /**
     * 生产装置-新增
     * */
    @Override
    public int saveDevice(PreventProduceDevice device) {
        int result = preventProduceDeviceRepository.insert(device);
        if (result == 0){
            throw new BusinessException(ResultCodes.SERVER_ADD_ERROR);
        }
        return result;
    }
 
    /**
     * 生产装置-删除
     */
    @Override
    public int deleteById(PreventProduceDeviceDeleteParams param) {
        int result = preventProduceDeviceRepository.deleteOne(param);
        if (result == 0){
            throw new BusinessException(ResultCodes.SERVER_DEL_ERROR);
        }
        return result;
    }
    /**
     * 生产装置-修改信息
     */
    @Override
    public int updateProduceDevice(PreventProduceDeviceUpdateParams updateParams) {
        int result = preventProduceDeviceRepository.updateProduceDevice(updateParams);
        if (result == 0){
            throw new BusinessException(ResultCodes.SERVER_UPDATE_ERROR);
        }
        return result;
    }
    /**
     * 生产装置-查询-通过设备名称
     */
    @Override
    public PreventProduceDevice getDeviceByName(String produceDeviceName) {
        PreventProduceDevice device = preventProduceDeviceRepository.getByDeviceName(produceDeviceName);
        return device;
    }
 
 
    /**
     * 生产装置-查询-通过设备id
     */
    @Override
    public PreventProduceDevice getDeviceById(Long id) {
        PreventProduceDevice device = preventProduceDeviceRepository.selectByDeviceId(id);
        return device;
    }
 
 
    /**
     * 生产装置-根绝风险等级查询
     * */
    @Override
    public PreventProduceDevice getByLevel(Byte riskLevel) {
 
        PreventProduceDevice byRiskLevel = preventProduceDeviceRepository.getByRiskLevel(riskLevel);
        return byRiskLevel;
    }
    /**
     * 生产装置- 查询生产装置列表
     */
    @Override
    public List<PreventProduceDevice> getListDevices() {
 
        return preventProduceDeviceRepository.getListDevices();
    }
 
    @Override
    public DeviceEveryLevelCountDO countDeviceEveryLevel() {
        return preventProduceDeviceRepository.countDeviceEveryLevel();
    }
}