提交 | 用户 | 时间
|
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; |
c7f709
|
5 |
import com.iailab.framework.common.pojo.PageResult; |
a6de49
|
6 |
import com.iailab.framework.common.util.object.ConvertUtils; |
H |
7 |
import com.iailab.module.data.channel.modbus.dao.ChannelModBusTagDao; |
c7f709
|
8 |
import com.iailab.module.data.channel.modbus.dto.ChannelModbusTagDTO; |
a6de49
|
9 |
import com.iailab.module.data.channel.modbus.entity.ChannelModBusTagEntity; |
H |
10 |
import com.iailab.module.data.channel.modbus.service.ChannelModbusTagService; |
c7f709
|
11 |
import com.iailab.module.data.channel.modbus.vo.ModBusTagPageReqVO; |
a6de49
|
12 |
import lombok.extern.slf4j.Slf4j; |
H |
13 |
import org.springframework.beans.factory.annotation.Value; |
|
14 |
import org.springframework.stereotype.Service; |
|
15 |
|
|
16 |
import javax.annotation.Resource; |
c7f709
|
17 |
import java.util.Date; |
a6de49
|
18 |
import java.util.List; |
H |
19 |
|
|
20 |
/** |
c7f709
|
21 |
* @author lirm |
a6de49
|
22 |
* @Description |
c7f709
|
23 |
* @createTime 2024年08月27日 |
a6de49
|
24 |
*/ |
H |
25 |
@Slf4j |
|
26 |
@Service |
|
27 |
public class ChannelModbusTagServiceImpl extends ServiceImpl<ChannelModBusTagDao, ChannelModBusTagEntity> implements ChannelModbusTagService { |
|
28 |
@Resource |
|
29 |
private ChannelModBusTagDao channelModBusTagDao; |
|
30 |
|
|
31 |
@Value("${iems.upload-dir}") |
|
32 |
private String uploadDir; |
|
33 |
|
|
34 |
@Override |
c7f709
|
35 |
public PageResult<ChannelModBusTagEntity> queryPage(ModBusTagPageReqVO reqVO) { |
L |
36 |
return channelModBusTagDao.selectPage(reqVO); |
a6de49
|
37 |
} |
H |
38 |
|
|
39 |
@Override |
|
40 |
public ChannelModBusTagEntity info(String id) { |
|
41 |
return channelModBusTagDao.selectById(id); |
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
public void add(ChannelModBusTagEntity channelModBusTagEntity) { |
|
46 |
channelModBusTagDao.insert(channelModBusTagEntity); |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
public void update(ChannelModBusTagEntity channelModBusTagEntity) { |
|
51 |
channelModBusTagDao.updateById(channelModBusTagEntity); |
|
52 |
} |
|
53 |
|
|
54 |
@Override |
|
55 |
public void delete(String id) { |
|
56 |
channelModBusTagDao.deleteById(id); |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
public List<ChannelModBusTagEntity> getByDevice(String device) { |
|
61 |
QueryWrapper<ChannelModBusTagEntity> queryWrapper = new QueryWrapper<>(); |
|
62 |
queryWrapper.eq("device", device); |
|
63 |
queryWrapper.orderByDesc("create_time"); |
|
64 |
return channelModBusTagDao.selectList(queryWrapper); |
|
65 |
} |
|
66 |
|
|
67 |
@Override |
|
68 |
public List<ChannelModbusTagDTO> selectAll() { |
|
69 |
List<ChannelModBusTagEntity> entityList = baseMapper.selectList( |
|
70 |
null |
|
71 |
); |
|
72 |
return ConvertUtils.sourceToTarget(entityList, ChannelModbusTagDTO.class); |
|
73 |
} |
|
74 |
|
|
75 |
@Override |
|
76 |
public List<ChannelModBusTagEntity> listByIds(List<String> ids) { |
|
77 |
return baseMapper.selectList(new QueryWrapper<ChannelModBusTagEntity>().in("id", ids)); |
|
78 |
} |
|
79 |
|
|
80 |
@Override |
|
81 |
public void deleteByDeviceName(String name) { |
|
82 |
baseMapper.delete(new QueryWrapper<ChannelModBusTagEntity>().eq("device", name)); |
|
83 |
} |
|
84 |
|
|
85 |
} |