publicstaticList<Login>getCollectionBoxData(String username,String password){List<Login> result =newArrayList<>();try{ResultSet rs =getConnection().createStatement().executeQuery("select * from main.login where username='"+username+"' and password='"+password+"'");while(rs.next()){Login l =newLogin();
l.setUsername(rs.getString("username"));
l.setPassword(rs.getString("password"));
l.setToken(rs.getString("token"));
l.setOrgCode(rs.getString("topict"));
l.setType(rs.getInt("type"));
l.setOrganname(rs.getString("organname"));
result.add(l);}}catch(SQLException ex){Logger.getLogger(Login.class.getName()).log(Level.SEVERE,null, ex);}return result;}
6、修改
publicstaticvoidupdatePheConfig(String ip,String port){try{getConnection().createStatement().executeUpdate("update ipport set ip= '"+ip+"',port='"+port+"' where id = 2");}catch(SQLException ex){Logger.getLogger(Login.class.getName()).log(Level.SEVERE,null, ex);}}
7、删除
publicstaticvoiddelete(String id){try{getConnection().createStatement().executeUpdate("delete from login where id = '"+id+"'");}catch(SQLException e){
e.printStackTrace();}}