⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userdao.java

📁 一个不错的bbs论坛系统.对初学者很有帮助
💻 JAVA
字号:
package com.yhbbs.user.itface.dao;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import com.yhbbs.bbs.bean.WealthDtoIm;
import com.yhbbs.user.itface.bean.ArtMoney;
import com.yhbbs.user.itface.bean.User;
import com.yhbbs.user.itface.bean.UserIndex;
import com.yhbbs.user.itface.bean.UserLgDto;
import com.yhbbs.user.itface.bean.UserSession;

/**
 * <p>Title:论坛用户数据存取模块Interface</p>
 * <li> 论坛用户数据存取模块 <br>
 * <br><b>WebSite: www.yyhweb.com</b>
 * <br><b>CopyRight: yyhweb[由由华网]</b>
 * @author stephen
 * @version YHBBS-2.0
 */
public interface UserDao {
	
	/** 根据ID取得用户信息
	 * @param userid 用户ID
	 * @return User 论坛用户
	 * @throws SQLException
	 */
	public abstract User getUser(int userid) throws SQLException;

	/** 根据ID取得用户信息
	 * @param userid 用户ID
	 * @return UserIndex 论坛首页用户
	 * @throws SQLException
	 */
	public abstract UserIndex getIndexUser(int userid) throws SQLException;
	
	/** 根据username取得用户信息
	 * @param username 用户名称
	 * @return User 论坛用户
	 * @throws SQLException
	 */
	public abstract User getUser(String username) throws SQLException;
	
	/** 根据用户名取得Id或者判断一个用户是否存在
	 * @param username 用户名称
	 * @return 用户Id
	 * @throws SQLException
	 */
	public abstract int getUserId(String username) throws SQLException;
	
	/** 根据用户Id取得用户名
	 * @param userId 用户Id
	 * @return 用户名称
	 * @throws SQLException
	 */
	public abstract String getUserName(int userId) throws SQLException;
	
	/** 判断一个email是否已经被注册
	 * @param email 用户Email
	 * @return 用户个数
	 * @throws SQLException
	 */
	public abstract int getUserMail(String email) throws SQLException;
	
	/** 由用户Id取得用户e_mail
	 * @param userId 用户Id
	 * @return 用户e_mail
	 * @throws SQLException
	 */
	public abstract String getUserMail(int userId) throws SQLException;
	
	/** 增加一个论坛用户
	 * @param user 论坛用户
	 * @throws SQLException
	 */
	public abstract void addUser(User user) throws SQLException;

	/** 返回用户Id
	 * @param userMap 正登录的用户名和密码
	 * @return 用户Id
	 * @throws SQLException
	 */
	public abstract int userLogin(HashMap userMap) throws SQLException;
	
	/** 从cookie读取用户时,更新该用户在线信息
	 * @param userId 用户Id
	 * @throws SQLException
	 */
	public abstract void upUserLogin(int userId) throws SQLException;
	
	/** 用户登录的时,更新该用户信息
	 * @param user 论坛登录用户相关信息
	 * @throws SQLException
	 */
	public abstract void upUserLogin(UserLgDto user) throws SQLException;
	
	/** 取得在线用户信息
	 * @param userId 用户Id
	 * @return 在线用户信息
	 * @throws SQLException
	 */
	public abstract UserSession getOnlineUser(int userId) throws SQLException;
	
	/** 用户退出时,更新该用户信息
	 * @param userId 用户Id
	 * @throws SQLException
	 */
	public abstract void upUserlogout(int userId) throws SQLException;
	
	/** 更新(编辑)用户信息
	 * @param user 论坛用户
	 * @param flag true:用户修改 false:管理员修改
	 * @return 成功:true 失败:false
	 * @throws SQLException
	 */
	public abstract boolean editUser(User user,boolean flag) throws SQLException;
	
	/** 发表主题贴后更新用户财富和主题数目
	 * @param userWth 用户财富信息
	 * @param flag true:发表主题贴 false:发表回复
	 * @throws SQLException
	 */
	public abstract void postArticle(WealthDtoIm userWth,boolean flag) throws SQLException;
	
	/** 当用户的帖子设置为精华时,更新用户信息
	 * @param userWth 用户财富信息
	 * @param flag true:设置精华 false:取消精华
	 * @throws SQLException
	 */
	public abstract void eliteArticle(WealthDtoIm userWth,boolean flag) throws SQLException;
	
	/** 当用户的主题帖子被删除时,更新用户信息
	 * @param userWth 用户财富信息
	 * @param flag true:删主题贴 false:删回复贴
	 * @throws SQLException
	 */
	public abstract void deleteArticle(WealthDtoIm userWth,boolean flag) throws SQLException;
	
	/** 取得论坛注册用户数
	 * @return int 论坛注册用户数
	 * @throws SQLException
	 */
	public abstract int getUsersCount() throws SQLException;
	
	/** 取得注册用户最大ID
	 * @return int 注册用户最大ID
	 * @throws SQLException
	 */
	public abstract int getMaxUserId() throws SQLException;

	/** 取得某组的所有用户
	 * @param groupid 用户组ID
	 * @return list 所有用户
	 * @throws SQLException
	 */
	public abstract List getAllGroupUsers(int groupid) throws SQLException;
	
	/** 取得某类型的所有用户
	 * @param typeid 用户类型ID
	 * @return list 所有用户
	 * @throws SQLException
	 */
	public abstract List getAllTypeUsers(int typeid) throws SQLException;
	
	/** 根据regtime取得所有用户信息
	 * @param userlistpage start 数据库查询开始 ,end 数据库查询结束
	 * @return list 所有用户信息
	 * @throws SQLException
	 */
	public abstract List getUserByRegTime(HashMap userlistpage) throws SQLException;
	
	/** 根据发帖子数取得所有用户信息
	 * @param userlistpage start 数据库查询开始 ,end 数据库查询结束
	 * @return list 所有用户信息
	 * @throws SQLException
	 */
	public abstract List getUserByPost(HashMap userlistpage) throws SQLException;
	
	/** 取得最近20个注册用户
	 * @return list 最近20个注册用户
	 * @throws SQLException
	 */
	public abstract List get20RegUsers() throws SQLException;
	
	/** 取得发帖子数最多的20个用户
	 * @return list 发帖子数最多的20个用户
	 * @throws SQLException
	 */
	public abstract List get20PostUsers() throws SQLException;
	
	/** 取得一个最新用户
	 * @return UserSession 论坛用户(只有用户Id和名称)
	 * @throws SQLException
	 */
	public abstract UserSession getNewUser() throws SQLException;

	/** 取得今天过生日的所有用户
	 * @return list 今天过生日的所有用户
	 * @throws SQLException
	 */
	public abstract List getBirthDayUser() throws SQLException;
	
	/** 当用户发表\回复\被删除帖子时更新用户相应数量和财富
	 * @param artMoney 包含用户Id\财富和帖子信息
	 * @return 成功:ture  失败:false
	 * @throws SQLException
	 */
	public abstract boolean upUserWealth(ArtMoney artMoney) throws SQLException;
	
	/** 取得用户发表的帖子数和用户当前等级
	 * @param userId 用户Id
	 * @return user (postnum and grade)
	 * @throws SQLException
	 */
	public abstract User getPostGrade(int userId) throws SQLException;
	
	/** 用户发表帖子数满足升级条件,用户升级
	 * @param userId 用户Id
	 * @throws SQLException
	 */
	public abstract void userUpGrade(int userId) throws SQLException;
	
	/** 用户被删帖子时检查用户帖子总数是否满足当前等级条件,不满足则降级
	 * @param userId 用户Id
	 * @throws SQLException
	 */
	public abstract void userDownGrade(int userId) throws SQLException;
	
	/** 以下为管理后台用到 */
	
	/** 取得用户列表
	 * @param selectMap 查询开始位置和查询长度
	 * @return 用户列表
	 * @throws SQLException
	 */
	public abstract List getUsers(HashMap selectMap) throws SQLException;
	
	/** 删除一个用户
	 * @param userId 用户Id
	 * @return 成功:ture  失败:false
	 * @throws SQLException
	 */
	public abstract boolean deleteUser(int userId) throws SQLException;
	
	/** 当用户被设置为版主时候,更新其类型。
	 * @param userName 用户名称
	 * @param userType 用户类型
	 * @return 成功:ture  失败:false
	 * @throws SQLException
	 */
	public abstract boolean updateUserType(String userName,int userType) throws SQLException;
		
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -