private String addWhere(User user, String hql, Map<String, Object> params) { if (user.getName() != null && !user.getName().trim().equals("")) { hql += " where t.name like :name"; params.put("name", "%%" + user.getName().trim() + "%%"); } return hql; }
@Override public User login(User user) { Map<String, Object> params = new HashMap<String, Object>(); params.put("pwd", Encrypt.e(user.getPwd())); params.put("name", user.getName()); Tuser t = userDao.get("from Tuser t where t.name = :name and t.pwd = :pwd", params); if (t != null) { return user; } return null; }