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

📄 employee.java

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

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

public class Employee extends ShangObject
{
   
   /**
职员编号
   */
   private String employeeId;
   
   /**
职员名称
   */
   private String empName;
   
   /**
性别
0  男
1 女
   */
   private int sex;
   
   /**
生日
   */
   private Timestamp birth;
   
   /**
学历
   */
   private String education;
   
   /**
职称
   */
   private String profTitle;
   
   /**
党团员
   */
   private int party;
   
   /**
岗位
   */
   private String position;
   
   /**
合同性质
   */
   private int contractClass;
   
   /**
来源
   */
   private String empSource;
   
   /**
身份证号
   */
   private String empIdNumber;
   
   /**
工龄
   */
   private String workDate;

   
   /**
来工作时间
   */
   private Timestamp enterDate;
   
   /**
部门编号
   */
   private String deptId;
   
   /**
公司编号
   */
   private String companyId;
   
   private float zwAllowance;
   private float gbAllowance;
   private float slSalary;
   private float daSalary;   
  
  /**
个人岗位工资系数
   */
   private float gwRatio;
   
  
   public Employee() 
   {
 	primarykey1Name = "employeeId"; 
	primarykey1Type = 1; 
	tableName = "Employee";  
	viewName = "Employee";
	numInOnePager = 10;	
   }
   

public int loadAttr() {
    try{
	employeeId = getRsString(rs,"employeeId");
	empName = getRsString(rs,"empName");
	sex = rs.getInt("sex");
	birth = rs.getTimestamp("birth");
	education = getRsString(rs,"education");
	profTitle = getRsString(rs,"profTitle");
	party = rs.getInt("party");
	position = getRsString(rs,"position");
	contractClass = rs.getInt("contractClass");
	empSource = getRsString(rs,"empSource");
	empIdNumber = getRsString(rs,"empIdNumber");
	workDate = rs.getString("workDate");
	enterDate = rs.getTimestamp("enterDate");
	deptId = getRsString(rs,"deptId");
	companyId = getRsString(rs,"companyId");
	daSalary = rs.getFloat("daSalary");
	slSalary = rs.getFloat("slSalary");
	zwAllowance = rs.getFloat("zwAllowance");
	gbAllowance = rs.getFloat("gbAllowance");
    	gwRatio = rs.getFloat("gwRatio");
    	
     } catch(SQLException e) {
   	 e.printStackTrace();
   	 System.out.println("query failed!");
   	 return -1;
      }
      return 1;
    }  


/*
	@loginName varchar(30) 
	,@ip varchar(20) 
	,@machineName varchar(30) 
	,@employeeId varchar(10)
	,@empName varchar(20)
	,@sex	tinyint
	,@birth	datetime
	,@education varchar(30)
	,@profTitle	varchar(10)
	,@party	tinyint
	,@position	varchar(10)
	,@contractClass	tinyint
	,@empSource	varchar(20)
	,@empIdNumber	varchar(20)
	,@workDate	datetime
	,@enterDate	datetime
	,@deptId	varchar(10)
	,@companyId	varchar(10)
	,@daSalary	float
	,@slSalary	float
	,@zwAllowance	float
	,@gbAllowance	float
*/
public int insert() {
	String sql = "{?=Call sp_InsertEmployee (?,?,?,?,?,?,?,?,?,? ,?,?,?,?,?,?,?,?,?,?, ?,?,?)}";
	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,employeeId);
		setStmtString(updStmt,6,empName);
		updStmt.setInt(7,sex);
		updStmt.setTimestamp(8,birth);
		setStmtString(updStmt,9,education);
		setStmtString(updStmt,10,profTitle);
		updStmt.setInt(11,party);
		setStmtString(updStmt,12,position);
		updStmt.setInt(13,contractClass);
		setStmtString(updStmt,14,empSource);
		setStmtString(updStmt,15,empIdNumber);
		updStmt.setString(16,workDate);
		updStmt.setTimestamp(17,enterDate);
		setStmtString(updStmt,18,deptId);
		setStmtString(updStmt,19,companyId);
		updStmt.setFloat(20,daSalary);
		updStmt.setFloat(21,slSalary);
		updStmt.setFloat(22,zwAllowance);
		updStmt.setFloat(23,gbAllowance);
		updStmt.setFloat(24,gwRatio);
		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_UpdateEmployee (?,?,?,?,?,?,?,?,?,? ,?,?,?,?,?,?,?,?,?,?, ?,?,?)}";
	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,employeeId);
		setStmtString(updStmt,6,empName);
		updStmt.setInt(7,sex);
		updStmt.setTimestamp(8,birth);
		setStmtString(updStmt,9,education);
		setStmtString(updStmt,10,profTitle);
		updStmt.setInt(11,party);
		setStmtString(updStmt,12,position);
		updStmt.setInt(13,contractClass);
		setStmtString(updStmt,14,empSource);
		setStmtString(updStmt,15,empIdNumber);
		updStmt.setString(16,workDate);
		updStmt.setTimestamp(17,enterDate);
		setStmtString(updStmt,18,deptId);
		setStmtString(updStmt,19,companyId);
		updStmt.setFloat(20,daSalary);
		updStmt.setFloat(21,slSalary);
		updStmt.setFloat(22,zwAllowance);
		updStmt.setFloat(23,gbAllowance);
		updStmt.setFloat(24,gwRatio);
		
		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, "employeeId", "=", "'", request.getParameter("employeeId"));
			whereClause = addWhereClause(whereClause, "empName", "like", "'", request.getParameter("empName"));
			whereClause = addWhereClause(whereClause, "empIdNumber", "=", "'", request.getParameter("empIdNumber"));
			whereClause = addWhereClause(whereClause, "deptId", "=", "'", request.getParameter("deptId"));
			whereClause = addWhereClause(whereClause, "companyId", "=", "'", request.getParameter("companyId"));
			
			break;
			
		case 2: 
			whereClause = addWhereClause(whereClause,"employeeId","=","'",request.getParameter("employeeId"));
			break;

	}
    	return whereClause;
    }


   /**
* Access method for the employeeId property.
*
* @return   the current value of the employeeId property
   */
   public String getEmployeeId() {
      return employeeId;}
   
   /**
* Sets the value of the employeeId property.
*
* @param aEmployeeId the new value of the employeeId property
   */
   public void setEmployeeId(String aEmployeeId) {
      employeeId = setChnString(aEmployeeId);}
   
   /**
* Access method for the empName property.
*
* @return   the current value of the empName property
   */
   public String getEmpName() {
      return empName;}
   
   /**
* Sets the value of the empName property.
*
* @param aEmpName the new value of the empName property
   */
   public void setEmpName(String aEmpName) {
      empName = setChnString(aEmpName);}
   
   /**
* Access method for the sex property.
*
* @return   the current value of the sex property
   */
   public int getSex() {
      return sex;}
   
   /**
* Sets the value of the sex property.
*
* @param aSex the new value of the sex property
   */
   public void setSex(int aSex) {
      sex = aSex;}
   
   /**
* Access method for the birth property.
*
* @return   the current value of the birth property
   */
   public Timestamp getBirth() {
      return birth;}
   
   /**
* Sets the value of the birth property.
*
* @param aBirth the new value of the birth property
   */
   public void setBirth(Timestamp aBirth) {
      birth = aBirth;}
   
   /**
* Access method for the education property.
*
* @return   the current value of the education property
   */
   public String getEducation() {
      return education;}
   
   /**
* Sets the value of the education property.
*
* @param aEducation the new value of the education property
   */
   public void setEducation(String aEducation) {
      education = setChnString(aEducation);}
   
   /**
* Access method for the profTitle property.
*
* @return   the current value of the profTitle property
   */
   public String getProfTitle() {
      return profTitle;}
   
   /**
* Sets the value of the profTitle property.
*
* @param aProfTitle the new value of the profTitle property
   */
   public void setProfTitle(String aProfTitle) {
      profTitle = setChnString(aProfTitle);}
   
   /**
* Access method for the party property.
*
* @return   the current value of the party property
   */
   public int getParty() {
      return party;}
   
   /**
* Sets the value of the party property.
*
* @param aParty the new value of the party property
   */
   public void setParty(int aParty) {
      party = aParty;}
   
   /**
* Access method for the position property.
*
* @return   the current value of the position property
   */
   public String getPosition() {
      return position;}
   
   /**
* Sets the value of the position property.
*
* @param aPosition the new value of the position property
   */
   public void setPosition(String aPosition) {
      position = setChnString(aPosition);}
   
   /**
* Access method for the contractClass property.
*
* @return   the current value of the contractClass property
   */
   public int getContractClass() {
      return contractClass;}
   
   /**
* Sets the value of the contractClass property.
*
* @param aContractClass the new value of the contractClass property
   */
   public void setContractClass(int aContractClass) {
      contractClass = aContractClass;}
   
   /**
* Access method for the empSource property.
*
* @return   the current value of the empSource property
   */
   public String getEmpSource() {
      return empSource;}
   
   /**
* Sets the value of the empSource property.
*
* @param aEmpSource the new value of the empSource property
   */
   public void setEmpSource(String aEmpSource) {
      empSource = setChnString(aEmpSource);}
   
   /**
* Access method for the empIdNumber property.
*
* @return   the current value of the empIdNumber property
   */
   public String getEmpIdNumber() {
      return empIdNumber;}
   
   /**
* Sets the value of the empIdNumber property.
*
* @param aEmpIdNumber the new value of the empIdNumber property
   */
   public void setEmpIdNumber(String aEmpIdNumber) {
      empIdNumber = setChnString(aEmpIdNumber);}
   
   /**
* Access method for the workDate property.
*
* @return   the current value of the workDate property
   */
   public String getWorkDate() {
      return workDate;}
   
   /**
* Sets the value of the workDate property.
*
* @param aWorkDate the new value of the workDate property
   */
   public void setWorkDate(String aWorkDate) {
      workDate = aWorkDate;}
   
   /**
* Access method for the daSalary property.
*
* @return   the current value of the daSalary property
   */
   public float getDaSalary() {
      return daSalary;}
   
   /**
* Sets the value of the daSalary property.
*
* @param aDaSalary the new value of the daSalary property
   */
   public void setDaSalary(float aDaSalary) {
      daSalary = aDaSalary;}
   
   /**
* Access method for the enterDate property.
*
* @return   the current value of the enterDate property
   */
   public Timestamp getEnterDate() {
      return enterDate;}
   
   /**
* Sets the value of the enterDate property.
*
* @param aEnterDate the new value of the enterDate property
   */
   public void setEnterDate(Timestamp aEnterDate) {
      enterDate = aEnterDate;}
   
   /**
* 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) {
      deptId = setChnString(aDeptId);}
   
   /**
* 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 zwAllowance property.
*
* @return   the current value of the zwAllowance property
   */
   public float getZwAllowance() {
      return zwAllowance;}
   
   /**
* Sets the value of the zwAllowance property.
*
* @param aZwAllowance the new value of the zwAllowance property
   */
   public void setZwAllowance(float aZwAllowance) {
      zwAllowance = aZwAllowance;}
   
   /**
* Access method for the gbAllowance property.
*
* @return   the current value of the gbAllowance property
   */
   public float getGbAllowance() {
      return gbAllowance;}
   
   /**
* Sets the value of the gbAllowance property.
*
* @param aGbAllowance the new value of the gbAllowance property
   */
   public void setGbAllowance(float aGbAllowance) {
      gbAllowance = aGbAllowance;}
   
   /**
* Access method for the slSalary property.
*
* @return   the current value of the slSalary property
   */
   public float getSlSalary() {
      return slSalary;}
   
   /**
* Sets the value of the slSalary property.
*
* @param aSlSalary the new value of the slSalary property
   */
   public void setSlSalary(float aSlSalary) {
      slSalary = aSlSalary;}
      
     /**
* Access method for the slSalary property.
*
* @return   the current value of the slSalary property
   */
   public float getGwRatio() {
      return gwRatio;}
   
   /**
* Sets the value of the slSalary property.
*
* @param aSlSalary the new value of the slSalary property
   */
   public void setGwRatio(float aGwRatio) {
      gwRatio = aGwRatio;}    
}

⌨️ 快捷键说明

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