customerbusiness.java

来自「hibernate+spring+ext2.0 的物流网站」· Java 代码 · 共 101 行

JAVA
101
字号
package com.bu.mars;

import java.util.*;
import com.struts.form.*;
import com.po.*;
import com.service.DAOService;

public class Customerbusiness implements ibusiness {
	private DAOService daos;
	public boolean delete(String id) {
		// TODO Auto-generated method stub
		CustomerInfo cus=daos.getCustomerinfodao().findById(new Integer(id));
		try {
			daos.getCustomerinfodao().delete(cus);
			return true;
		} catch (RuntimeException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}

	public Vector findAll() {
		// TODO Auto-generated method stub
		Vector cusvc=new Vector();
		List ls=daos.getCustomerinfodao().findAll();
		for (Object object : ls) {
			CustomerInfo cus=(CustomerInfo)object;
			MarsCustomerInfoForm cusf=new MarsCustomerInfoForm();
			cusf.setCustomerid(cus.getCustomerId().toString());
			cusf.setCustomername(cus.getCustomerName());
			cusf.setCustomerlinkman(cus.getCustomerLinkMan());
			cusf.setCustomersex(cus.getCustomerSex());
			cusf.setCustomerphone(cus.getCustomerPhone());
			cusf.setCustomerfax(cus.getCustomerFax());
			cusf.setCustomerpostid(cus.getCustomerPostId());
			cusf.setCustomeremail(cus.getCustomerEmail());
			cusf.setCustomerregdata(cus.getCustomerRegData());
			cusf.setBranchid(cus.getBranchInfo().getBranchName());
			cusvc.add(cusf);
		}
		return cusvc;
	}
	public Vector findByAll(String id){
		Vector cusvc=new Vector();
		List ls=daos.getCustomerinfodao().findByAll(id);
		for (Object object : ls) {
			CustomerInfo cus=(CustomerInfo)object;
			MarsCustomerInfoForm cusf=new MarsCustomerInfoForm();
			cusf.setCustomerid(cus.getCustomerId().toString());
			cusf.setCustomername(cus.getCustomerName());
			cusf.setCustomerlinkman(cus.getCustomerLinkMan());
			cusf.setCustomersex(cus.getCustomerSex());
			cusf.setCustomerphone(cus.getCustomerPhone());
			cusf.setCustomerfax(cus.getCustomerFax());
			cusf.setCustomerpostid(cus.getCustomerPostId());
			cusf.setCustomeremail(cus.getCustomerEmail());
			cusf.setCustomerregdata(cus.getCustomerRegData());
			cusf.setBranchid(cus.getBranchInfo().getBranchName());
			cusvc.add(cusf);
		}
		return cusvc;
	}
	public Object findById(String id) {
		// TODO Auto-generated method stub
		CustomerInfo cus=daos.getCustomerinfodao().findById(new Integer(id));
		MarsCustomerInfoForm cusf=new MarsCustomerInfoForm();
		cusf.setCustomerid(cus.getCustomerId().toString());
		cusf.setCustomername(cus.getCustomerName());
		cusf.setCustomerlinkman(cus.getCustomerLinkMan());
		cusf.setCustomersex(cus.getCustomerSex());
		cusf.setCustomerphone(cus.getCustomerPhone());
		cusf.setCustomerfax(cus.getCustomerFax());
		cusf.setCustomerpostid(cus.getCustomerPostId());
		cusf.setCustomeremail(cus.getCustomerEmail());
		cusf.setCustomerregdata(cus.getCustomerRegData());
		cusf.setBranchid(cus.getBranchInfo().getBranchId().toString());
		
		return cusf;
	}

	public boolean save(Object ob) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean update(Object ob) {
		// TODO Auto-generated method stub
		return false;
	}

	public DAOService getDaos() {
		return daos;
	}

	public void setDaos(DAOService daos) {
		this.daos = daos;
	}

}

⌨️ 快捷键说明

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