package com.ruoyi.utils.data;
|
|
import com.ruoyi.alarmpoints.well.domain.RTU_DATA_YJ_8;
|
import lombok.extern.slf4j.Slf4j;
|
|
import java.sql.Connection;
|
import java.sql.ResultSet;
|
import java.sql.SQLException;
|
import java.sql.Statement;
|
import java.text.SimpleDateFormat;
|
import java.util.ArrayList;
|
import java.util.Date;
|
import java.util.List;
|
|
@Slf4j(topic = "orcl")
|
public class Query {
|
static Connection conn = null;
|
static Statement st = null;
|
static ResultSet rs = null;
|
|
public static List<RTU_DATA_YJ_8> getRTUDataYJ8(String wellId) {
|
List<RTU_DATA_YJ_8> dataBridgeList = new ArrayList<>();
|
try {
|
//1、获取连接对象
|
conn = Conn.getGc().getCon();
|
//2、创建statement类对象,用来执行SQL语句
|
st = conn.createStatement();
|
//3、创建sql查询语句
|
StringBuilder sbd = new StringBuilder();
|
String sql = "select * from RTU_DATA_YJ_8 where 1=1 ";
|
sbd.append(sql);
|
if (wellId != null) {
|
sbd.append(" and JH ='" + wellId+"'");
|
}
|
//4、执行sql语句并且换回一个查询的结果集
|
rs = st.executeQuery(sbd.toString());
|
while (rs.next()) { //循环遍历结果集
|
RTU_DATA_YJ_8 rtu_data_yj_8 = new RTU_DATA_YJ_8();
|
rtu_data_yj_8.setJH(rs.getString("JH"));
|
rtu_data_yj_8.setRQ(rs.getDate("RQ"));
|
rtu_data_yj_8.setMAT(rs.getInt("MAT"));
|
rtu_data_yj_8.setTGP(rs.getInt("TGP"));
|
rtu_data_yj_8.setCPV(rs.getInt("CPV"));
|
rtu_data_yj_8.setADL(rs.getInt("ADL"));
|
rtu_data_yj_8.setADY(rs.getInt("ADY"));
|
rtu_data_yj_8.setBDL(rs.getInt("BDL"));
|
rtu_data_yj_8.setBDL(rs.getInt("BDL"));
|
rtu_data_yj_8.setCDL(rs.getInt("CDL"));
|
rtu_data_yj_8.setCDY(rs.getInt("CDY"));
|
rtu_data_yj_8.setUCV(rs.getInt("UCV"));
|
rtu_data_yj_8.setDCV(rs.getInt("DCV"));
|
rtu_data_yj_8.setSLV(rs.getInt("SLV"));
|
rtu_data_yj_8.setCHC(rs.getInt("CHC"));
|
rtu_data_yj_8.setBPV(rs.getInt("BPV"));
|
rtu_data_yj_8.setZWG(rs.getInt("ZWG"));
|
rtu_data_yj_8.setZYG(rs.getInt("ZYG"));
|
rtu_data_yj_8.setGYS(rs.getInt("GYS"));
|
rtu_data_yj_8.setUWL(rs.getInt("UWL"));
|
rtu_data_yj_8.setDWL(rs.getInt("DWL"));
|
rtu_data_yj_8.setTIME(rs.getString("TIME"));
|
rtu_data_yj_8.setLRSJ(rs.getDate("LRSJ"));
|
rtu_data_yj_8.setXT(rs.getInt("XT"));
|
rtu_data_yj_8.setSCSJ(rs.getInt("SCSJ"));
|
rtu_data_yj_8.setSCSL(rs.getInt("SCSL"));
|
rtu_data_yj_8.setMLV(rs.getInt("MLV"));
|
rtu_data_yj_8.setDLV(rs.getInt("DLV"));
|
rtu_data_yj_8.setDLV(rs.getInt("DLV"));
|
rtu_data_yj_8.setXY(rs.getInt("XY"));
|
rtu_data_yj_8.setNJU(rs.getInt("NJU"));
|
rtu_data_yj_8.setZHS(rs.getInt("ZHS"));
|
dataBridgeList.add(rtu_data_yj_8);
|
}
|
conn.close();
|
return dataBridgeList;
|
} catch (Exception e) {
|
log.error("设备运行状态查询异常:" + e.getMessage());
|
return dataBridgeList;
|
}
|
}
|
}
|