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

📄 customeraction.java

📁 java开发购物车+网上书城
💻 JAVA
字号:
package com.xaccp.aj3q8073.action;

import java.util.List;

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

import com.xaccp.aj3q8073.controller.Action;
import com.xaccp.aj3q8073.controller.ActionForward;
import com.xaccp.aj3q8073.dao.CustomerInfoDao;

/**
 * 客户管理
 * @author Administrator
 *
 */
public class CustomerAction implements Action {
	CustomerInfoDao dao=new CustomerInfoDao();
	/**
	 * 查找所有客户信息
	 */
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		List list= dao.execute();
		request.setAttribute("count", list.size());
		request.setAttribute("user", list);
		return new ActionForward("/background/customerInformationList.jsp");
	}

	/**
	 * 查找个人信息
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	public ActionForward findCur(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String id=request.getParameter("id");
		Object obj= dao.findCur(Integer.parseInt(id));
		request.setAttribute("user_Info", obj);
		return new ActionForward("/background/browUser.jsp");
	}
	
	/**
	 * 根据用户id或者昵称查询用户
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	public ActionForward findCurByIdOrName(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String id=request.getParameter("id");
		System.out.println(id);
		List list= dao.findCurByIdOrName(id);
		request.setAttribute("count", list.size());
		request.setAttribute("user", list);
		return new ActionForward("/background/customerInformationList.jsp");
	}
	
	/**
	 * 删除客户前先看客户有没有订单记录然后删除
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	public ActionForward delCur(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String id=request.getParameter("id");
		List list= dao.findIsOrder(Integer.parseInt(id));
		if(list.size()==0){
			int i= dao.delCur(Integer.parseInt(id));
			if(i>0){
				return new ActionForward("/customer.do");
			}
		}else{
			return new ActionForward("/background/delUser.jsp");
		}
		return null;
	}
	
}

⌨️ 快捷键说明

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