Commit 031cc36d authored by wuqinghua's avatar wuqinghua

2022-2-28 吴卿华

parent fac29628
......@@ -6,6 +6,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -58,11 +62,22 @@ public class PipeInterfaceController {
public DeviceList selectDeviceData(){
//调压箱数据查询方法
List<DeviceData> deviceData = iPipeInterfaceService.selectDeviceData();
//查询全部数据方法
List<PressureFlow> pressureFlows1 = iPipeInterfaceService.selectPressureFlow("1");
//最后返回的封装类型
DeviceList deviceList=new DeviceList();
//调压箱数据循环
for (int i=0;i<deviceData.size();i++){
//查询下级设备数据
List<PressureFlow> pressureFlows = iPipeInterfaceService.selectPressureFlow(deviceData.get(i).getDeviceId());
deviceData.get(i).setPressureFlows(pressureFlows);
for (int s=0;s<pressureFlows1.size();s++){
//判断调压箱id与下级数据调压箱id是否相等
if (pressureFlows1.get(s).getDeviceId()==deviceData.get(i).getDeviceId()){
//临时存下级数据id
List<PressureFlow> pressList=new ArrayList<>();
//下级数据添加进临时存储数据的数组中
pressList.add(pressureFlows1.get(s));
deviceData.get(i).setPressureFlows(pressList);
}
}
deviceData.get(i).setIconType(2);
}
deviceList.setData(deviceData);
......@@ -151,8 +166,6 @@ public class PipeInterfaceController {
pipeDates.get(i).setPressureFlows(pressureFlows);
}
deviceDataList.setData(pipeDates);
return deviceDataList;
}
......
......@@ -12,6 +12,16 @@ public class PressureFlow {
private String reportTime;
private String deviceId;
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceNo() {
return deviceNo;
}
......@@ -60,6 +70,7 @@ public class PressureFlow {
", deviceState='" + deviceState + '\'' +
", deviceNum='" + deviceNum + '\'' +
", reportTime='" + reportTime + '\'' +
", deviceId='" + deviceId + '\'' +
'}';
}
}
......@@ -103,8 +103,8 @@
<!--查询下级设备数据-->
<select id="selectPressureFlow" parameterType="DeviceData" resultMap="PressureFlowResult">
select device_model,device_type,create_time from t_relation_device_detail_info
where relation_device_id=#{deviceId} and relation_device_type='1'
select device_model,device_type,create_time,relation_device_id from t_relation_device_detail_info
where relation_device_type='1'
</select>
<!--场站信息查询方法-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment