首页>代码>java Struts+Hibernate报价管理系统源代码下载>/baojiaSystem/src/com/sanqing/action/CustomerManageAction.java
package com.sanqing.action;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.sanqing.po.Customer;
import com.sanqing.service.CustomerService;
/**
 * 客户管理action
 */
@Controller("customerManageAction")
@Scope("prototype")
public class CustomerManageAction extends BaseAction {
	@Resource
	private CustomerService customerService;//注入客户业务逻辑组件
	private String customerNO;				//客户编号
	private String customerName;			//客户名称
	private String phone;					//客户电话
	private String address;					//客户地址
	private String relationman;				//客户联系人
	private String otherInfo;				//其他信息
	public String addUI() {					//新增客户输入界面
		return "add";
	}
	public String add() {				//新增客户方法
		Customer customer = new Customer();
		customer.setAddress(address);
		customer.setCustomerNO(customerNO);
		customer.setCustomerName(customerName);
		customer.setOtherInfo(otherInfo);
		customer.setPhone(phone);
		customer.setRelationman(relationman);
		customerService.save(customer);
		return "pub_add_success";
	}
	public String updateUI() {	//该方法用来跳转到客户信息更新表单
		Customer customer = customerService.find(customerNO);//查询该客户编号对应的客户
		HttpServletRequest request = ServletActionContext.getRequest();//获得request对象
		request.setAttribute("customer", customer);//将客户信息保存在request范围
		return "update";//跳转到客户信息更新表单页
	}
	
	public String update() {
		Customer customer = new Customer();
		customer.setAddress(address);
		customer.setCustomerNO(customerNO);
		customer.setCustomerName(customerName);
		customer.setOtherInfo(otherInfo);
		customer.setPhone(phone);
		customer.setRelationman(relationman);
		customerService.update(customer);//更新客户信息
		return "pub_update_success";//跳转到更新成功页面
	}
	/**
	 * 删除客户
	 * @return
	 */
	public String del() {		//删除客户信息
		customerService.delete(customerNO);//根据客户编号删除客户
		return "pub_del_success";//跳转到删除成功页
	}
	/**
	 * 查询客户信息
	 * @return
	 */
	public String query() {
		return "query";
	}
	public String getCustomerNO() {
		return customerNO;
	}
	public void setCustomerNO(String customerNO) {
		this.customerNO = customerNO;
	}
	public String getCustomerName() {
		return customerName;
	}
	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getRelationman() {
		return relationman;
	}
	public void setRelationman(String relationman) {
		this.relationman = relationman;
	}
	public String getOtherInfo() {
		return otherInfo;
	}
	public void setOtherInfo(String otherInfo) {
		this.otherInfo = otherInfo;
	}
	
	
}
最近下载更多
ming_123_9715  LV23 2022年12月9日
..  LV8 2022年2月24日
GLNobody  LV1 2022年1月6日
小洪123  LV4 2021年10月15日
苏叶2516  LV2 2021年5月9日
ericxu1116  LV24 2021年5月1日
admin_z  LV22 2021年4月20日
zhouzhiyi  LV5 2021年3月15日
fenghuang8  LV22 2021年3月11日
z_lying  LV20 2021年1月1日
最近浏览更多
m5433660  LV1 3月28日
WBelong  LV7 2023年12月19日
大道寺芝士 2023年11月26日
暂无贡献等级
WanLiuYun  LV12 2023年11月8日
fesfefe  LV13 2023年9月26日
neilyeh 2023年5月29日
暂无贡献等级
lzn00000  LV1 2023年4月24日
kevinkg  LV12 2023年4月24日
jierffff  LV2 2023年4月20日
uni-code_0123  LV1 2023年3月31日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友