物联设备增加过滤条件

main
liutao 3 days ago
parent 5e95b4f61a
commit 3755fa6878

@ -30,6 +30,9 @@ public class DeviceTotalTimeRecordReqVO extends PageParam {
@Schema(description = "设备 ID 集合,使用英文逗号分隔,例如 1,2,3")
private String ids;
@Schema(description = "设备类型")
private Integer deviceType;
@Schema(description = "时间轴页码,默认 1")
private Integer timelinePageNo;

@ -600,6 +600,7 @@ public class DeviceOperationRecordServiceImpl implements DeviceOperationRecordSe
private DeviceTotalTimeRecordReqVO buildPreviousPeriodReqVO(DeviceTotalTimeRecordReqVO reqVO) {
DeviceTotalTimeRecordReqVO previousReqVO = new DeviceTotalTimeRecordReqVO();
previousReqVO.setIds(reqVO.getIds());
previousReqVO.setDeviceType(reqVO.getDeviceType());
previousReqVO.setDeviceCode(reqVO.getDeviceCode());
previousReqVO.setDeviceName(reqVO.getDeviceName());
previousReqVO.setTimelinePageNo(reqVO.getTimelinePageNo());

@ -167,6 +167,9 @@
ide.device_name AS deviceName
FROM iot_device ide
WHERE ide.deleted = 0
<if test="pageReqVO.deviceType != null">
AND ide.device_type = #{pageReqVO.deviceType}
</if>
<!-- 设备编码筛选条件 -->
<if test="pageReqVO.deviceCode != null and pageReqVO.deviceCode != ''">
AND ide.device_code LIKE CONCAT('%', #{pageReqVO.deviceCode}, '%')
@ -218,6 +221,9 @@
ide.device_name AS deviceName
FROM iot_device ide
WHERE ide.deleted = 0
<if test="deviceTotalTimeRecordReqVO.deviceType != null">
AND ide.device_type = #{deviceTotalTimeRecordReqVO.deviceType}
</if>
<!-- 设备编码筛选条件 -->
<if test="deviceTotalTimeRecordReqVO.deviceCode != null and deviceTotalTimeRecordReqVO.deviceCode != ''">
AND ide.device_code LIKE CONCAT('%', #{deviceTotalTimeRecordReqVO.deviceCode}, '%')

@ -153,9 +153,10 @@ public class DeviceLineController {
@PreAuthorize("@ss.isInnerProfile() || @ss.hasPermission('iot:device:query')")
public CommonResult<List<LineAnalysisTreeDTO.LineNode>> deviceParameterAnalysis(
@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "deviceType", required = false) Integer deviceType,
@RequestParam(value = "showDevices") Integer showDevices,
@RequestParam(value = "filterNoDeviceLine", required = false) Integer filterNoDeviceLine) {
return success(deviceLineService.deviceParameterAnalysis(keyword, showDevices, filterNoDeviceLine));
return success(deviceLineService.deviceParameterAnalysis(keyword, deviceType, showDevices, filterNoDeviceLine));
}
@GetMapping("/children")

@ -36,7 +36,8 @@ public interface DeviceLineService {
List<DeviceLineDO> getAncestorDeviceLines(Long id);
List<LineAnalysisTreeDTO.LineNode> deviceParameterAnalysis(String keyword, Integer showDevices, Integer filterNoDeviceLine);
List<LineAnalysisTreeDTO.LineNode> deviceParameterAnalysis(String keyword, Integer deviceType,
Integer showDevices, Integer filterNoDeviceLine);
void regenerateCode(Long id, String code) throws UnsupportedEncodingException;

@ -229,7 +229,8 @@ public class DeviceLineServiceImpl implements DeviceLineService {
}
@Override
public List<LineAnalysisTreeDTO.LineNode> deviceParameterAnalysis(String keyword, Integer showDevices, Integer filterNoDeviceLine) {
public List<LineAnalysisTreeDTO.LineNode> deviceParameterAnalysis(String keyword, Integer deviceType,
Integer showDevices, Integer filterNoDeviceLine) {
if (showDevices == null || (showDevices != 1 && showDevices != 2)) {
showDevices = 1;
}
@ -259,7 +260,9 @@ public class DeviceLineServiceImpl implements DeviceLineService {
Map<Long, DeviceDO> deviceMap = new HashMap<>();
Map<Long, List<DeviceContactModelDO>> paramsByDeviceId = new HashMap<>();
if (!deviceIds.isEmpty()) {
deviceMap = deviceMapper.selectBatchIds(deviceIds).stream()
deviceMap = deviceMapper.selectList(new LambdaQueryWrapper<DeviceDO>()
.in(DeviceDO::getId, deviceIds)
.eq(deviceType != null, DeviceDO::getDeviceType, deviceType)).stream()
.collect(Collectors.toMap(DeviceDO::getId, Function.identity(), (a, b) -> a));
List<DeviceContactModelDO> parameters = deviceContactModelMapper.selectList(

Loading…
Cancel
Save