提交 | 用户 | 时间
|
a6de49
|
1 |
package com.iailab.module.data.channel.modbus.service.impl; |
H |
2 |
|
|
3 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
4 |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
0b0cb9
|
5 |
import com.iailab.framework.common.pojo.PageResult; |
a6de49
|
6 |
import com.iailab.framework.common.util.object.ConvertUtils; |
0b0cb9
|
7 |
import com.iailab.module.data.channel.modbus.vo.ModBusDevicePageReqVO; |
a6de49
|
8 |
import com.iailab.module.data.channel.modbus.dao.ChannelModBusDeviceDao; |
H |
9 |
import com.iailab.module.data.channel.modbus.dto.ChannelModBusDeviceDTO; |
|
10 |
import com.iailab.module.data.channel.modbus.entity.ChannelModBusDeviceEntity; |
|
11 |
import com.iailab.module.data.channel.modbus.service.ChannelModbusDeviceService; |
|
12 |
import com.iailab.module.data.channel.modbus.service.ChannelModbusTagService; |
|
13 |
import org.springframework.stereotype.Service; |
|
14 |
|
|
15 |
import javax.annotation.Resource; |
|
16 |
import java.util.List; |
|
17 |
import java.util.Map; |
|
18 |
|
|
19 |
/** |
|
20 |
* @author PanZhibao |
|
21 |
* @Description |
|
22 |
* @createTime 2023年04月23日 17:45:00 |
|
23 |
*/ |
|
24 |
@Service |
|
25 |
public class ChannelModbusDeviceServiceImpl extends ServiceImpl<ChannelModBusDeviceDao, ChannelModBusDeviceEntity> implements ChannelModbusDeviceService { |
|
26 |
@Resource |
|
27 |
private ChannelModBusDeviceDao channelModBusDeviceDao; |
|
28 |
@Resource |
|
29 |
private ChannelModbusTagService channelModbusTagService; |
|
30 |
|
|
31 |
/** |
|
32 |
* 分页查询设备 |
|
33 |
* |
0b0cb9
|
34 |
* @param reqVO |
a6de49
|
35 |
*/ |
H |
36 |
@Override |
0b0cb9
|
37 |
public PageResult<ChannelModBusDeviceEntity> queryPage(ModBusDevicePageReqVO reqVO) { |
潘 |
38 |
return channelModBusDeviceDao.selectPage(reqVO); |
a6de49
|
39 |
} |
H |
40 |
|
|
41 |
/** |
|
42 |
* 列表 |
|
43 |
* |
|
44 |
* @param params |
|
45 |
* @return |
|
46 |
*/ |
|
47 |
@Override |
|
48 |
public List<ChannelModBusDeviceEntity> list(Map<String, Object> params) { |
|
49 |
return channelModBusDeviceDao.selectList(new QueryWrapper<ChannelModBusDeviceEntity>().orderByAsc("name")); |
|
50 |
} |
|
51 |
|
|
52 |
/** |
|
53 |
* 添加设备 |
|
54 |
* |
|
55 |
* @param channelModBusDeviceEntity |
|
56 |
*/ |
|
57 |
@Override |
|
58 |
public void add(ChannelModBusDeviceEntity channelModBusDeviceEntity) { |
|
59 |
|
|
60 |
channelModBusDeviceDao.insert(channelModBusDeviceEntity); |
|
61 |
|
|
62 |
} |
|
63 |
|
|
64 |
/** |
|
65 |
* 修改设备 |
|
66 |
* |
|
67 |
* @param channelModBusDeviceEntity |
|
68 |
*/ |
|
69 |
@Override |
|
70 |
public void update(ChannelModBusDeviceEntity channelModBusDeviceEntity) { |
|
71 |
|
|
72 |
channelModBusDeviceDao.updateById(channelModBusDeviceEntity); |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* 删除设备 |
|
77 |
* |
|
78 |
* @param id |
|
79 |
*/ |
|
80 |
@Override |
|
81 |
public void delete(String id) { |
|
82 |
//先删除device下的tag |
|
83 |
channelModbusTagService.deleteByDeviceName(info(id).getName()); |
|
84 |
|
|
85 |
channelModBusDeviceDao.deleteById(id); |
|
86 |
|
|
87 |
|
|
88 |
} |
|
89 |
|
|
90 |
/** |
|
91 |
* 查询设备详情 |
|
92 |
* |
|
93 |
* @param id |
|
94 |
*/ |
|
95 |
@Override |
|
96 |
public ChannelModBusDeviceEntity info(String id) { |
|
97 |
|
|
98 |
return channelModBusDeviceDao.selectById(id); |
|
99 |
} |
|
100 |
|
|
101 |
@Override |
|
102 |
public List<ChannelModBusDeviceDTO> selectAll() { |
|
103 |
|
|
104 |
List<ChannelModBusDeviceEntity> entityList = baseMapper.selectList( |
|
105 |
null); |
|
106 |
|
|
107 |
return ConvertUtils.sourceToTarget(entityList, ChannelModBusDeviceDTO.class); |
|
108 |
|
|
109 |
} |
|
110 |
} |