Commit 031cc36d authored by wuqinghua's avatar wuqinghua

2022-2-28 吴卿华

parent fac29628
...@@ -6,6 +6,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -6,6 +6,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -58,11 +62,22 @@ public class PipeInterfaceController { ...@@ -58,11 +62,22 @@ public class PipeInterfaceController {
public DeviceList selectDeviceData(){ public DeviceList selectDeviceData(){
//调压箱数据查询方法 //调压箱数据查询方法
List<DeviceData> deviceData = iPipeInterfaceService.selectDeviceData(); List<DeviceData> deviceData = iPipeInterfaceService.selectDeviceData();
//查询全部数据方法
List<PressureFlow> pressureFlows1 = iPipeInterfaceService.selectPressureFlow("1");
//最后返回的封装类型
DeviceList deviceList=new DeviceList(); DeviceList deviceList=new DeviceList();
//调压箱数据循环
for (int i=0;i<deviceData.size();i++){ for (int i=0;i<deviceData.size();i++){
//查询下级设备数据 for (int s=0;s<pressureFlows1.size();s++){
List<PressureFlow> pressureFlows = iPipeInterfaceService.selectPressureFlow(deviceData.get(i).getDeviceId()); //判断调压箱id与下级数据调压箱id是否相等
deviceData.get(i).setPressureFlows(pressureFlows); 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); deviceData.get(i).setIconType(2);
} }
deviceList.setData(deviceData); deviceList.setData(deviceData);
...@@ -151,8 +166,6 @@ public class PipeInterfaceController { ...@@ -151,8 +166,6 @@ public class PipeInterfaceController {
pipeDates.get(i).setPressureFlows(pressureFlows); pipeDates.get(i).setPressureFlows(pressureFlows);
} }
deviceDataList.setData(pipeDates); deviceDataList.setData(pipeDates);
return deviceDataList; return deviceDataList;
} }
......
...@@ -12,6 +12,16 @@ public class PressureFlow { ...@@ -12,6 +12,16 @@ public class PressureFlow {
private String reportTime; private String reportTime;
private String deviceId;
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceNo() { public String getDeviceNo() {
return deviceNo; return deviceNo;
} }
...@@ -60,6 +70,7 @@ public class PressureFlow { ...@@ -60,6 +70,7 @@ public class PressureFlow {
", deviceState='" + deviceState + '\'' + ", deviceState='" + deviceState + '\'' +
", deviceNum='" + deviceNum + '\'' + ", deviceNum='" + deviceNum + '\'' +
", reportTime='" + reportTime + '\'' + ", reportTime='" + reportTime + '\'' +
", deviceId='" + deviceId + '\'' +
'}'; '}';
} }
} }
...@@ -103,8 +103,8 @@ ...@@ -103,8 +103,8 @@
<!--查询下级设备数据--> <!--查询下级设备数据-->
<select id="selectPressureFlow" parameterType="DeviceData" resultMap="PressureFlowResult"> <select id="selectPressureFlow" parameterType="DeviceData" resultMap="PressureFlowResult">
select device_model,device_type,create_time from t_relation_device_detail_info select device_model,device_type,create_time,relation_device_id from t_relation_device_detail_info
where relation_device_id=#{deviceId} and relation_device_type='1' where relation_device_type='1'
</select> </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