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

📄 customer.java

📁 (Java+SQL)-大型企业JAVA的ERP系统
💻 JAVA
字号:
package src.wuyang;

import src.com.*;
import java.sql.*;
import java.io.*;


public class Customer extends ShangObject 
{
   
   /**
客户编号
   */
   private String customerId;
   
   /**
客户名称
   */
   private String customerName;
   
   /**
所在省份
   */
   private String province;
   
   /**
所在城市
   */
   private String city;
   
   /**
具体地址
   */
   private String address;
   
   /**
邮编
   */
   private String zip;
   
   /**
电话
   */
   private String telephone;
   
   /**
传真
   */
   private String fax;
   
   /**
税号
   */
   private String tax;
   
   /**
开户银行
   */
   private String bank;
   
   /**
银行帐号
   */
   private String bankAccount;
   
   /**
电子邮件
   */
   private String email;
   
   /**
法人代表
   */
   private String owner;
   
   /**
联系人
   */
   private String linkman;
   
   /**
联系人电话
   */
   private String linkmanPhone;
   
   /**
创建人
   */
   private String creator;
   
   /**
交易次数
   */
   private int dealTimes;
   
   /**
迟付次数
   */
   private int lateTimes;
   
   /**
未交清次数
   */
   private int unpayTimes;
   
   /**
客户信誉度
   */
   private int satisfy;
   
   public Customer() 
   {
   	primarykey1Name = "customerId"; 
	primarykey1Type = 1; 
	tableName = "Customer";  
	viewName = "Customer";
	numInOnePager = 10;	
   }
   

public int loadAttr() {
    try{
	customerId = getRsString(rs,"customerId");
	customerName = getRsString(rs,"customerName");
        province = getRsString(rs,"province");
        city = getRsString(rs,"city");
        address = getRsString(rs,"address");
        zip = getRsString(rs,"zip");
        telephone = getRsString(rs,"telephone");
        fax = getRsString(rs,"fax");
        tax = getRsString(rs,"tax");
        bank = getRsString(rs,"bank");
        bankAccount = getRsString(rs,"bankAccount");
        email = getRsString(rs,"email");
        owner = getRsString(rs,"owner");
        linkman = getRsString(rs,"linkman");
        linkmanPhone = getRsString(rs,"linkmanPhone");
        creator = getRsString(rs,"creator");
        dealTimes = rs.getInt("dealTimes");
        lateTimes = rs.getInt("lateTimes");
        unpayTimes = rs.getInt("unpayTimes");
        satisfy = rs.getInt("satisfy");
     } catch(SQLException e) {
   	 e.printStackTrace();
   	 System.out.println("query failed!");
   	 return -1;
      }
      return 1;
    }  
   

/*
	@loginName varchar(30) 
	,@ip varchar(20) 
	,@machineName varchar(30) 
	,@customerId varchar(10)
	,@customerName varchar(50)
	,@province    varchar(10)
	,@city        varchar(10)
	,@address     varchar(50)
	,@zip         varchar(10)
	,@telephone   varchar(10)
	,@fax	varchar(20)
	,@tax	varchar(20)
	,@bank	varchar(30)
	,@bankAccount varchar(30)
	,@email	varchar(30)
	,@owner	varchar(20)
	,@linkman	varchar(20)
	,@linkmanPhone	varchar(10)
	
	,@dealTimes	int
	,@lateTimes	int
	,@unPayTimes	int
	,@satisfy	tinyint
*/
public int insert(){
	String sql = "{?=Call sp_InsertCustomer (?,?,?,?,?,?,?,?,?,? ,?,?,?,?,?,?,?,?,?,?, ?,?)}";
	try{
		CallableStatement updStmt = conn.prepareCall(sql);
		updStmt.registerOutParameter(1,java.sql.Types.INTEGER);
		setStmtString(updStmt,2,theGlobal.loginName);
		setStmtString(updStmt,3,theGlobal.ip);
		setStmtString(updStmt,4,theGlobal.machineName);
		setStmtString(updStmt,5,customerId);
		setStmtString(updStmt,6,customerName);
		setStmtString(updStmt,7,province);
		setStmtString(updStmt,8,city);
		setStmtString(updStmt,9,address);
		setStmtString(updStmt,10,zip);
		setStmtString(updStmt,11,telephone);
		setStmtString(updStmt,12,fax);
		setStmtString(updStmt,13,tax);
		setStmtString(updStmt,14,bank);
		setStmtString(updStmt,15,bankAccount);
		setStmtString(updStmt,16,email);
		setStmtString(updStmt,17,owner);
		setStmtString(updStmt,18,linkman);
		setStmtString(updStmt,19,linkmanPhone);
		updStmt.setInt(20,dealTimes);
		updStmt.setInt(21,lateTimes);
		updStmt.setInt(22,unpayTimes);
		updStmt.setInt(23,satisfy);
		
		updStmt.executeUpdate();
		int rtcode = updStmt.getInt(1);
		updStmt.close();
		return rtcode;
		
	}catch(SQLException e){
		 System.out.println(e.getMessage());
   		e.printStackTrace();
   		return -1;
   		}	
     }	
     


public int update(){
	String sql = "{?=Call sp_UpdateCustomer (?,?,?,?,?,?,?,?,?,? ,?,?,?,?,?,?,?,?,?,?, ?,?)}";
	try{
		CallableStatement updStmt = conn.prepareCall(sql);
		updStmt.registerOutParameter(1,java.sql.Types.INTEGER);
		setStmtString(updStmt,2,theGlobal.loginName);
		setStmtString(updStmt,3,theGlobal.ip);
		setStmtString(updStmt,4,theGlobal.machineName);
		setStmtString(updStmt,5,customerId);
		setStmtString(updStmt,6,customerName);
		setStmtString(updStmt,7,province);
		setStmtString(updStmt,8,city);
		setStmtString(updStmt,9,address);
		setStmtString(updStmt,10,zip);
		setStmtString(updStmt,11,telephone);
		setStmtString(updStmt,12,fax);
		setStmtString(updStmt,13,tax);
		setStmtString(updStmt,14,bank);
		setStmtString(updStmt,15,bankAccount);
		setStmtString(updStmt,16,email);
		setStmtString(updStmt,17,owner);
		setStmtString(updStmt,18,linkman);
		setStmtString(updStmt,19,linkmanPhone);
		updStmt.setInt(20,dealTimes);
		updStmt.setInt(21,lateTimes);
		updStmt.setInt(22,unpayTimes);
		updStmt.setInt(23,satisfy);
		
		updStmt.executeUpdate();
		int rtcode = updStmt.getInt(1);
		updStmt.close();
		return rtcode;
		
	}catch(SQLException e){
		 System.out.println(e.getMessage());
   		e.printStackTrace();
   		return -1;
   		}	
     }	
     
     

public String getWhereClause(javax.servlet.ServletRequest request) {
    	String whereClause = "";
    	String str;

    	int queryMode = (new Integer(request.getParameter("queryMode"))).intValue();
	switch(queryMode)
	{
		case 1: // 综合查询
			whereClause = addWhereClause(whereClause, "customerId", "=", "'", request.getParameter("customerId"));
			whereClause = addWhereClause(whereClause, "customerName", "like", "'", request.getParameter("customerName"));
			whereClause = addWhereClause(whereClause, "province", "like", "'", request.getParameter("province"));
			whereClause = addWhereClause(whereClause, "city", "like", "'", request.getParameter("city"));
			whereClause = addWhereClause(whereClause, "address", "like", "'", request.getParameter("address"));
			whereClause = addWhereClause(whereClause, "telephone", "=", "'", request.getParameter("telephone"));
			whereClause = addWhereClause(whereClause, "email", "like", "'", request.getParameter("email"));
			whereClause = addWhereClause(whereClause, "owner", "like", "'", request.getParameter("owner"));
			whereClause = addWhereClause(whereClause, "linkman", "like", "'", request.getParameter("linkman"));
			
			break;
			
		case 2: 
			whereClause = addWhereClause(whereClause,"customerId","=","'",request.getParameter("customerId"));
			break;

	}
    	return whereClause;
    }
    
    

   /**
* Access method for the customerId property.
*
* @return   the current value of the customerId property
   */
   public String getCustomerId() {
      return customerId;}
   
   /**
* Sets the value of the customerId property.
*
* @param aCustomerId the new value of the customerId property
   */
   public void setCustomerId(String aCustomerId) {
      customerId = setChnString(aCustomerId);}
   
   /**
* Access method for the customerName property.
*
* @return   the current value of the customerName property
   */
   public String getCustomerName() {
      return customerName;}
   
   /**
* Sets the value of the customerName property.
*
* @param aCustomerName the new value of the customerName property
   */
   public void setCustomerName(String aCustomerName) {
      customerName = setChnString(aCustomerName);}
   
   /**
* Access method for the province property.
*
* @return   the current value of the province property
   */
   public String getProvince() {
      return province;}
   
   /**
* Sets the value of the province property.
*
* @param aProvince the new value of the province property
   */
   public void setProvince(String aProvince) {
      province = setChnString(aProvince);}
   
   /**
* Access method for the city property.
*
* @return   the current value of the city property
   */
   public String getCity() {
      return city;}
   
   /**
* Sets the value of the city property.
*
* @param aCity the new value of the city property
   */
   public void setCity(String aCity) {
      city = setChnString(aCity);}
   
   /**
* Access method for the address property.
*
* @return   the current value of the address property
   */
   public String getAddress() {
      return address;}
   
   /**
* Sets the value of the address property.
*
* @param aAddress the new value of the address property
   */
   public void setAddress(String aAddress) {
      address = setChnString(aAddress);}
   
   /**
* Access method for the zip property.
*
* @return   the current value of the zip property
   */
   public String getZip() {
      return zip;}
   
   /**
* Sets the value of the zip property.
*
* @param aZip the new value of the zip property
   */
   public void setZip(String aZip) {
      zip = setChnString(aZip);}
   
   /**
* Access method for the telephone property.
*
* @return   the current value of the telephone property
   */
   public String getTelephone() {
      return telephone;}
   
   /**
* Sets the value of the telephone property.
*
* @param aTelephone the new value of the telephone property
   */
   public void setTelephone(String aTelephone) {
      telephone = setChnString(aTelephone);}
   
   /**
* Access method for the fax property.
*
* @return   the current value of the fax property
   */
   public String getFax() {
      return fax;}
   
   /**
* Sets the value of the fax property.
*
* @param aFax the new value of the fax property
   */
   public void setFax(String aFax) {
      fax = setChnString(aFax);}
   
   /**
* Access method for the tax property.
*
* @return   the current value of the tax property
   */
   public String getTax() {
      return tax;}
   
   /**
* Sets the value of the tax property.
*
* @param aTax the new value of the tax property
   */
   public void setTax(String aTax) {
      tax = setChnString(aTax);}
   
   /**
* Access method for the bank property.
*
* @return   the current value of the bank property
   */
   public String getBank() {
      return bank;}
   
   /**
* Sets the value of the bank property.
*
* @param aBank the new value of the bank property
   */
   public void setBank(String aBank) {
      bank = setChnString(aBank);}
   
   /**
* Access method for the bankAccount property.
*
* @return   the current value of the bankAccount property
   */
   public String getBankAccount() {
      return bankAccount;}
   
   /**
* Sets the value of the bankAccount property.
*
* @param aBankAccount the new value of the bankAccount property
   */
   public void setBankAccount(String aBankAccount) {
      bankAccount = setChnString(aBankAccount);}
   
   /**
* Access method for the email property.
*
* @return   the current value of the email property
   */
   public String getEmail() {
      return email;}
   
   /**
* Sets the value of the email property.
*
* @param aEmail the new value of the email property
   */
   public void setEmail(String aEmail) {
      email = setChnString(aEmail);}
   
   /**
* Access method for the owner property.
*
* @return   the current value of the owner property
   */
   public String getOwner() {
      return owner;}
   
   /**
* Sets the value of the owner property.
*
* @param aOwner the new value of the owner property
   */
   public void setOwner(String aOwner) {
      owner = setChnString(aOwner);}
   
   /**
* Access method for the linkman property.
*
* @return   the current value of the linkman property
   */
   public String getLinkman() {
      return linkman;}
   
   /**
* Sets the value of the linkman property.
*
* @param aLinkman the new value of the linkman property
   */
   public void setLinkman(String aLinkman) {
      linkman = setChnString(aLinkman);}
   
   /**
* Access method for the linkmanPhone property.
*
* @return   the current value of the linkmanPhone property
   */
   public String getLinkmanPhone() {
      return linkmanPhone;}
   
   /**
* Sets the value of the linkmanPhone property.
*
* @param aLinkmanPhone the new value of the linkmanPhone property
   */
   public void setLinkmanPhone(String aLinkmanPhone) {
      linkmanPhone = setChnString(aLinkmanPhone);}
   
   /**
* Access method for the creator property.
*
* @return   the current value of the creator property
   */
   public String getCreator() {
      return creator;}
   
   /**
* Sets the value of the creator property.
*
* @param aCreator the new value of the creator property
   */
   public void setCreator(String aCreator) {
      creator = setChnString(aCreator);}
   
   /**
* Access method for the dealTimes property.
*
* @return   the current value of the dealTimes property
   */
   public int getDealTimes() {
      return dealTimes;}
   
   /**
* Sets the value of the dealTimes property.
*
* @param aDealTimes the new value of the dealTimes property
   */
   public void setDealTimes(int aDealTimes) {
      dealTimes = aDealTimes;}
   
   /**
* Access method for the lateTimes property.
*
* @return   the current value of the lateTimes property
   */
   public int getLateTimes() {
      return lateTimes;}
   
   /**
* Sets the value of the lateTimes property.
*
* @param aLateTimes the new value of the lateTimes property
   */
   public void setLateTimes(int aLateTimes) {
      lateTimes = aLateTimes;}
   
   /**
* Access method for the unpayTimes property.
*
* @return   the current value of the unpayTimes property
   */
   public int getUnpayTimes() {
      return unpayTimes;}
   
   /**
* Sets the value of the unpayTimes property.
*
* @param aUnpayTimes the new value of the unpayTimes property
   */
   public void setUnpayTimes(int aUnpayTimes) {
      unpayTimes = aUnpayTimes;}
   
   /**
* Access method for the satisfy property.
*
* @return   the current value of the satisfy property
   */
   public int getSatisfy() {
      return satisfy;}
   
   /**
* Sets the value of the satisfy property.
*
* @param aSatisfy the new value of the satisfy property
   */
   public void setSatisfy(int aSatisfy) {
      satisfy = aSatisfy;}
}

⌨️ 快捷键说明

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