首页>代码>SSM实现的进销存管理系统代码分享>/jinxiaocun/src/main/java/com/friday/controller/AddCustomerController.java
package com.friday.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

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

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.friday.model.Customer;
import com.friday.service.CustomerService;
import com.friday.service.impl.CustomerServiceImpl;

public class AddCustomerController implements Controller {

	@Override
	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		Map<String, Object> model = new HashMap<String, Object>();

		try {

			CustomerService customerService = new CustomerServiceImpl();

			Customer customer = new Customer();
			
			String name = request.getParameter("name");
			String phone = request.getParameter("phone");
			String address = request.getParameter("address");
			String bz = request.getParameter("remark");
			
			customer.setcName(name);
			customer.setcPhone(phone);
			customer.setcAddress(address);
			customer.setcNote(bz);
			
			customerService.addCustomer(customer);
			
			List<Customer> list = customerService.queryCustomer();

			model.put("result", list);

			return new ModelAndView("customer_management", model);
		} catch (Exception e) {
			model.put("error", "操作失败");
			e.printStackTrace();
			return new ModelAndView("error", model);
		}
	}

}
最近下载更多
wanglinddad  LV54 4月10日
sunlea  LV17 3月21日
小海脑洞大开  LV11 2月4日
dongandmin  LV6 2023年7月12日
1379585889  LV11 2023年6月7日
lvdong2023  LV10 2023年5月17日
yzshabzbbdvw  LV4 2023年5月16日
哇塞塞哈哈哈  LV8 2023年5月5日
全栈小白  LV33 2023年4月25日
admin789987  LV2 2023年4月20日
最近浏览更多
wanglinddad  LV54 4月10日
WBelong  LV7 3月28日
sunlea  LV17 3月21日
vluobo  LV1 3月19日
光圈3661 3月1日
暂无贡献等级
1134116035 2月24日
暂无贡献等级
test6758  LV2 2月23日
之额着  LV1 2月19日
小海脑洞大开  LV11 2月4日
80730176  LV7 2月1日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友