?? merchantgoodssalerecorddao.java
字號:
/*
* 作者:劉云云
* 時間:2007年11月09日
* 功能:庫存銷售管理->商品管理->商品銷售查詢(數(shù)據(jù)庫接口)
* 商家操作人員需要就商品,時間等維度進(jìn)行查詢
*/
package com.mole.struts.dao;
import java.util.ArrayList;
import java.util.Iterator;
import com.mole.struts.bean.MerchantGoodsSaleRecordBean;
public class MerchantGoodsSaleRecordDAO extends AbstractPageDAO {
private String typeId = "0";// 商品類型
private String goodsName;// 商品名稱
private String startDate;// 起始時間
private String endDate;// 終止時間
public MerchantGoodsSaleRecordDAO() {
}
public MerchantGoodsSaleRecordDAO(String column, String where, String id,
String group, String order, int pageSize) {
this.setColumnCondition(column);
this.setWhereCondition(where);
this.setIdCondition(id);
this.setGroupCondition(group);
this.setOrderCondition(order);
this.setPageSize(pageSize);
}
public void setWhere(String table, String storeId, String typeId,
String goodsName, String startDate, String endDate) {
this.typeId = typeId;
this.goodsName = goodsName;
this.startDate = startDate;
this.endDate = endDate;
String where = table + "WHERE StoreID=" + storeId;
if (typeId != null && !typeId.equals("0")) {
where = where + " AND goodsType=" + typeId;
}
if (goodsName != null && !goodsName.equals("")) {
where = where + " AND Name LIKE '%" + goodsName + "%' ";
}
if (startDate != null && !startDate.equals("")) {
where = where + " AND dealtime>='" + startDate + "' ";
}
if (endDate != null && !endDate.equals("")) {
where = where + " AND dealtime<='" + endDate + "' ";
}
this.setWhereCondition(where);
}
// 獲取商品銷售記錄集
public MerchantGoodsSaleRecordBean[] getBusinessRecordPage() {
ArrayList<Object[]> arrayList = this.executeQuery(getSql());
if (arrayList == null)
return null;
MerchantGoodsSaleRecordBean[] records = new MerchantGoodsSaleRecordBean[arrayList
.size()];
Iterator<Object[]> it = arrayList.iterator();
int i = 0;
while (it.hasNext()) {
Object[] obj = it.next();
MerchantGoodsSaleRecordBean record = new MerchantGoodsSaleRecordBean();
record.setName(obj[0].toString());
record.setAmount(Integer.valueOf(obj[1].toString()));
record.setPrice(Double.valueOf(obj[2].toString()));
record.setId(obj[3].toString());
record.setTypeName(obj[4].toString());
records[i++] = record;
}
return records;
}
public String getTypeId() {
return typeId;
}
public String getGoodsName() {
return goodsName;
}
public String getStartDate() {
return startDate;
}
public String getEndDate() {
return endDate;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -