logindao.java

来自「网上购物系统」· Java 代码 · 共 51 行

JAVA
51
字号
// ----------------------------------------------------------
// $Id: $
// Copyright (c) SHSAFE 2005-2006. All Rights Reserved.
// ----------------------------------------------------------
package example.login;

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

import com.shsafe.common.database.DatabaseConnection;

import example.common.dao.ExampleDAO;
import example.common.dto.UserDTO;

/**
 * @author Michael J Chane
 * @version $Revision: $ $Date: $
 */
public class LoginDAO extends ExampleDAO {

  /**
   * Creates a new <code>LoginDAO</code> object.
   * 
   * @param connection
   * @throws SQLException
   */
  public LoginDAO(DatabaseConnection connection) throws SQLException {
    super(connection);
  }

  
  /**
   * 
   * @param userId
   * @return User
   * @throws SQLException
   */
  public UserDTO findByPrimaryKey(String userId) throws SQLException {
    Map<String, Object> param = new HashMap<String, Object>();
    param.put("userId", userId);
    Map<String, Object> data = find("findByPrimaryKey", param);
    if (data == null) {
      return null;
    }
    UserDTO user = new UserDTO();
    user.populate(data);
    return user;
  } 
}

⌨️ 快捷键说明

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