whyclj
2019-10-29 1c0469e45346d464e0c5672ee68f9ecd4fb6be7c
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
package com.fgkj.dao.impl.ram;
 
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.JhState;
 
public class JhStateImpl 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;
    }
    //根据设备id查询设备均衡供电模块的信息
    public List serchByCondition(Object obj) {
        JhState jh=(JhState) obj;
        String sql=" select * from db_ram_db.tb_61850_jhstate where dev_id=? ";
        List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{jh.getDev_id()}, new CallBack() {
            
            public List getResults(ResultSet rs) {
                List list=new ArrayList();
                try {
                    while(rs.next()){
                        JhState j=new JhState();
                        j.setNum(rs.getInt("num"));
                        j.setDev_id(rs.getInt("dev_id"));
                        j.setDev_version(rs.getString("dev_version"));
                        j.setInput_vol_total(rs.getDouble("input_vol_total"));
                        j.setOutput_vol_total(rs.getDouble("output_vol_total"));
                        j.setInput_curr_total(rs.getDouble("input_curr_total"));
                        j.setOutput_curr_total(rs.getDouble("output_curr_total"));
                        j.setOutput_vol_one(rs.getDouble("output_vol_one"));
                        j.setOutput_vol_two(rs.getDouble("output_vol_two"));
                        j.setOutput_vol_three(rs.getDouble("output_vol_three"));
                        j.setOutput_vol_four(rs.getDouble("output_vol_four"));
                        j.setOutput_vol_five(rs.getDouble("output_vol_five"));
                        j.setOutput_vol_six(rs.getDouble("output_vol_six"));
                        j.setOutput_vol_seven(rs.getDouble("output_vol_seven"));
                        j.setOutput_vol_eight(rs.getDouble("output_vol_eight"));
                        j.setOutput_vol_nine(rs.getDouble("output_vol_nine"));
                        j.setOutput_vol_ten(rs.getDouble("output_vol_ten"));
                        j.setDev_temp(rs.getDouble("dev_temp"));
                        list.add(j);
                    }
                } catch (SQLException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                return list;
            }
        });
        // TODO Auto-generated method stub
        return list;
    }
 
    public List serchByInfo(Object obj) {
        // TODO Auto-generated method stub
        return null;
    }
    public static void main(String[] args) {
        JhStateImpl jimpl=new JhStateImpl();
        JhState jh=new JhState();
        jh.setDev_id(618500001);
        List list=jimpl.serchByCondition(jh);
        System.out.println(list.size());
    }
}