package com.iailab.module.data.channel.opcda.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
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.opcda.dao.ChannelOPCDADeviceDao;
|
import com.iailab.module.data.channel.opcda.dto.ChannelOPCDADeviceDTO;
|
import com.iailab.module.data.channel.opcda.entity.ChannelOPCDADeviceEntity;
|
import com.iailab.module.data.channel.opcda.service.ChannelOPCDADeviceService;
|
import com.iailab.module.data.channel.opcda.service.ChannelOPCDATagService;
|
import com.iailab.module.data.channel.opcda.vo.OpcDaDevicePageReqVO;
|
import com.iailab.module.data.common.utils.PageUtils;
|
import com.iailab.module.data.common.utils.Query;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* @author lirm
|
* @Description
|
* @createTime 2024年08月26日
|
*/
|
@Service
|
public class ChannelOPCDADeviceServiceImpl extends ServiceImpl<ChannelOPCDADeviceDao, ChannelOPCDADeviceEntity> implements ChannelOPCDADeviceService {
|
@Resource
|
private ChannelOPCDADeviceDao channelOPCDADeviceDao;
|
|
@Autowired
|
private ChannelOPCDATagService channelOPCDATagService;
|
|
@Override
|
public PageResult<ChannelOPCDADeviceEntity> queryPage(OpcDaDevicePageReqVO reqVO) {
|
return channelOPCDADeviceDao.selectPage(reqVO);
|
}
|
|
@Override
|
public List<ChannelOPCDADeviceEntity> list(Map<String, Object> params) {
|
QueryWrapper<ChannelOPCDADeviceEntity> queryWrapper = new QueryWrapper<>();
|
queryWrapper.orderByDesc("create_time");
|
return channelOPCDADeviceDao.selectList(queryWrapper);
|
}
|
|
@Override
|
public ChannelOPCDADeviceEntity info(String id) {
|
return channelOPCDADeviceDao.selectById(id);
|
}
|
|
@Override
|
public void add(ChannelOPCDADeviceEntity channelOPCDADeviceEntity) {
|
channelOPCDADeviceDao.insert(channelOPCDADeviceEntity);
|
}
|
|
@Override
|
public void update(ChannelOPCDADeviceEntity channelOPCDADeviceEntity) {
|
channelOPCDADeviceDao.updateById(channelOPCDADeviceEntity);
|
}
|
|
@Override
|
public void delete(String id) {
|
|
//先删除device下的tag
|
channelOPCDATagService.deleteByServerId(id);
|
|
channelOPCDADeviceDao.deleteById(id);
|
}
|
|
@Override
|
public List<ChannelOPCDADeviceDTO> selectAll() {
|
|
List<ChannelOPCDADeviceEntity> entityList = baseMapper.selectList(
|
null
|
);
|
return ConvertUtils.sourceToTarget(entityList, ChannelOPCDADeviceDTO.class);
|
}
|
}
|