廖井涛
2024-03-04 eae17d27ec56a6b7887f5597335e38ca40273ef4
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
package druidConnect;
 
import java.sql.*;
import java.util.LinkedHashMap;
import java.util.LinkedList;
 
public class getMeterParatermeter {
    public static void main(String[] args) throws Exception {
        LinkedList<LinkedHashMap> a=getMeterParater();
        System.out.println(a);
    }
    public static  LinkedList<LinkedHashMap> getMeterParater() throws Exception {
        Connection con = druidConnect.JDBCUtils.getConnection();
        CallableStatement cs =con.prepareCall("call AXJ_a_meter_paramenter()");
        ResultSet rs = cs.executeQuery();
        ResultSetMetaData rsmd = rs.getMetaData();
        String[] arr;
        LinkedList<LinkedHashMap> results = new LinkedList<LinkedHashMap>();
 
        while(rs.next()){
            LinkedHashMap<String, String> result = new LinkedHashMap<String, String>();
            for(int i=0;i<rsmd.getColumnCount();i++){
                String val=rs.getString(i+1)!=null?String.valueOf(rs.getString(i+1)):"";
                result.put(String.valueOf(rsmd.getColumnName(i+1)),val);
            }
            results.add(result);
        }
        druidConnect.JDBCUtils.close(cs, con);
        return results;
    }
    public static  void meterToMysql(String meterid,Double meter,String DLT645) throws Exception {
        Connection con = druidConnect.JDBCUtils.getConnection();
        CallableStatement cs =con.prepareCall("call AXJ_a_addMeter(?,?,?)");
        cs.setString(1, meterid);
        cs.setDouble(2, meter);
        cs.setString(3, DLT645);
        cs.executeQuery();
        druidConnect.JDBCUtils.close(cs, con);
    }
 
    public static  LinkedList<LinkedHashMap> getOrderOpt() throws Exception {
        Connection con = druidConnect.JDBCUtils.getConnection();
        CallableStatement cs =con.prepareCall("call AXJ_a_get_orderRecipeOpt_select()");
        ResultSet rs = cs.executeQuery();
        ResultSetMetaData rsmd = rs.getMetaData();
        String[] arr;
        LinkedList<LinkedHashMap> results = new LinkedList<LinkedHashMap>();
 
        while(rs.next()){
            LinkedHashMap<String, String> result = new LinkedHashMap<String, String>();
            for(int i=0;i<rsmd.getColumnCount();i++){
                String val=rs.getString(i+1)!=null?String.valueOf(rs.getString(i+1)):"";
                result.put(String.valueOf(rsmd.getColumnName(i+1)),val);
            }
            results.add(result);
        }
        druidConnect.JDBCUtils.close(cs, con);
        return results;
    }
}