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
122
123
124
125
126
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_inf;
import com.fgkj.dto.Ld9testdata_inf;
 
public class Ld9testdata_infImpl 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_inf ld9_inf=(Ld9testdata_inf)obj;
        String sql="select num,BattGroupId,test_record_count,test_record_count_ex,test_type,record_time_interval,record_num,test_starttime,test_starttime_ex,record_time,test_timelong,test_stoptype,test_stopreason,group_vol,test_curr,test_cap,mon_num,mon_vol,max_monvol,min_monvol " +
                " from db_ld9_testdata.tb_ld9testdata_inf where BattGroupId=? " +
                " order by test_starttime desc ";
        List list= DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{ld9_inf.getBattGroupId()}, new CallBack() {
            
            public List getResults(ResultSet rs) {
                List list=new ArrayList();
                try {
                    while(rs.next()){
                        Ld9testdata_inf ld9=new Ld9testdata_inf();
                        ld9.setNum(rs.getInt("num"));
                        ld9.setBattGroupId(rs.getInt("BattGroupId"));
                        ld9.setTest_record_count(rs.getInt("test_record_count"));
                        ld9.setTest_record_count_ex(rs.getInt("test_record_count_ex"));
                        ld9.setTest_type(rs.getInt("test_type"));
                        ld9.setRecord_time_interval(rs.getInt("record_time_interval"));
                        ld9.setRecord_num(rs.getInt("record_num"));
                        ld9.setTest_starttime(rs.getTimestamp("test_starttime"));
                        ld9.setTest_starttime_ex(rs.getTimestamp("test_starttime_ex"));
                        ld9.setRecord_time(rs.getTimestamp("record_time"));
                        ld9.setTest_timelong(rs.getInt("test_timelong"));
                        ld9.setTest_stoptype(rs.getInt("test_stoptype"));
                        //放电终止原因
                        ld9.setTest_stopreason(rs.getInt("test_stopreason"));
                        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.setMax_monvol(rs.getFloat("max_monvol"));
                        ld9.setMin_monvol(rs.getFloat("min_monvol"));
                        list.add(ld9);
                        //System.out.println(b);    
                    }
                } catch (SQLException e) {
                    e.printStackTrace();
                } 
                return list;
            }
        });
        return list;
    }
 
    //历史数据查询(根据电池组id查询所有的放电单体)
    public List serchByInfo(Object obj) {
        Ld9testdata_inf ld9_inf=(Ld9testdata_inf)obj;
        String sql="select distinct BattGroupId,mon_num,count(test_record_count) as nums " +
                " from db_ld9_testdata.tb_ld9testdata_inf where BattGroupId=?  " +
                " group BY mon_num " +
                " order by mon_num asc ";
        List list= DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{ld9_inf.getBattGroupId()}, new CallBack() {
            
            public List getResults(ResultSet rs) {
                List list=new ArrayList();
                try {
                    while(rs.next()){
                        Ld9testdata_inf ld9=new Ld9testdata_inf();
                        ld9.setBattGroupId(rs.getInt("BattGroupId"));
                        ld9.setMon_num(rs.getInt("mon_num"));
                        ld9.setNum(rs.getInt("nums"));
                        list.add(ld9);
                        //System.out.println(b);    
                    }
                } catch (SQLException e) {
                    e.printStackTrace();
                } 
                return list;
            }
        });
        return list;
    }
    public static void main(String[] args) {
         Ld9testdata_infImpl limpl=new Ld9testdata_infImpl();
         Ld9testdata_inf ld9=new Ld9testdata_inf();
         ld9.setBattGroupId(1000006);
         List<Ld9testdata_inf> list=limpl.serchByInfo(ld9);
         for (Ld9testdata_inf ld : list) {
            System.out.println(ld);
        }
    }
}