package com.zit.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.zit.db.DBConnect;
import com.zit.entity.TB_Fridend;
public class Fridend_Dao extends DBConnect{
private static ResultSet rs=null;
private static Connection con=null;
private static PreparedStatement ps=null;
String no1="";
String name1="";
/*
* 查看好友请求
* */
public List<TB_Fridend> friendweichuli(int uid){
List<TB_Fridend> list=new ArrayList<TB_Fridend>();
TB_Fridend f=null;
con=super.GetConnect();
try {
String sql="select log_id,per_head,per_webname from TB_Login join TB_Perinfo" +
" on per_no=log_id " +
"where log_id in (select fri_Ano from TB_Fridend where fri_isAgree='n'" +
" and fri_Bno=(select log_id from TB_Login where log_id="+uid+"))";
ps=con.prepareStatement(sql);
rs=ps.executeQuery();
while(rs.next()){
f=new TB_Fridend();
f.setFrilogid(rs.getInt(1));
f.setFrihead(rs.getString(2));
f.setFriwebname(rs.getString(3));
list.add(f);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
try {
super.CloseAll(rs, null, ps, con);
} catch (Exception e) {
e.printStackTrace();
}
}
return list;
}
/*
* 获取好友列表
* */
public List<TB_Fridend> friendGet(int uid,int page){
List<TB_Fridend> list=new ArrayList<TB_Fridend>();
TB_Fridend f=null;
con=super.GetConnect();
try {
String sql="select log_id,log_username,per_head,per_webname,per_sex,per_age from " +
"(select log_id,log_username,per_head,per_webname,per_sex,per_age,rownum num from " +
"TB_Login join TB_Perinfo on per_no=log_id where log_id in (select fri_Bno from " +
"TB_Fridend where fri_isAgree='y' and fri_Ano=(select log_id from " +
"TB_Login where log_id='"+uid+"')) or log_id in (select fri_Ano from " +
"TB_Fridend where fri_isAgree='y' and fri_Bno=(select log_id from " +
"TB_Login where log_id='"+uid+"')) and log_id<>"+uid+") where num " +
"between "+((page-1)*3+1)+" and "+page*3;
ps=con.prepareStatement(sql);
rs=ps.executeQuery();
while(rs.next()){
f=new TB_Fridend();
f.setFrilogid(rs.getInt(1));
f.setFrilogno(rs.getString(2));
f.setFrihead(rs.getString(3));
f.setFriwebname(rs.getString(4));
f.setFrisex(rs.getString(5).charAt(0));
f.setFriage(rs.getInt(6));
list.add(f);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
try {
super.CloseAll(rs, null, ps, con);
} catch (Exception e) {
e.printStackTrace();
}
}
return list;
}
//统计
public int countFriend(int id){
String sql="select count(fri_Ano) from TB_Fridend where fri_isAgree='y' and fri_Ano="+id;
int n=0;
con=super.GetConnect();
try {
ps=con.prepareStatement(sql);
rs=ps.executeQuery();
if(rs.next()){
n=rs.getInt(1);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
try {
super.CloseAll(rs, null, ps, con);
} catch (Exception e) {
e.printStackTrace();
}
}
return n;
}
//查询所有的用户
public List<TB_Fridend> friendGetAllLog(int uid,int page){
List<TB_Fridend> list=new ArrayList<TB_Fridend>();
TB_Fridend f=null;
con=super.GetConnect();
try {
String sql="select log_id,log_username,per_head,per_webname,per_sex,per_age from " +
"(select log_id,log_username,per_head,per_webname,per_sex,per_age,rownum num from " +
"TB_Login join TB_Perinfo on per_no=log_id where log_id<>"+uid+") where num " +
"between "+((page-1)*3+1)+" and "+page*3;
ps=con.prepareStatement(sql);
rs=ps.executeQuery();
while(rs.next()){
f=new TB_Fridend();
f.setFrilogid(rs.getInt(1));
f.setFrilogno(rs.getString(2));
f.setFrihead(rs.getString(3));
f.setFriwebname(rs.getString(4));
f.setFrisex(rs.getString(5).charAt(0));
f.setFriage(rs.getInt(6));
list.add(f);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
try {
super.CloseAll(rs, null, ps, con);
} catch (Exception e) {
e.printStackTrace();
}
}
return list;
}//统计
public int countFriendAll(int id){
String sql="select count(log_id) from TB_Login where log_id<>"+id;
int n=0;
con=super.GetConnect();
try {
ps=con.prepareStatement(sql);
rs=ps.executeQuery();
if(rs.next()){
n=rs.getInt(1);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
try {
super.CloseAll(rs, null, ps, con);
} catch (Exception e) {
e.printStackTrace();
}
}
return n;
}
//通过帐号查询所有的用户
public List<TB_Fridend> friendGetNumLog(int uid,int page,String no){
no1=no;
List<TB_Fridend> list=new ArrayList<TB_Fridend>();
TB_Fridend f=null;
con=super.GetConnect();
try {
String sql="select log_id,log_username,per_head,per_webname,per_sex,per_age from " +
"(select log_id,log_username,per_head,per_webname,per_sex,per_age,rownum num from " +
"TB_Login join TB_Perinfo on per_no=log_id where log_id<>"+uid+" and log_username like'%"+no+"%')" +
" where num between "+((page-1)*3+1)+" and "+page*3;
ps=con.prepareStatement(sql);
rs=ps.executeQuery();
while(rs.next()){
f=new TB_Fridend();
f.setFrilogid(rs.getInt(1));
f.setFrilogno(rs.getString(2));
f.setFrihead(rs.getString(3));
f.setFriwebname(rs.getString(4));
f.setFrisex(rs.getString(5).charAt(0));
f.setFriage(rs.getInt(6));
list.add(f);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
try {
super.CloseAll(rs, null, ps, con);
} catch (Exception e) {
e.printStackTrace();
}
}
return list;
}
//通过帐号查询所有的用户
public List<TB_Fridend> friendGetNumLog1(int uid,int page){
String no=no1;
List<TB_Fridend> list=new ArrayList<TB_Fridend>();
TB_Fridend f=null;
con=super.GetConnect();
try {
String sql="select log_id,log_username,per_head,per_webname,per_sex,per_age from " +
"(select log_id,log_username,per_head,per_webname,per_sex,per_age,rownum num from " +
"TB_Login join TB_Perinfo on per_no=log_id where log_id<>"+uid+" and log_username like'%"+no+"%')" +
" where num between "+((page-1)*3+1)+" and "+page*3;
ps=con.prepareStatement(sql);
rs=ps.executeQuery();
while(rs.next()){
f=new TB_Fridend();
f.setFrilogid(rs.getInt(1));
f.setFrilogno(rs.getString(2));
f.setFrihead(rs.getString(3));
f.setFriwebname(rs.getString(4));
f.setFrisex(rs.getString(5).charAt(0));
f.setFriage(rs.getInt(6));
list.add(f);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
try {
super.CloseAll(rs, null, ps, con);
} catch (Exception e) {
e.printStackTrace();
}
}
return list;
}
//统计
public int countFriendNum(int id,String no){
String sql="select count(log_id) from TB_Login where log_id<>"+id+" and log_username like'%"+no+"%'";
int n=0;
con=super.GetConnect();
try {
ps=con.prepareStatement(sql);
rs=ps.executeQuery();
if(rs.next()){
n=rs.getInt(1);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
try {
super.CloseAll(rs, null, ps, con);
} catch (Exception e) {
e.printStackTrace();
}
}
return n;
}
public int countFriendNum1(int id){
String no=no1;
String sql="select count(log_id) from TB_Login where log_id<>"+id+" and log_username like'%"+no+"%'";
int n=0;
con=super.GetConnect();
try {
ps=con.prepareStatement(sql);
rs=ps.executeQuery();
if(rs.next()){
n=rs.getInt(1);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
try {
super.Close
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
个人空间项目 java (1186个子文件)
ckeditor.asp 30KB
events.asp 4KB
advanced.asp 3KB
replaceall.asp 3KB
replace.asp 2KB
standalone.asp 2KB
sample_posteddata.asp 1KB
run.bat 270B
Fridend_Dao.class 14KB
Daily_Dao.class 11KB
Said_Dao.class 10KB
Message_Dao.class 8KB
Person_Dao.class 5KB
Register_Dao.class 4KB
Personhead_Svlt.class 4KB
PictureUpdate.class 4KB
Picture_Dao.class 4KB
Personchange_Svlt.class 3KB
TB_Like.class 3KB
Saiddisreturn_Svlt.class 3KB
Sadiscuss_Svlt.class 3KB
FriendAdd_Svlt.class 3KB
Mesreturninfo_Svltf.class 3KB
Massagemse_Svltf.class 2KB
Saidfabiao_Svlt.class 2KB
Mesreturninfo_Svlt.class 2KB
Saiddisreturn_Svltf.class 2KB
Saiddelete_Svlt.class 2KB
Sadiscuss_Svltf.class 2KB
Saiddisdelete_Svlt.class 2KB
Messagedelect_Dao.class 2KB
SaidReturndelete_Svlt.class 2KB
Massagemse_Svlt.class 2KB
SaidPageChange_svlt.class 2KB
DailyDelete_Svlt.class 2KB
Messdelect_Svlt.class 2KB
Mereturn_Svlt.class 2KB
TB_Fridend.class 2KB
TB_Perinfo.class 2KB
Friendtongyi_Svlt.class 2KB
FriendSelName_Svlt.class 2KB
Dailyf_Svlt.class 2KB
MesPageChange_svlt.class 2KB
FriendSelNum_Svlt.class 2KB
FriendButong_Svlt.class 2KB
Frienddelect_Svlt.class 2KB
DaiPageChange_svlt.class 2KB
SaidPageChange_svltf.class 2KB
Said_Svlt.class 2KB
TB_Daily.class 2KB
Dailyshow_Svlt.class 2KB
Said_Svltf.class 2KB
FriendSelNamepage_Svlt.class 2KB
FriendSelNumpage_Svlt.class 2KB
FriendSelAllpage_Svlt.class 2KB
DailyChangeinfo_Svlt.class 2KB
FriPageChange_svlt.class 2KB
MesPageChange_svltf.class 2KB
Daily_Svlt.class 2KB
Message_Svlt.class 2KB
DailyChatype_Svlt.class 2KB
Friend_Svlt.class 2KB
Message_Svltf.class 2KB
Daily_Svltf.class 2KB
DailyFabiao_Svlt.class 2KB
Login__Svlt.class 2KB
TB_Message.class 2KB
FriendSelAll_Svlt.class 2KB
Pictrue_Svlt.class 2KB
Person_Svlt.class 2KB
DailyChange_Svlt.class 2KB
Register_Svlt.class 2KB
sessionSet.class 2KB
Register_ws_Svlt.class 2KB
DBConnect.class 2KB
TB_Sadiscuss.class 2KB
Person_Svltf.class 2KB
TB_Dadiscuss.class 2KB
TB_Mereturn.class 2KB
Friendlookf_Svlt.class 2KB
Login__Dao.class 2KB
TB_Picture.class 2KB
TB_Pibook.class 2KB
TB_Dareturn.class 2KB
TB_Sareturn.class 2KB
TB_Said.class 2KB
TB_login.class 2KB
Pictrue_Svltf.class 1KB
TB_Pidiscuss.class 1KB
CharSet.class 1KB
Index_Svlt.class 1KB
FriendMain.class 1KB
TB_Pireturn.class 1KB
TB_Datype.class 931B
.classpath 693B
org.eclipse.wst.common.component 468B
org.eclipse.wst.jsdt.ui.superType.container 49B
editor.css 35KB
editor.css 31KB
editor.css 30KB
共 1186 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
xiaoxiaomo_com
- 粉丝: 7
- 资源: 34
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页