1
81041
2019-06-20 ab3c4acf83f54f8449ca8664c4a2bb79bd30f297
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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;
    }
 
}