zss
2023-09-21 2dbc49184bd74845c8da694c20d6fd03d7ac87e0
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
package com.yuanchu.mom.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yuanchu.mom.pojo.Device;
import com.yuanchu.mom.mapper.DeviceMapper;
import com.yuanchu.mom.pojo.dto.DeviceDto;
import com.yuanchu.mom.service.DeviceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
 
/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
 * @since 2023-07-31
 */
@Service
public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> implements DeviceService {
 
    @Resource
    private DeviceMapper deviceMapper;
 
 
    //查询设备维护-->左侧列表设备组展示
    @Override
    public List<Map<String, Object>> deviceTwoTree(Integer type, String search_class) {
        return deviceMapper.deviceTwoTree(type, search_class);
    }
 
    //查询设备维护-->右侧列表展示该设备组下的所有设备
    @Override
    public List<Map<String, Object>> selectTreeDevice(Integer type, String father, Integer deviceStatus, String message) {
        return deviceMapper.selectTreeDevice(type, father, deviceStatus, message);
    }
 
    //新增仪器设备
    @Override
    public Integer addDevice(DeviceDto deviceDto) {
        Device device = new Device();
        BeanUtils.copyProperties(deviceDto, device);
        deviceMapper.insert(device);
        return device.getId();
    }
 
    //根据分组查询设备名
    @Override
    public List<Map<String, Object>> getDeviceNameByGroup(String deviceGroup) {
        return deviceMapper.getDeviceNameByGroup(deviceGroup);
    }
 
    //查询所有设备编号和设备名称
    @Override
    public List<Map<String, Object>> selectDeviceIdAndName() {
        LambdaQueryWrapper<Device> wrapper = new LambdaQueryWrapper<>();
        wrapper.select(Device::getId, Device::getName, Device::getCode);
        return deviceMapper.selectMaps(wrapper);
    }
 
    //删除
    @Override
    public void delDeviceById(Integer id) {
        Device device = new Device();
        device.setId(id);
        device.setState(0);
        deviceMapper.updateById(device);
    }
 
    //批量删除
    @Override
    public void delAllDevice(String ids) {
        deviceMapper.delAllDevice(ids);
    }
 
    //选择检验设备
    @Override
    public List<Map<String, Object>> chooseDevice() {
        return deviceMapper.chooseDevice();
    }
 
    //新增仪器设备:设备组下拉框
    @Override
    public List<String> listGroup(Integer type) {
        return deviceMapper.listGroup(type);
    }
}