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

📄 petinfodao.java

📁 网上购物系统
💻 JAVA
字号:
// ----------------------------------------------------------
// $Id: $
// Copyright (c) SHSAFE 2005-2006. All Rights Reserved.
// ----------------------------------------------------------
package example.petInfo;

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

import com.shsafe.common.basic.attribute.PageInformation;
import com.shsafe.common.basic.dto.DTOFactory;
import com.shsafe.common.database.DatabaseConnection;

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

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

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

  /**
   * @param condition
   * @return count of users
   * @throws SQLException
   */
  public int countUsers(PetInfoDTO condition) throws SQLException {
    return count("searchPets", condition);
  }

  /**
   * @return users
   * @throws SQLException
   */
  @SuppressWarnings("unchecked")
  public List<PetInfoDTO> findAll() throws SQLException {
    List<Map<String, Object>> list = findAll("findAll", new HashMap(1));
    List<PetInfoDTO> dtoList = DTOFactory.convert(list, PetInfoDTO.class);
    return dtoList;
  }
  
  /**
   * 
   * @param userId
   * @return User
   * @throws SQLException
   */
  public PetInfoDTO findByPrimaryKey(String userId) throws SQLException {
    Map<String, Object> param = new HashMap<String, Object>();
    param.put("petNo", userId);
    Map<String, Object> data = find("findByPrimaryKey", param);
    if (data == null) {
      return null;
    }
    PetInfoDTO user = new PetInfoDTO();
    user.populate(data);
    return user;
  } 
  
  /**
   * @param condition
   * @param pageInfo
   * @return users
   * @throws SQLException
   */
  @SuppressWarnings("unchecked")
  public List<PetInfoDTO> searchUsers(PetInfoDTO condition, PageInformation pageInfo)
      throws SQLException {
    List<Map<String, Object>> list = findOnPage("searchUsers", condition,
        pageInfo);
    List<PetInfoDTO> dtoList = DTOFactory.convert(list, PetInfoDTO.class);
    return dtoList;
  }

  /**
   * @param users
   * @return rows affected
   * @throws SQLException
   */
  @SuppressWarnings("unchecked")
  public int updateUsers(List users) throws SQLException {
    return changeAll("updateUsers", users);
  }
}

⌨️ 快捷键说明

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