📄 cartbo.java
字号:
package test.bo;
import java.util.*;
import java.sql.*;
import test.db.*;
import test.models.*;
public class CartBO {
public CartBO() {
}
public Collection searchItem(String strSql){
Collection ret = new ArrayList();
try {
DBAccess dba = new DBAccess();
ResultSet rs = dba.openSelect(strSql);
while (rs.next()) {
Item temp = new Item();
temp.setItemId(rs.getString("itemid"));
temp.setProductId(rs.getString("productid"));
// Product product=new Product();
// temp.setProduct(product);
temp.getProduct().setName(rs.getString("name"));
temp.setListPrice(rs.getBigDecimal("listprice"));
temp.setUnitCost(rs.getBigDecimal("unitcost"));
temp.setSupplier(rs.getString("supplier"));
ret.add(temp);
}
}
catch (Exception ex) {
ex.printStackTrace();
}
return ret;
}
public Item getCartItem(String strSql){
Item item=new Item();
try
{
DBAccess dba = new DBAccess();
ResultSet rs = dba.openSelect(strSql);
while(rs.next())
{
item.setItemId(rs.getString("itemid"));
item.setProductId(rs.getString("productid"));
item.setListPrice(rs.getBigDecimal("listprice"));
item.setSupplier(rs.getString("supplier"));
item.setStatus(rs.getString("status"));
item.setAttribute1(rs.getString("attr1"));
item.setAttribute2(rs.getString("attr2"));
item.setAttribute3(rs.getString("attr3"));
item.setAttribute4(rs.getString("attr4"));
item.setAttribute5(rs.getString("attr5"));
item.getProduct().setName(rs.getString("name"));
item.getProduct().setProductId(rs.getString("productid"));
}
}
catch(Exception e)
{
e.printStackTrace();
}
return item;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -