package com.fgkj.dao.impl.rt; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.fgkj.dao.BaseDAO; import com.fgkj.dao.CallBack; import com.fgkj.dao.DAOHelper; import com.fgkj.db.DBUtil; import com.fgkj.dto.Batt_rtdata; import com.fgkj.dto.rt.Batt_rtdataRt; public class Batt_rtdataRtImpl implements BaseDAO,CallBack{ public List getResults(ResultSet rs) { List list=new ArrayList(); try { while(rs.next()){ Batt_rtdataRt rtdataRt=new Batt_rtdataRt(); rtdataRt.setNum(rs.getInt("num")); rtdataRt.setBattGroupId(rs.getInt("BattGroupId")); rtdataRt.setRec_datetime(rs.getDate("rec_datetime")); rtdataRt.setMon_num(rs.getInt("mon_num")); rtdataRt.setMon_vol(rs.getFloat("mon_vol")); rtdataRt.setMon_tmp(rs.getFloat("mon_tmp")); rtdataRt.setMon_res(rs.getFloat("mon_res")); rtdataRt.setMon_ser(rs.getFloat("mon_ser")); rtdataRt.setMon_conn_res(rs.getFloat("mon_conn_res")); rtdataRt.setMon_cap(rs.getFloat("mon_cap")); rtdataRt.setBatt_count(rs.getInt("batt_count")); rtdataRt.setOnline_vol(rs.getFloat("online_vol")); rtdataRt.setGroup_vol(rs.getFloat("group_vol")); rtdataRt.setGroup_curr(rs.getFloat("group_curr")); rtdataRt.setBatt_state(rs.getInt("batt_state")); rtdataRt.setBatt_test_type(rs.getInt("batt_test_type")); rtdataRt.setBatt_test_starttime(rs.getTimestamp("batt_test_starttime")); rtdataRt.setBatt_test_recordtime(rs.getTimestamp("batt_test_recordtime")); rtdataRt.setBatt_test_tlong(rs.getInt("batt_test_tlong")); rtdataRt.setBatt_test_cap(rs.getFloat("batt_test_cap")); rtdataRt.setBatt_real_cap(rs.getFloat("batt_real_cap")); rtdataRt.setBatt_rest_cap(rs.getFloat("batt_rest_cap")); rtdataRt.setBatt_rest_power1_time(rs.getInt("batt_rest_power1_time")); rtdataRt.setBatt_rest_power2_time(rs.getInt("batt_rest_power2_time")); list.add(rtdataRt); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return list; } public boolean add(Object obj) { // TODO Auto-generated method stub return false; } public boolean update(Object obj) { // TODO Auto-generated method stub return false; } public boolean del(Object obj) { // TODO Auto-generated method stub return false; } public List searchAll() { // TODO Auto-generated method stub return null; } //实时监测——点击电池组查看实时数据 public List serchByCondition(Object obj) { Batt_rtdataRt rtdataRt=(Batt_rtdataRt)obj; String sql="select num,BattGroupId,rec_datetime,mon_num,mon_vol,mon_tmp,mon_res,mon_ser,mon_conn_res,mon_cap" + " ,batt_count,rec_datetime,group_vol,online_vol,group_curr,batt_state," + " batt_test_type,batt_test_starttime,batt_test_recordtime,batt_test_tlong," + " batt_test_cap,batt_real_cap,batt_rest_cap,batt_rest_power1_time,batt_rest_power2_time " + " from db_ram_batt_rt.tb_batt_rtdata_"+rtdataRt.getBattGroupId(); List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), null, new Batt_rtdataRtImpl()); return list; } public List serchByInfo(Object obj) { // TODO Auto-generated method stub return null; } public static void main(String[] args) { Batt_rtdataRtImpl bimpl=new Batt_rtdataRtImpl(); Batt_rtdataRt b=new Batt_rtdataRt(); b.setBattGroupId(1000007); List list=bimpl.serchByCondition(b); for (Batt_rtdataRt rt : list) { System.out.println(rt); } } }