📄 orderdao.java
字号:
//----------------------------------------------------------
//$Id: $
//Copyright (c) SHSAFE 2005-2006. All Rights Reserved.
//----------------------------------------------------------
package example.order;
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.OrderDTO;
/**
* @author Michael J Chane
* @version $Revision: $ $Date: $
*/
public class OrderDAO extends ExampleDAO {
/**
* Creates a new <code>OrderDAO</code> object.
*
* @param connection
* @throws SQLException
*/
public OrderDAO(DatabaseConnection connection) throws SQLException {
super(connection);
}
/**
* @return users
* @throws SQLException
*/
@SuppressWarnings("unchecked")
public List<OrderDTO> findAllOrder() throws SQLException {
List<Map<String, Object>> listOrder = findAll("findAllOrder", new HashMap(1));
List<OrderDTO> dtoOrderList = DTOFactory.convert(listOrder, OrderDTO.class);
return dtoOrderList;
}
public List<OrderDTO> findInfoOrder() throws SQLException {
List<Map<String, Object>> listOrder = findAll("findInfoOrder", new HashMap(1));
List<OrderDTO> dtoOrderList = DTOFactory.convert(listOrder, OrderDTO.class);
return dtoOrderList;
}
/**
* @param condition
* @return count of users
* @throws SQLException
*/
public int countOrders(OrderDTO condition) throws SQLException {
return count("countOrders", condition);
}
/**
*
* @param condition
* @param pageInfo
* @return users
* @throws SQLException
*/
public List<OrderDTO> searchOrder(OrderDTO condition, PageInformation pageInfo) throws SQLException {
List<Map<String, Object>> list = findOnPage("searchOrders", condition,
pageInfo);
List<OrderDTO> dtoList = DTOFactory.convert(list, OrderDTO.class);
return dtoList;
}
public OrderDTO searchOne(String orderId) throws SQLException {
Map<String,Object> param = new HashMap<String,Object>();
param.put("orderId", orderId);
Map<String, Object> data = find("findInfoOrder", param);
if(data == null) {
return null;
}
OrderDTO dto = new OrderDTO();
dto.populate(data);
return dto;
}
public OrderDTO searchOne1(String orderId) throws SQLException {
Map<String,Object> param = new HashMap<String,Object>();
param.put("orderId", orderId);
Map<String, Object> data = find("findOrder1", param);
if(data == null) {
return null;
}
OrderDTO dto = new OrderDTO();
dto.populate(data);
return dto;
}
public int saveOrder(OrderDTO condition) throws SQLException {
int count = super.change("saveOrders", condition);
return count;
}
public int modify(OrderDTO condition) throws SQLException {
int count = super.change("updateOrders", condition);
return count;
}
public int modify1(OrderDTO condition) throws SQLException {
int count = super.change("updateOrder", condition);
return count;
}
public int delete(OrderDTO condition) throws SQLException {
int count = super.change("deleteOrders", condition);
return count;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -