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

📄 company.java

📁 (Java+SQL)-大型企业JAVA的ERP系统
💻 JAVA
字号:
//Source file: D:\work\五洋\javaBean\src\Company.java

package src.wuyang;

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


public class Company extends ShangObject
{
   
   /**
公司编号
   */
   private String companyId;
   
   /**
公司名
   */
   private String companyName;
   
   /**
公司级别
 总公司    1
 分公司    2
办事处    3
   */
   private int companyLevel;
   
   /**
所在省份
   */
   private String province;
   
   /**
所在城市
   */
   private String city;
   
   /**
地址
   */
   private String address;
   
   /**
邮编
   */
   private String zip;
   
   /**
电话
   */
   private String tel;
   
   /**
传真
   */
   private String fax;
   
   /**
税号
   */
   private String tax;
   
   /**
电子邮件
   */
   private String email;
   
   /**
法人代表
   */
   private String owner;
   
   /**
联系人
   */
   private String linkman;
   
   /**
联系人电话
   */
   private String linkmanPhone;
   
//   private String bank;
   
//   private String bankAccount;

//   private int id;
   
   public Company() 
   {
   	primarykey1Name = "companyId"; 
	primarykey1Type = 1; 
	tableName = "Company";  
	viewName = "Company";
	numInOnePager = 10;	
   }
   

public int loadAttr() {
     
    try{
    	  companyId = getRsString(rs,"companyId");
    	  companyName = getRsString(rs,"companyName");
    	  companyLevel = rs.getInt("companyLevel");
    	  province = getRsString(rs,"province");
    	  city = getRsString(rs,"city");
    	  address = getRsString(rs,"address");
    	  zip = getRsString(rs,"zip");
    	  tel = getRsString(rs,"tel");
    	  fax = getRsString(rs,"fax");
    	  tax = getRsString(rs,"tax");
    	  email = getRsString(rs,"email");     
          owner = getRsString(rs,"owner");
          linkman = getRsString(rs,"linkman");
          linkmanPhone = getRsString(rs,"linkmanPhone");
       //   bank = getRsString(rs,"bank");
        //  bankAccount = getRsString(rs,"bankAccount");
        //  id = rs.getInt("id");
          
        } catch(SQLException e) {
   	 e.printStackTrace();
   	 System.out.println("query failed!");
   	 return -1;
      }
        
         return 1;
    }
    

/*
    插入记录
    	@loginName varchar(30) 
	,@ip varchar(20) 
	,@machineName varchar(30) 
	,@companyId varchar(10) 
	,@companyName varchar(30) 
	,@companyLevel tinyint
	,@province varchar(30) 
	,@city varchar(20)
	,@address    varchar(60)
	,@zip       varchar(10)
	,@tel	   varchar(20)
	,@fax     varchar(20)
	,@tax
	,@email   varchar(30)
	,@owner   varchar(20)
	,@linkman  varchar(20)
	,@linkmanPhone varchar(20)

*/

public int insert(){
	String sql = "{?=Call sp_InsertCompany (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
	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,companyId);
		setStmtString(updStmt,6,companyName);
		updStmt.setInt(7,companyLevel);
		setStmtString(updStmt,8,province);
		setStmtString(updStmt,9,city);
		setStmtString(updStmt,10,address);
		setStmtString(updStmt,11,zip);
		setStmtString(updStmt,12,tel);
		setStmtString(updStmt,13,fax);
		setStmtString(updStmt,14,tax);
		setStmtString(updStmt,15,email);
		setStmtString(updStmt,16,owner);
		setStmtString(updStmt,17,linkman);
		setStmtString(updStmt,18,linkmanPhone);
		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_UpdateCompany (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
	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,companyId);
		setStmtString(updStmt,6,companyName);
		updStmt.setInt(7,companyLevel);
		setStmtString(updStmt,8,province);
		setStmtString(updStmt,9,city);
		setStmtString(updStmt,10,address);
		setStmtString(updStmt,11,zip);
		setStmtString(updStmt,12,tel);
		setStmtString(updStmt,13,fax);
		setStmtString(updStmt,14,tax);
		setStmtString(updStmt,15,email);
		setStmtString(updStmt,16,owner);
		setStmtString(updStmt,17,linkman);
		setStmtString(updStmt,18,linkmanPhone);
		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, "companyId", "=", "'", request.getParameter("companyId"));
			whereClause = addWhereClause(whereClause, "companyName", "like", "'", request.getParameter("companyName"));
			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, "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,"companyId","=","'",request.getParameter("companyId"));
			break;

	}
    	return whereClause;
    }

  
  
  
   /**
* Access method for the companyId property.
*
* @return   the current value of the companyId property
   */
   public String getCompanyId() {
      return companyId;}
   
   /**
* Sets the value of the companyId property.
*
* @param aCompanyId the new value of the companyId property
   */
   public void setCompanyId(String aCompanyId) {
      companyId = setChnString(aCompanyId);}
   
   /**
* Access method for the companyName property.
*
* @return   the current value of the companyName property
   */
   public String getCompanyName() {
      return companyName;}
   
   /**
* Sets the value of the companyName property.
*
* @param aCompanyName the new value of the companyName property
   */
   public void setCompanyName(String aCompanyName) {
      companyName = setChnString(aCompanyName);}
   
   /**
* Access method for the companyLevel property.
*
* @return   the current value of the companyLevel property
   */
   public int getCompanyLevel() {
      return companyLevel;}
   
   /**
* Sets the value of the companyLevel property.
*
* @param aCompanyLevel the new value of the companyLevel property
   */
   public void setCompanyLevel(int aCompanyLevel) {
      companyLevel = aCompanyLevel;}
   
   /**
* 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 tel property.
*
* @return   the current value of the tel property
   */
   public String getTel() {
      return tel;}
   
   /**
* Sets the value of the tel property.
*
* @param aTel the new value of the tel property
   */
   public void setTel(String aTel) {
      tel = setChnString(aTel);}
   
   /**
* 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 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);}
/*
   public String getBank() {
      return bank;}

   public String getBankAccount() {
      return bankAccount;}

   public int getId(){
   	return id;}

*/
}

⌨️ 快捷键说明

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