查询站点已绑定/未绑定设备列表,气象设备实时数据接口返回格式调整等

This commit is contained in:
mi9688
2024-12-03 17:38:57 +08:00
parent 6c835034cd
commit 79cdd499f7
11 changed files with 125 additions and 43 deletions

View File

@ -0,0 +1,11 @@
package com.fastbee.ggroup.domain.vo;
import lombok.Data;
@Data
public class GSiteDeviceVo {
private Long deviceId;//设备id
private String deviceName ;//设备名称
private Long siteId ;//站点id
}

View File

@ -3,6 +3,7 @@ package com.fastbee.ggroup.service;
import java.util.List;
import com.fastbee.ggroup.domain.GSiteDevice;
import com.fastbee.ggroup.domain.dto.GSiteDeviceDto;
import com.fastbee.ggroup.domain.vo.GSiteDeviceVo;
import com.fastbee.iot.domain.Device;
/**
@ -18,7 +19,14 @@ public interface IGSiteDeviceService
/**
* 查询站点未关联的设备列表
*/
public List<GSiteDevice> selectUnbindDeviceList(Long siteId);
public List<GSiteDeviceVo> selectUnbindDeviceList(Long siteId,Long groupId);
/**
* 查询站点已关联设备列表
* @param siteId 站点设备关系主键
*/
public List<GSiteDeviceVo> selectBindDeviceList(Long siteId,Long groupId);
/**
* 查询站点设备关系
@ -68,12 +76,6 @@ public interface IGSiteDeviceService
*/
public int deleteGSiteDeviceById(Long id);
/**
* 查询站点设备已经关联关系信息
*
* @param id 站点设备关系主键
* @return 结果
*/
public List<GSiteDeviceDto> getGSiteDeviceByDevice(Long id);
}

View File

@ -3,11 +3,15 @@ package com.fastbee.ggroup.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.fastbee.ggroup.domain.GSites;
import com.fastbee.ggroup.domain.dto.GSiteDeviceDto;
import com.fastbee.ggroup.domain.vo.GSiteDeviceVo;
import com.fastbee.ggroup.mapper.GSitesMapper;
import com.fastbee.iot.domain.Device;
import com.fastbee.iot.domain.Group;
import com.fastbee.iot.mapper.DeviceMapper;
import com.fastbee.iot.mapper.GroupMapper;
import com.github.yulichang.query.MPJLambdaQueryWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.springframework.beans.factory.annotation.Autowired;
@ -34,26 +38,42 @@ public class GSiteDeviceServiceImpl implements IGSiteDeviceService
@Autowired
private DeviceMapper deviceMapper;
@Autowired
private GroupMapper groupMapper;
/**
* 查询设备
* @param siteId
* @return
* 查询站点未关联的设备列表
* @param siteId 站点id
*/
@Override
public List<GSiteDevice> selectUnbindDeviceList(Long siteId) {
MPJLambdaWrapper<Device> objectMPJLambdaWrapper = new MPJLambdaWrapper<Device>()
.select(Device::getDeviceId, Device::getDeviceName)
public List<GSiteDeviceVo> selectUnbindDeviceList(Long siteId,Long groupId) {
MPJLambdaWrapper<GSiteDevice> objectMPJLambdaWrapper = new MPJLambdaWrapper<GSiteDevice>()
.select(GSiteDevice::getSiteId, GSiteDevice::getDeviceId)
.leftJoin(GSites.class, GSites::getId, GSiteDevice::getSiteId);
List<GSiteDevice> gSiteDevices = deviceMapper.selectJoinList(GSiteDevice.class, objectMPJLambdaWrapper);
.select(Device::getDeviceId, Device::getDeviceName)
.leftJoin(Device.class, Device::getDeviceId, GSiteDevice::getDeviceId)
.ne(GSiteDevice::getSiteId, siteId);
return gSiteDeviceMapper.selectJoinList(GSiteDeviceVo.class, objectMPJLambdaWrapper);
}
return gSiteDevices;
/**
* 查询站点已关联设备列表
* @param siteId 站点设备关系主键
*/
@Override
public List<GSiteDeviceVo> selectBindDeviceList(Long siteId,Long groupId){
MPJLambdaWrapper<GSiteDevice> objectMPJLambdaWrapper = new MPJLambdaWrapper<GSiteDevice>()
.select(GSiteDevice::getSiteId, GSiteDevice::getDeviceId)
.select(Device::getDeviceId, Device::getDeviceName)
.leftJoin(Device.class, Device::getDeviceId, GSiteDevice::getDeviceId)
.eq(GSiteDevice::getSiteId, siteId);
List<GSiteDeviceVo> gSiteDeviceVos = gSiteDeviceMapper.selectJoinList(GSiteDeviceVo.class, objectMPJLambdaWrapper);
List<Group> groups = new LambdaQueryChainWrapper<>(groupMapper).select(Group::getGroupId,Group::getGroupName).list();
return gSiteDeviceVos;
}
/**
* 查询站点设备关系
*
* @param id 站点设备关系主键
* @return 站点设备关系
*/
@ -123,15 +143,5 @@ public class GSiteDeviceServiceImpl implements IGSiteDeviceService
return gSiteDeviceMapper.deleteGSiteDeviceById(id);
}
/**
* 查询站点设备已经关联关系信息
*
* @param id 站点设备关系主键
* @return 结果
*/
@Override
public List<GSiteDeviceDto> getGSiteDeviceByDevice(Long id){
return null;
}
}