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

📄 selectcustomeraction.java

📁 一个java程序!!!数据库很特别!!请大家看看!!很有学习和使用的价值
💻 JAVA
字号:
package com.iplan.portal.order.action;

import java.util.ArrayList;
import java.util.List;

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

import org.apache.commons.beanutils.BasicDynaBean;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

import com.iplan.portal.admin.service.IAreaService;
import com.iplan.portal.framework.Constants;
import com.iplan.portal.framework.base.struts.BaseAction;
import com.iplan.portal.order.pojo.Customer;
import com.iplan.portal.order.service.ICustomerService;

/**
 * http://www.5ai7.net
 * 
 * @author ws
 */
public class SelectCustomerAction extends BaseAction {
	ICustomerService customerService;

	IAreaService areaService;

	public ICustomerService getCustomerService() {
		return customerService;
	}

	public void setCustomerService(ICustomerService customerService) {
		this.customerService = customerService;
	}

	public IAreaService getAreaService() {
		return areaService;
	}

	public void setAreaService(IAreaService areaService) {
		this.areaService = areaService;
	}

	public ActionForward list(ActionMapping actionMapping,
			ActionForm actionForm, HttpServletRequest httpServletRequest,
			HttpServletResponse httpServletResponse) throws Exception {
		Customer tempCustomer = null;
		BasicDynaBean bean = null;
		List customerList = new ArrayList();
		DynaActionForm daf = (DynaActionForm) actionForm;
		Customer customer = (Customer) daf.get("customer");

		String areaId = (String) httpServletRequest.getSession().getAttribute(
				"areaid");
		String userId = httpServletRequest.getSession().getAttribute(
				Constants.CURRENT_USER_GUID).toString();
		String customerName = customer.getCustomerName();
		if (customerName == null) {
			customerName = "";
		} else {
			customerName = customerName.trim();
		}

		List list = this.getCustomerService().getCustomerListByCusName(areaId,
				userId, customerName);
		if (list != null && !list.isEmpty()) {
			for (int i = 0; i < list.size(); i++) {
				bean = (BasicDynaBean) list.get(i);
				tempCustomer = new Customer();
				tempCustomer.setCustomerName((String) bean.get("customername"));
				tempCustomer.setAddress((String) bean.get("address"));
				customerList.add(tempCustomer);
			}
		}
		httpServletRequest.setAttribute("customerInfoList", customerList);

		return actionMapping.findForward("SelectCustomerList");
	}

	public ActionForward listByUserId(ActionMapping actionMapping,
			ActionForm actionForm, HttpServletRequest httpServletRequest,
			HttpServletResponse httpServletResponse) throws Exception {
		Customer tempCustomer = null;
		BasicDynaBean bean = null;
		List customerList = new ArrayList();
		DynaActionForm daf = (DynaActionForm) actionForm;
		Customer customer = (Customer) daf.get("customer");

		String userId = httpServletRequest.getSession().getAttribute(
				Constants.CURRENT_USER_GUID).toString();
		String customerName = customer.getCustomerName();
		if (customerName == null) {
			customerName = "";
		} else {
			customerName = customerName.trim();
		}

		List list = this.getCustomerService().getCustomerListByUser(userId,
				customerName);
		if (list != null && !list.isEmpty()) {
			for (int i = 0; i < list.size(); i++) {
				bean = (BasicDynaBean) list.get(i);
				tempCustomer = new Customer();
				tempCustomer.setCustomerName((String) bean.get("customername"));
				tempCustomer.setAddress((String) bean.get("address"));
				customerList.add(tempCustomer);
			}
		}
		httpServletRequest.setAttribute("customerInfoList", customerList);

		return actionMapping.findForward("SelectCustomerList");
	}
}

⌨️ 快捷键说明

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