/**
,page ,row
*/
public UserVO findAllUser(int page,int row) {
ResultSet rs = null;
PreparedStatement prep = null;
UserVO user = null;
try {
/**
SQL
*/
String sql = "select * from (select a.*,rownum rn from (select * from users where status=1) a) where "+row+"*"+page+" >= rn and ("+page+"-1)*"+row+" < rn";
/**
Md5Utils.md5Jdk(user.getPasswd()) MD5 , ,
*/
prep = conn.prepareStatement(sql);
rs = prep.executeQuery();
while (rs.next()) {
user = new UserVO();
user.setUsername(rs.getString("username"));
user.setPasswd(rs.getString("passwd"));
user.setPower(rs.getInt("power"));
user.setName(rs.getString("name"));
user.setSex(rs.getString("sex"));
user.setBirthday(rs.getDate("birthday"));
user.setEmail(rs.getString("email"));
user.setStatus(rs.getInt("status"));
System.out.println(user.getUsername()+" "
+Md5Utils.md5Jdk(user.getPasswd())+" "
+user.getPower()+" "
+user.getName()+" "
+user.getSex()+" "
+user.getBirthday()+" "
+user.getEmail()+" "
+user.getStatus()
);
}
} catch (Exception e) {
throw new ServiceException(" ,,。", e);
} finally {
/**
DbUtils.closeStatement(rs, null, prep)
*/
DbUtils.closeStatement(rs, null, prep);
}
return user;
}