package com.iailab.module.data.channel.modbus.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.data.channel.modbus.dao.ChannelModBusTagDao; import com.iailab.module.data.channel.modbus.dto.ChannelModbusTagDTO; import com.iailab.module.data.channel.modbus.entity.ChannelModBusTagEntity; import com.iailab.module.data.channel.modbus.service.ChannelModbusTagService; import com.iailab.module.data.channel.modbus.vo.ModBusTagPageReqVO; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Date; import java.util.List; /** * @author lirm * @Description * @createTime 2024年08月27日 */ @Slf4j @Service public class ChannelModbusTagServiceImpl extends ServiceImpl implements ChannelModbusTagService { @Resource private ChannelModBusTagDao channelModBusTagDao; @Value("${iems.upload-dir}") private String uploadDir; @Override public PageResult queryPage(ModBusTagPageReqVO reqVO) { return channelModBusTagDao.selectPage(reqVO); } @Override public ChannelModBusTagEntity info(String id) { return channelModBusTagDao.selectById(id); } @Override public void add(ChannelModBusTagEntity channelModBusTagEntity) { channelModBusTagDao.insert(channelModBusTagEntity); } @Override public void update(ChannelModBusTagEntity channelModBusTagEntity) { channelModBusTagDao.updateById(channelModBusTagEntity); } @Override public void delete(String id) { channelModBusTagDao.deleteById(id); } @Override public List getByDevice(String device) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("device", device); queryWrapper.orderByDesc("create_time"); return channelModBusTagDao.selectList(queryWrapper); } @Override public List selectAll() { List entityList = baseMapper.selectList( null ); return ConvertUtils.sourceToTarget(entityList, ChannelModbusTagDTO.class); } @Override public List listByIds(List ids) { return baseMapper.selectList(new QueryWrapper().in("id", ids)); } @Override public void deleteByDeviceName(String name) { baseMapper.delete(new QueryWrapper().eq("device", name)); } }