![](https://csdnimg.cn/release/download_crawler_static/87562374/bg7.jpg)
}
return list;
}
//根据卡号和密码验证用户是否存在
public boolean verify(int id,String password){
conn=getConnection();
try{
pstmt=conn.prepareStatement(”select * from account where id=? and userpwd=?
");
pstmt。setInt(1, id);
pstmt.setString(2, password);
rs=pstmt。executeQuery();
if(rs。next()){
return true;
}else{
return false;
}
}catch(SQLException e){
e.printStackTrace();
return false;
}
}
/**
* 登录验证
*/
public accounts verifyAccount(int id, String password) {
boolean flag = verify(id, password);
if(flag){
accounts account=queryByIDandPassword(id, password);
return account;
}
else
{
System。out。println("用户不存在!”);
return null;
}
}
//根据卡号和密码查询信息
public accounts queryByIDandPassword(int id,String password){
conn=getConnection();