📄 merchantgoodssalerecorddao.java
字号:
/*
* 作者:刘云云
* 时间:2007年11月09日
* 功能:库存销售管理->商品管理->商品销售查询(数据库接口)
* 商家操作人员需要就商品,时间等维度进行查询
*/
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;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -