Example #1
0
 public boolean login(Admin admin) throws Exception {
   boolean flag = false;
   String hql = "FROM Admin AS a WHERE a.adminid=? AND a.adminpwd=?";
   Query q = super.getSession().createQuery(hql);
   q.setString(0, admin.getAdminid());
   q.setString(1, admin.getAdminpwd());
   List all = q.list();
   if (all.size() > 0) {
     flag = true;
   }
   return flag;
 }
Example #2
0
 // 必须是经过MD5加密之后才可以
 public boolean checkOldpwd(String adminid, String oldpwd) throws Exception {
   boolean flag = false;
   String hql = "FROM Admin AS a WHERE a.adminid=?";
   Query q = super.getSession().createQuery(hql);
   q.setString(0, adminid);
   List all = q.list();
   if (all.size() > 0) {
     Admin admin = (Admin) q.list().get(0);
     if (admin.getAdminpwd().equals(oldpwd)) {
       flag = true;
     }
   }
   return flag;
 }