📄 merchantbizgroupsearchdao.java
字号:
/*
* 作者:刘云云
* 时间:2007年11月28日
* 功能:我的商业合作->查询现有商圈
* 查看现有的商圈
*/
package com.mole.struts.dao;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import com.mole.struts.bean.MerchantBizGroupInfoBean;
import com.mole.struts.bean.MerchantCityInfoBean;
import com.mole.struts.bean.MerchantTypeInfoBean;
public class MerchantBizGroupSearchDAO extends AbstractPageDAO {
private String activityId;
private String cityId;
private String typeId;
public MerchantBizGroupSearchDAO() {
}
public MerchantBizGroupSearchDAO(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 activityId, String cityId, String typeId) {
this.activityId = activityId;
this.cityId = cityId;
this.typeId = typeId;
Date currentDate = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(currentDate);
String where = " v_bizGroupInfo WHERE state<>3 AND state<>2 AND '"
+ dateString + "'<=endDate ";
if (activityId != null && !activityId.equals("0"))
where = where + " AND activityId=" + activityId;
if (cityId != null && !cityId.equals("0"))
where = where + " AND cityId=" + cityId;
if (typeId != null && !typeId.equals("0"))
where = where + " AND (typeId=" + typeId + " OR typeId2=" + typeId
+ " OR typeId3=" + typeId + " OR typeId4=" + typeId + ") ";
this.setWhereCondition(where);
}
// 获取现有商圈的记录集
public MerchantBizGroupInfoBean[] getBizGroupPage() {
ArrayList<Object[]> arrayList = this.executeQuery(getSql());
if (arrayList == null)
return null;
MerchantBizGroupInfoBean[] records = new MerchantBizGroupInfoBean[arrayList
.size()];
if (records.length == 0)
return records;
Iterator<Object[]> it = arrayList.iterator();
int i = 0;
while (it.hasNext()) {
Object[] obj = it.next();
MerchantBizGroupInfoBean record = new MerchantBizGroupInfoBean();
record.setId(obj[0].toString());
record.setName(obj[1].toString());
record.setActivityDes(obj[2].toString());
record.setStartDate(obj[3].toString().substring(0, 10));
record.setEndDate(obj[4].toString().substring(0, 10));
record.setActivityId(obj[5].toString());
record.setState(Integer.parseInt(obj[6].toString()));
record.setStoreId(obj[7].toString());
record.setStoreName(obj[8].toString());
record.setTypeName(obj[9].toString());
record.setCityName(obj[10].toString());
record.setAreaName(obj[11].toString());
record.setTypeName2(obj[12].toString());
record.setTypeName3(obj[13].toString());
record.setTypeName4(obj[14].toString());
Date currentDate = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(currentDate);
if (record.getState() == 3) {
record.setTig("delete");
} else if (record.getState() == 2
|| (record.getState() == 1 && dateString.compareTo(record
.getEndDate()) > 0)
|| (record.getState() == 0 && dateString.compareTo(record
.getEndDate()) > 0)) {
record.setTig("end");
} else if (record.getState() == 1
|| (record.getState() == 0
&& dateString.compareTo(record.getEndDate()) <= 0 && dateString
.compareTo(record.getStartDate()) >= 0)) {
record.setTig("start");
} else {
record.setTig("ready");
}
records[i++] = record;
}
return records;
}
// 获取城市信息记录集
public MerchantCityInfoBean[] getAllCityInfo(String sql) {
ArrayList<Object[]> arrayList = this.executeQuery(sql);
if (arrayList == null)
return null;
MerchantCityInfoBean[] records = new MerchantCityInfoBean[arrayList
.size()];
if (records.length == 0)
return records;
Iterator<Object[]> it = arrayList.iterator();
int i = 0;
while (it.hasNext()) {
Object[] obj = it.next();
MerchantCityInfoBean record = new MerchantCityInfoBean();
record.setId(obj[0].toString());
record.setName(obj[1].toString());
records[i++] = record;
}
return records;
}
// 获取商圈类型的记录集
public MerchantTypeInfoBean[] getAllTypeInfo(String sql) {
ArrayList<Object[]> arrayList = this.executeQuery(sql);
if (arrayList == null)
return null;
MerchantTypeInfoBean[] records = new MerchantTypeInfoBean[arrayList
.size()];
if (records.length == 0)
return records;
Iterator<Object[]> it = arrayList.iterator();
int i = 0;
while (it.hasNext()) {
Object[] obj = it.next();
MerchantTypeInfoBean record = new MerchantTypeInfoBean();
record.setId(obj[0].toString());
record.setName(obj[1].toString());
records[i++] = record;
}
return records;
}
public String getActivityId() {
return activityId;
}
public String getCityId() {
return cityId;
}
public String getTypeId() {
return typeId;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -