|
|
|
|
package com.bean;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @author Administrator
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import com.util.Constant;
|
|
|
|
|
import com.util.DBO;
|
|
|
|
|
|
|
|
|
|
public class FriendLinkBean {
|
|
|
|
|
|
|
|
|
|
private List list;
|
|
|
|
|
private ResultSet rs;
|
|
|
|
|
private String date=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӷ<EFBFBD>ҳ
|
|
|
|
|
private int EVERYPAGENUM = 2;
|
|
|
|
|
private int count = -1;
|
|
|
|
|
private int qq = 0;
|
|
|
|
|
private String sql="select count(*) from friendlink where ifhide!='2'";
|
|
|
|
|
private String sql2="select * from friendlink where ifhide!='2' order by ordervalue desc ";
|
|
|
|
|
public void setEVERYPAGENUM(int EVERYPAGENUM){
|
|
|
|
|
this.EVERYPAGENUM=EVERYPAGENUM;
|
|
|
|
|
}
|
|
|
|
|
public int getMessageCount() { //<2F>õ<EFBFBD><C3B5><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|
|
|
|
DBO dbo=new DBO();
|
|
|
|
|
dbo.open();
|
|
|
|
|
try {
|
|
|
|
|
rs = dbo.executeQuery(sql);
|
|
|
|
|
rs.next();
|
|
|
|
|
count = rs.getInt(1);
|
|
|
|
|
return count;
|
|
|
|
|
} catch (SQLException ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
return -1;
|
|
|
|
|
} finally {
|
|
|
|
|
dbo.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public int getPageCount() { //<2F>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿҳҪ<D2B3><D2AA>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>
|
|
|
|
|
if (count % EVERYPAGENUM == 0) {
|
|
|
|
|
return count / EVERYPAGENUM;
|
|
|
|
|
} else {
|
|
|
|
|
return count / EVERYPAGENUM + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public List getMessage(int page) { //<2F>õ<EFBFBD>ÿҳҪ<D2B3><D2AA>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
DBO dbo=new DBO();
|
|
|
|
|
dbo.open();
|
|
|
|
|
List list = new ArrayList();
|
|
|
|
|
try {
|
|
|
|
|
rs = dbo.executeQuery(sql2);
|
|
|
|
|
for (int i = 0; i < (page - 1) * EVERYPAGENUM; i++) {
|
|
|
|
|
rs.next();
|
|
|
|
|
}
|
|
|
|
|
for (int t = 0; t < EVERYPAGENUM; t++) {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
qq++;
|
|
|
|
|
List list2=new ArrayList();
|
|
|
|
|
list2.add(rs.getInt(1));
|
|
|
|
|
list2.add(rs.getString(2));
|
|
|
|
|
list2.add(rs.getString(3));
|
|
|
|
|
list2.add(rs.getString(4));
|
|
|
|
|
list2.add(rs.getString(5));
|
|
|
|
|
list2.add(rs.getInt(6));
|
|
|
|
|
list2.add(rs.getInt(7));
|
|
|
|
|
list2.add(rs.getString(8));
|
|
|
|
|
list.add(list2);
|
|
|
|
|
} else {
|
|
|
|
|
break; //<2F><><EFBFBD>ٿ<EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
} catch (SQLException ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
return list;
|
|
|
|
|
} finally {
|
|
|
|
|
dbo.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List getAllShowFriendLink(){
|
|
|
|
|
String sql = "select linkname,linkurl,linkpic,intero from friendlink where ifhide='1' order by ordervalue desc";
|
|
|
|
|
DBO dbo = new DBO();
|
|
|
|
|
list = new ArrayList();
|
|
|
|
|
dbo.open();
|
|
|
|
|
try{
|
|
|
|
|
rs = dbo.executeQuery(sql);
|
|
|
|
|
while(rs.next()){
|
|
|
|
|
List list2 = new ArrayList();
|
|
|
|
|
list2.add(rs.getString(1));
|
|
|
|
|
list2.add(rs.getString(2));
|
|
|
|
|
list2.add(rs.getString(3));
|
|
|
|
|
list2.add(rs.getString(4));
|
|
|
|
|
list.add(list2);
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return list;
|
|
|
|
|
}finally{
|
|
|
|
|
dbo.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|