${原来姹紫嫣红开遍,似这般都付与扣钉八哥}
页面部分见上一篇文章:jquerry之隔行跳色
TransAction.java部分代码:
} @Override public String list() throws Exception { System.out.println("list........"); User u=(User) getFromSession("user_session"); int uid=u.getId(); System.out.println(uid); System.out.println("oid:"+oid); //System.out.println(trans.getUid()+"================"); int pageNum=0; if(pageNo==0){ pageNum=1; }else{ pageNum=pageNo; } if("1".equals(oid)){ pages=dao.getByTimePageNum(pageNum, uid); }else if("2".equals(oid)){ pages=dao.getByMoneyPageNum(pageNum, uid); }else{ pages=dao.getByPageNum(pageNum, uid); } System.out.println("pageNum"+pageNum); System.out.println("totalCount:"+pages.getTotalCount()); return SUCCESS; }
TransInfoDao.java部分代码:
/** * 当前用户转账用户分页 * @param pageNum * @param uid * @return */ public Pages<TransInfo> getByPageNum(int pageNum,int uid){ Pages<TransInfo> pages=new Pages<TransInfo>(getTransCountSize(uid)); pages.setPageSize(3); String sql="select top 5*from(select ROW_NUMBER() over(order by tt.id)as RowNumber,tt.taccountnum,tt.tmoney,tt.tdate,tt.uid,tu.accountnum,ttu.username from t_transInfo tt left join t_user tu on tt.uid=tu.id left join t_user ttu on tt.tuid=ttu.id where tt.uid=?)r where RowNumber>?"; List<TransInfo> transList=db.queryForList(sql,new IRowMap<TransInfo>(){ public TransInfo mapRow(ResultSet rs) throws SQLException { TransInfo trans=new TransInfo(); trans.setTaccountNum(rs.getString("taccountnum")); trans.setTmoney(rs.getFloat("tmoney")); trans.setTdate(rs.getString("tdate")); User user=new User(); user.setAccountNum(rs.getString("accountnum")); user.setUserName(rs.getString("username")); trans.setUser(user); return trans; }},uid,pages.getStart(pageNum)); pages.setPageList(transList); return pages; } /** * 根据时间排序 * @param pageNum * @param uid * @return */ public Pages<TransInfo> getByTimePageNum(int pageNum,int uid){ Pages<TransInfo> pages=new Pages<TransInfo>(getTransCountSize(uid)); pages.setPageSize(3); String sql="select top 5*from(select ROW_NUMBER() over(order by tt.id)as RowNumber,tt.taccountnum,tt.tmoney,tt.tdate,tt.uid,tu.accountnum,ttu.username from t_transInfo tt left join t_user tu on tt.uid=tu.id left join t_user ttu on tt.tuid=ttu.id where tt.uid=?)r where RowNumber>? order by tdate"; List<TransInfo> transList=db.queryForList(sql,new IRowMap<TransInfo>(){ public TransInfo mapRow(ResultSet rs) throws SQLException { TransInfo trans=new TransInfo(); trans.setTaccountNum(rs.getString("taccountnum")); trans.setTmoney(rs.getFloat("tmoney")); trans.setTdate(rs.getString("tdate")); User user=new User(); user.setAccountNum(rs.getString("accountnum")); user.setUserName(rs.getString("username")); trans.setUser(user); return trans; }},uid,pages.getStart(pageNum)); pages.setPageList(transList); return pages; } /** * 根据金额排序 * @param pageNum * @param uid * @return */ public Pages<TransInfo> getByMoneyPageNum(int pageNum,int uid){ Pages<TransInfo> pages=new Pages<TransInfo>(getTransCountSize(uid)); pages.setPageSize(3); String sql="select top 5*from(select ROW_NUMBER() over(order by tt.id)as RowNumber,tt.taccountnum,tt.tmoney,tt.tdate,tt.uid,tu.accountnum,ttu.username from t_transInfo tt left join t_user tu on tt.uid=tu.id left join t_user ttu on tt.tuid=ttu.id where tt.uid=?)r where RowNumber>?"; List<TransInfo> transList=db.queryForList(sql,new IRowMap<TransInfo>(){ public TransInfo mapRow(ResultSet rs) throws SQLException { TransInfo trans=new TransInfo(); trans.setTaccountNum(rs.getString("taccountnum")); trans.setTmoney(rs.getFloat("tmoney")); trans.setTdate(rs.getString("tdate")); User user=new User(); user.setAccountNum(rs.getString("accountnum")); user.setUserName(rs.getString("username")); trans.setUser(user); return trans; }},uid,pages.getStart(pageNum)); pages.setPageList(transList); return pages; }
posted on 2010-08-16 21:08 archie2010 阅读(401) 评论(0) 编辑 收藏 举报