package com.fgkj.dao.impl.Ld9;
|
|
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.BattTestData;
|
import com.fgkj.dao.CallBack;
|
import com.fgkj.dao.DAOHelper;
|
import com.fgkj.db.DBUtil;
|
import com.fgkj.dto.Batttestdata;
|
import com.fgkj.dto.Ld9testdata;
|
|
public class Ld9testdataImpl implements BaseDAO,CallBack{
|
|
public List getResults(ResultSet rs) {
|
// TODO Auto-generated method stub
|
return null;
|
}
|
|
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) {
|
Ld9testdata ld9=(Ld9testdata)obj;
|
int number=ld9.getRecord_num();//总数
|
int roteN=0;
|
int endN=BattTestData.RC_NUM_PARAM;//总笔数
|
if(number<=endN){
|
roteN=1;
|
}else{
|
if(number%endN==0){
|
roteN=number/endN;
|
}else{
|
roteN=number/endN+1;
|
}
|
}
|
String sql="select num,BattGroupId,test_record_count,test_type,record_num,test_starttime,record_time,test_timelong,online_vol,group_vol,test_curr,test_cap,mon_num,mon_vol,mon_tmp,test_monnum " +
|
" from db_ld9_testdata.tb_ld9testdata_"+ld9.getBattGroupId()+" " +
|
" where test_record_count=? and (record_num%"+roteN+"=0 ) and test_monnum=? ";
|
|
List list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{ld9.getTest_record_count(),ld9.getTest_monnum()}, new CallBack() {
|
public List getResults(ResultSet rs) {
|
List list=new ArrayList();
|
try {
|
while(rs.next()){
|
Ld9testdata ld9=new Ld9testdata();
|
ld9.setNum(rs.getInt("num"));
|
ld9.setBattGroupId(rs.getInt("BattGroupId"));
|
ld9.setTest_record_count(rs.getInt("test_record_count"));
|
ld9.setTest_type(rs.getInt("test_type"));
|
ld9.setRecord_num(rs.getInt("record_num"));
|
ld9.setTest_starttime(rs.getTimestamp("test_starttime"));
|
ld9.setRecord_time(rs.getTimestamp("record_time"));
|
ld9.setTest_timelong(rs.getInt("test_timelong"));
|
ld9.setOnline_vol(rs.getFloat("online_vol"));
|
ld9.setGroup_vol(rs.getFloat("group_vol"));
|
ld9.setTest_curr(rs.getFloat("test_curr"));
|
ld9.setTest_cap(rs.getFloat("test_cap"));
|
ld9.setMon_num(rs.getInt("mon_num"));
|
ld9.setMon_vol(rs.getFloat("mon_vol"));
|
ld9.setMon_tmp(rs.getFloat("mon_tmp"));
|
ld9.setTest_monnum(rs.getInt("test_monnum"));
|
list.add(ld9);
|
}
|
}catch (SQLException e) {
|
e.printStackTrace();
|
}
|
return list;
|
}
|
});
|
return list;
|
}
|
//查询某次测试下电池组节数放电情况
|
public List serchByInfo(Object obj) {
|
Ld9testdata ld9=(Ld9testdata)obj;
|
String sql="select test_monnum,max(record_num) as record_nums,BattGroupId,test_record_count from db_ld9_testdata.tb_ld9testdata_"+ld9.getBattGroupId()+" where test_record_count=? GROUP BY test_monnum order by test_monnum asc";
|
List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{ld9.getTest_record_count()}, new CallBack() {
|
|
public List getResults(ResultSet rs) {
|
List list=new ArrayList();
|
try {
|
while(rs.next()){
|
Ld9testdata ld9=new Ld9testdata();
|
ld9.setTest_monnum(rs.getInt("test_monnum"));
|
ld9.setRecord_num(rs.getInt("record_nums"));
|
ld9.setBattGroupId(rs.getInt("battGroupId"));
|
ld9.setTest_record_count(rs.getInt("test_record_count"));
|
list.add(ld9);
|
}
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
return list;
|
}
|
});
|
return list;
|
}
|
|
}
|