| | |
| | | package druidConnect; |
| | | |
| | | import ng.db.DBHelper; |
| | | import ng.db.DBSession; |
| | | |
| | | 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); |
| | | //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; |
| | | //Connection con = sqlConnection(); |
| | | 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); |
| | | Connection con=null; |
| | | try{ |
| | | con= DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/gmms?serverTimezone=GMT%2B8","root","beibo.123/"); |
| | | CallableStatement cs =con.prepareCall("call AXJ_a_meter_paramenter()"); |
| | | ResultSet rs = cs.executeQuery(); |
| | | ResultSetMetaData rsmd = rs.getMetaData(); |
| | | String[] arr; |
| | | 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); |
| | | } |
| | | results.add(result); |
| | | return results; |
| | | } |
| | | druidConnect.JDBCUtils.close(cs, con); |
| | | catch(Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | finally{ |
| | | con.close(); |
| | | |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | public static void meterToMysql(String meterid,Double meter,String DLT645) throws Exception { |
| | | Connection con = druidConnect.JDBCUtils.getConnection(); |
| | | Connection con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/gmms?serverTimezone=GMT%2B8","root","beibo.123/"); |
| | | 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); |
| | | con.close(); |
| | | } |
| | | |
| | | public static LinkedList<LinkedHashMap> getOrderOpt() throws Exception { |
| | | Connection con = druidConnect.JDBCUtils.getConnection(); |
| | | Connection con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/gmms?serverTimezone=GMT%2B8","root","beibo.123/"); |
| | | CallableStatement cs =con.prepareCall("call AXJ_a_get_orderRecipeOpt_select()"); |
| | | ResultSet rs = cs.executeQuery(); |
| | | ResultSetMetaData rsmd = rs.getMetaData(); |
| | |
| | | } |
| | | results.add(result); |
| | | } |
| | | druidConnect.JDBCUtils.close(cs, con); |
| | | con.close(); |
| | | return results; |
| | | } |
| | | } |