fix:历史记录查询增加点位查询筛选条件

main
HuangHuiKang 4 days ago
parent a64d96fb78
commit 16bcd26bbe

@ -231,10 +231,11 @@ public class DeviceController {
public CommonResult<PageResult<Map<String, Object>>> historyRecord(@RequestParam("deviceId") Long deviceId, public CommonResult<PageResult<Map<String, Object>>> historyRecord(@RequestParam("deviceId") Long deviceId,
@RequestParam(name = "collectionStartTime", required = false) String collectionStartTime, @RequestParam(name = "collectionStartTime", required = false) String collectionStartTime,
@RequestParam(name = "collectionEndTime", required = false) String collectionEndTime, @RequestParam(name = "collectionEndTime", required = false) String collectionEndTime,
@RequestParam(name = "attributeCodes", required = false)List<String> attributeCodes,
@RequestParam(name = "pageNo", required = false, defaultValue = "1") Integer page, @RequestParam(name = "pageNo", required = false, defaultValue = "1") Integer page,
@RequestParam(name = "pageSize", required = false, defaultValue = "10") Integer pageSize @RequestParam(name = "pageSize", required = false, defaultValue = "10") Integer pageSize
) throws JsonProcessingException { ) throws JsonProcessingException {
PageResult<Map<String, Object>> deviceContactModelDO=deviceService.historyRecord(deviceId,collectionStartTime,collectionEndTime,page,pageSize); PageResult<Map<String, Object>> deviceContactModelDO=deviceService.historyRecord(deviceId,collectionStartTime,collectionEndTime,attributeCodes,page,pageSize);
return success(deviceContactModelDO); return success(deviceContactModelDO);
} }

@ -124,7 +124,7 @@ public interface DeviceService {
Map<String, List<Map<String, Object>>> singleDevice(Long deviceId) throws JsonProcessingException; Map<String, List<Map<String, Object>>> singleDevice(Long deviceId) throws JsonProcessingException;
PageResult<Map<String, Object>> historyRecord(Long deviceId,String collectionStartTime, String collectionEndTime,Integer page,Integer size); PageResult<Map<String, Object>> historyRecord(Long deviceId,String collectionStartTime, String collectionEndTime,List<String> attributeCodes,Integer page,Integer size);
Map<Long, Map<String, Object>> createDeviceDataMap(Long deviceId); Map<Long, Map<String, Object>> createDeviceDataMap(Long deviceId);

@ -949,6 +949,7 @@ public class DeviceServiceImpl implements DeviceService {
Long deviceId, Long deviceId,
String collectionStartTime, String collectionStartTime,
String collectionEndTime, String collectionEndTime,
List<String> attributeCodes,
Integer page, Integer page,
Integer pageSize) { Integer pageSize) {
@ -1030,6 +1031,13 @@ public class DeviceServiceImpl implements DeviceService {
// 核心逻辑:遍历 attributeList保证全部字段返回 // 核心逻辑:遍历 attributeList保证全部字段返回
for (DeviceContactModelDO attribute : attributeList) { for (DeviceContactModelDO attribute : attributeList) {
// 过滤attributeCodes
if (attributeCodes != null && !attributeCodes.isEmpty()
&& !attributeCodes.contains(attribute.getAttributeCode())) {
continue;
}
String column = String column =
attribute.getAttributeCode(); attribute.getAttributeCode();

Loading…
Cancel
Save