dengzedong
2024-10-14 3e18d4bfbf2c657b08b21512c2d884cc9d59df7b
提交 | 用户 | 时间
a6de49 1 package com.iailab.module.data.channel.opcua.service.impl;
H 2
3 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 import com.baomidou.mybatisplus.core.metadata.IPage;
5 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
6 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
aecc49 7 import com.iailab.framework.common.pojo.PageResult;
a6de49 8 import com.iailab.framework.common.util.object.ConvertUtils;
aecc49 9 import com.iailab.module.data.channel.opcda.entity.ChannelOPCDADeviceEntity;
L 10 import com.iailab.module.data.channel.opcda.vo.OpcDaDevicePageReqVO;
11 import com.iailab.module.data.channel.opcua.vo.OpcUaDevicePageReqVO;
a6de49 12 import com.iailab.module.data.common.utils.PageUtils;
H 13 import com.iailab.module.data.common.utils.Query;
14 import com.iailab.module.data.channel.opcua.dao.ChannelOPCUADeviceDao;
15 import com.iailab.module.data.channel.opcua.entity.ChannelOPCUADeviceEntity;
16 import com.iailab.module.data.channel.opcua.service.ChannelOPCUADeviceService;
17 import com.iailab.module.data.channel.opcua.service.ChannelOPCUATagService;
18 import com.iailab.module.data.channel.opcua.dto.ChannelOPCUADeviceDTO;
19 import javax.annotation.Resource;
20 import org.springframework.stereotype.Service;
21
22 import java.util.List;
23 import java.util.Map;
24
25 /**
aecc49 26  * @author lirm
a6de49 27  * @Description
aecc49 28  * @createTime 2024年08月26日
a6de49 29  */
H 30 @Service
31 public class ChannelOPCUADeviceServiceImpl extends ServiceImpl<ChannelOPCUADeviceDao, ChannelOPCUADeviceEntity> implements ChannelOPCUADeviceService {
32     @Resource
33     private ChannelOPCUADeviceDao channelOPCUADeviceDao;
34
35     @Resource
36     private ChannelOPCUATagService channelOPCUATagService;
37
aecc49 38     @Override
L 39     public PageResult<ChannelOPCUADeviceEntity> queryPage(OpcUaDevicePageReqVO reqVO) {
40         return channelOPCUADeviceDao.selectPage(reqVO);
a6de49 41     }
H 42
43     @Override
44     public ChannelOPCUADeviceEntity info(String id) {
45         return channelOPCUADeviceDao.selectById(id);
46     }
47
48     @Override
49     public void add(ChannelOPCUADeviceEntity channelOPCUADeviceEntity) {
50         channelOPCUADeviceDao.insert(channelOPCUADeviceEntity);
51     }
52
53     @Override
54     public void update(ChannelOPCUADeviceEntity channelOPCUADeviceEntity) {
55         channelOPCUADeviceDao.updateById(channelOPCUADeviceEntity);
56     }
57
58     @Override
59     public void delete(String id) {
60
61         //先删除device下的tag
62         channelOPCUATagService.deleteByDeviceName(info(id).getServerName());
63
64         channelOPCUADeviceDao.deleteById(id);
65     }
66
67     @Override
68     public List<ChannelOPCUADeviceDTO> selectAll() {
69
70         List<ChannelOPCUADeviceEntity> entityList = baseMapper.selectList(
71                 null
72         );
73         return ConvertUtils.sourceToTarget(entityList, ChannelOPCUADeviceDTO.class);
74     }
aecc49 75
L 76     @Override
77     public List<ChannelOPCUADeviceEntity> list(Map<String, Object> params) {
78         return channelOPCUADeviceDao.selectList(new QueryWrapper<ChannelOPCUADeviceEntity>().orderByAsc("server_name"));
79     }
a6de49 80 }