public boolean existUserByUserName(String userName) { String hql = "select count(*) from User where userName=?"; List<Object> param = new LinkedList<Object>(); param.add(userName); Long i = baseDao.count(hql, param); if (i > 0) { return true; } else { return false; } }
public Long count(User s_User) { List<Object> param = new LinkedList<Object>(); StringBuffer hql = new StringBuffer("select count(*) from User"); hql.append(" and status=1 "); return baseDao.count(hql.toString().replaceFirst("and", "where"), param); }