⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 merchantbizgroupsearchaction.java

📁 基于struts的网上商店源码
💻 JAVA
字号:
/*
 * 作者:刘云云
 * 时间:2007年11月28日
 * 功能:我的商业合作->查询现有商圈 
 * 查看现有的商圈
 */
package com.mole.struts.action;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.mole.struts.bean.MerchantBizGroupInfoBean;
import com.mole.struts.bean.MerchantCityInfoBean;
import com.mole.struts.bean.MerchantTypeInfoBean;
import com.mole.struts.dao.MerchantBizGroupSearchDAO;
import com.mole.struts.form.MerchantBizGroupSearchForm;

/**
 * MyEclipse Struts Creation date: 11-26-2007
 * 
 * XDoclet definition:
 * 
 * @struts.action validate="true"
 */
public class MerchantBizGroupSearchAction extends Action {
	/*
	 * Generated Methods
	 */
	/**
	 * Method execute
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {

		MerchantBizGroupInfoBean[] records = null;
		MerchantBizGroupSearchForm msbForm = (MerchantBizGroupSearchForm) form;

		MerchantBizGroupSearchDAO dao = null;
		Object daoObj = request.getSession().getAttribute("pageDataRecord");
		if (daoObj != null && daoObj instanceof MerchantBizGroupSearchDAO) {
			dao = (MerchantBizGroupSearchDAO) daoObj;
		} else {
			Date currentDate = new Date();
			SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
			String dateString = formatter.format(currentDate);

			String column = " ID,name,activityDes,startDate,endDate,activityId,state,StoreID,StoreName,"
					+ "typeName,cityName,areaName,ISNULL(typeName2,''),ISNULL(typeName3,''),ISNULL(typeName4,'') ";
			String where = " v_bizGroupInfo WHERE state<>3 AND state<>2 AND '"
					+ dateString + "'<=endDate ";
			dao = new MerchantBizGroupSearchDAO(column, where, " ID ", null,
					"ID", 10);
			request.getSession().setAttribute("pageDataRecord", dao);
		}

		String action = request.getParameter("action");
		if (action == null) {
			String pageIndex = msbForm.getPageIndex();
			if (pageIndex != null && !pageIndex.equals("")) {
				dao.setCurrentPage(Integer.parseInt(pageIndex));
				dao.setPageSize(Integer.parseInt(msbForm.getPageSizeSelect()));
			}
		} else if (action.equals("query")) {
			dao.setWhere(msbForm.getActivityId(), msbForm.getCityId(), msbForm
					.getTypeId());
			dao.setCurrentPage(1);
		}
		String sql = "SELECT ID,Name FROM city";
		MerchantCityInfoBean[] cityInfo = dao.getAllCityInfo(sql);
		request.setAttribute("cityInfo", cityInfo);

		sql = "SELECT ID,Name FROM storeType";
		MerchantTypeInfoBean[] typeInfo = dao.getAllTypeInfo(sql);
		request.setAttribute("typeInfo", typeInfo);

		records = dao.getBizGroupPage();
		request.setAttribute("result", records);
		return mapping.findForward("goMerchantBizGroupSearch");
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -