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

📄 userinfoproxy.java

📁 计算机技术的快速发展
💻 JAVA
字号:
package com.suninformation.user;

import java.sql.*;
import com.suninformation.database.DBManager;

/**
 * 用户个人信息操作代理
 *
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2005</p>
 * <p>Company: 沈阳奥克公司职业信息咨询有限责任公司</p>
 * @author 刘镇
 * @version 1.0
 */
public class UserInfoProxy {
    private static final String DELETE_USERINFO =
            "DELETE FROM puserinfo WHERE username=?";
    /**
     * 创建用户信息
     *
     * @param userName String
     * @param realName String
     * @param email String
     * @param birthday Date
     * @return userInfo
     * @throws UserAlreadyExistsException
     * @throws UnacceptableException
     */
    public UserInfo createUserInfo(String userName, String realName,
                                   String email,
                                   Date birthday) throws
            UserAlreadyExistsException, UnacceptableException {
        return new UserInfo(userName, realName, email, birthday);
    }

    /**
     * 获取用户信息实例
     *
     * @param userName String
     * @return user
     * @throws UserNotFoundException
     * @throws UnacceptableException
     */
    public UserInfo getUserInfo(String userName) throws UserNotFoundException,
            UnacceptableException {
        return new UserInfo(userName);
    }

    /**
     * 删除用户信息
     *
     * @param userName String
     * @throws UserNotFoundException
     * @throws UnacceptableException
     */
    public void deleteUserInfo(String userName) throws UserNotFoundException,
            UnacceptableException {
        Connection conn = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        try {
            getUserInfo(userName);
            try {
                conn = DBManager.getConnection();
                pstmt = conn.prepareStatement(DELETE_USERINFO);
                pstmt.setString(1, userName);
                pstmt.execute();
            } catch (Exception e) {
                throw new UnacceptableException("删除用户信息数据失败!", e);
            } finally {
                DBManager.closeObject(conn, pstmt, rs);
            }
        } catch (UserNotFoundException unfe) {
            throw new UserNotFoundException("用户信息不存在。", unfe);
        }
    }
}

⌨️ 快捷键说明

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