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

📄 merchantcustomerinfoaction.java

📁 基于struts的网上商店源码
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.mole.struts.action;

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.MerchantCustomerInfoBean;
import com.mole.struts.bean.MerchantVoucherBean;
import com.mole.struts.bean.merchantBusinessRecordDetailBean;
import com.mole.struts.dao.MerchantCustomerBizRecordDAO;
import com.mole.struts.dao.MerchantCustomerInfoDAO;

/**
 * MyEclipse Struts Creation date: 12-29-2007
 * 
 * XDoclet definition:
 * 
 * @struts.action validate="true"
 * @struts.action-forward name="goMerchantCustomerInfo"
 *                        path="/merchantCustomerInfo.jsp"
 */
public class MerchantCustomerInfoAction 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) {
		String storeId = (String) request.getSession().getAttribute("store");
		String customerId = request.getParameter("customerId");

		String action = request.getParameter("action");
		if (action == null || action.equals("detail")) {
			MerchantCustomerInfoDAO dao = new MerchantCustomerInfoDAO();
			String sql = "SELECT ID,LoginName,State,NickName,name,Gender,email,telephone,cellphone,address,company,createDate,lastLogin "
					+ " FROM customer Where Id=" + customerId;
			MerchantCustomerInfoBean bean = dao.getCustomerInfo(sql);
			request.setAttribute("record", bean);

			sql = " SELECT VoucherName,Description,discount,amount,usedAmount FROM v_customerVoucher WHERE storeID='"
					+ storeId + "' AND customerId=" + customerId;
			MerchantVoucherBean[] result = dao.getCustomerVoucher(sql);
			request.setAttribute("result", result);
			request.setAttribute("customerId", customerId);
			return mapping.findForward("goMerchantCustomerInfo");

		} else if (action.equals("bizRecord")) {
			MerchantCustomerBizRecordDAO dao = null;
			Object daoObj = request.getSession().getAttribute("pageDataRecord");
			if (daoObj != null
					&& daoObj instanceof MerchantCustomerBizRecordDAO) {
				dao = (MerchantCustomerBizRecordDAO) daoObj;
			} else {
				String column = "[swiftid],[goodsname],[goodsid],[amount],convert(int ,[factprice])factprice,convert(int ,[nominalprice])nominalprice,convert(decimal(10,2),[discount]) discount,goodsNumber ";
				String where = " v_BusinessRecordDetail WHERE StoreID='"
						+ storeId + "' AND customerId=" + customerId;
				dao = new MerchantCustomerBizRecordDAO(column, where, " ID ",
						null, " ID ", 10);
				request.getSession().setAttribute("pageDataRecord", dao);
			}
			String pageIndex = request.getParameter("pageIndex");
			if (pageIndex != null && !pageIndex.equals("")) {
				dao.setCurrentPage(Integer.parseInt(pageIndex));
				dao.setPageSize(Integer.parseInt(request
						.getParameter("pageSizeSelect")));
			}
			merchantBusinessRecordDetailBean[] bean = dao.getAllBizRecordInfo();
			request.setAttribute("result", bean);
			return mapping.findForward("goMerchantCustomerBizRecord");
		}
		return null;
	}
}

⌨️ 快捷键说明

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