lxw
2020-07-11 9db52f2f2dd3665fe9da1ae5657e0167c3a34d40
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
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<Batt_rtdataRt> list=bimpl.serchByCondition(b);
        for (Batt_rtdataRt rt : list) {
             System.out.println(rt);
        }
    }
}