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

📄 department.java

📁 (Java+SQL)-大型企业JAVA的ERP系统
💻 JAVA
字号:
//Source file: D:\tomcat\webapps\wuyang\WEB-INF\classes\src\wuyang\Department.java

package src.wuyang;

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

public class Department extends ShangObject
{
   
   /**
部门编号
   */
   private String deptId;
   
   /**
部门名称
   */
   private String deptName;
   
   /**
公司编号
   */
   private String companyId;
   
   
   /**
收益提成率
   */
   private float caoRatio;
   
   public Department() 
   {
   	primarykey1Name = "deptId"; 
	primarykey1Type = 1; 
	tableName = "Department";  
	viewName = "Department";
	numInOnePager = 10;	
   }
   
  
  public int loadAttr() {
     
     try {
         deptId = getRsString(rs,"deptId");
         deptName = getRsString(rs, "deptName");
         companyId = getRsString(rs,"companyId");
         caoRatio = rs.getFloat("ratio");
        } catch(SQLException e) {
   	 e.printStackTrace();
   	 System.out.println("query failed!");
   	 return -1;
      }
        
         return 1;
    }
  
 
 /*
 	@loginName varchar(30) 
	,@ip varchar(20) 
	,@machineName varchar(30) 
	,@deptId	varchar(10)
	,@deptName	varchar(30)
	,@companyId	varchar(10)
	,@deptMonthGoal	float
	,@zuYinRatio	float
	,@xinRatio	float
	,@caoRatio	float
 */
 
  public int insert(){
  	String sql= "{?=call sp_InsertDepartment(?,?,?,?,?,?,?)}";
	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,deptId);
	     setStmtString(updStmt,6,deptName);
	     setStmtString(updStmt,7,companyId);
	     updStmt.setFloat(8,caoRatio);
	     
	     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_UpdateDepartment(?,?,?,?,?,?,?)}";
	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,deptId);
	     setStmtString(updStmt,6,deptName);
	     setStmtString(updStmt,7,companyId);
	     updStmt.setFloat(8,caoRatio);
	     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, "deptId", "=", "'", request.getParameter("deptId"));
			whereClause = addWhereClause(whereClause, "deptName", "like", "'", request.getParameter("deptName"));
			whereClause = addWhereClause(whereClause, "companyId", "=", "'", request.getParameter("companyId"));
			
			break;
			
		case 2: 
			whereClause = addWhereClause(whereClause,"deptId","=","'",request.getParameter("deptId"));
			break;

	}
    	return whereClause;
    }
    
    
   
   /**
* Access method for the deptId property.
*
* @return   the current value of the deptId property
   */
   public String getDeptId() {
      return deptId;}
   
   /**
* Sets the value of the deptId property.
*
* @param aDeptId the new value of the deptId property
   */
   public void setDeptId(String aDeptId) {
      try{
      	deptId = new String(aDeptId.getBytes("8859_1"));
      }catch(UnsupportedEncodingException e) {
      	System.out.println("error in getbytes");
      }
      }
   
   /**
* Access method for the deptName property.
*
* @return   the current value of the deptName property
   */
   public String getDeptName() {
      return deptName;}
   
   /**
* Sets the value of the deptName property.
*
* @param aDeptName the new value of the deptName property
   */
   public void setDeptName(String aDeptName) {
     try{
      	deptName = new String(aDeptName.getBytes("8859_1"));
      }catch(UnsupportedEncodingException e) {
      	System.out.println("error in getbytes");
      }
      }
   
   /**
* 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 caoRatio property.
*
* @return   the current value of the caoRatio property
   */
   public float getCaoRatio() {
      return caoRatio;}
   
   /**
* Sets the value of the caoRatio property.
*
* @param aCaoRatio the new value of the caoRatio property
   */
   public void setCaoRatio(float aCaoRatio) {
      caoRatio = aCaoRatio;}
}

⌨️ 快捷键说明

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