feecost.java

来自「(Java+SQL)-大型企业JAVA的ERP系统」· Java 代码 · 共 241 行

JAVA
241
字号
package src.wuyang;

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


public class FeeCost extends ShangObject
{
   
   /**
开票单编码
   */
   private String slipId;
   
   /**
费用编码
   */
   private int feeId;
   
   /**
费用名称
   */
   private String feeName;
   
   /**
费用金额
   */
   private float feeMoney;
   
   /**
个人编码
   */
   private String proposer;
   
   /**
部门编码
   */
   private String deptId;
   
   /**
时间
   */
   private Timestamp feeDate;
   
   public FeeCost() 
   {
   	primarykey1Name = "slipId"; 
	primarykey1Type = 1;
	primarykey2Name = "feeId"; 
	primarykey2Type = 0; 
	tableName = "FeeCost";  
	viewName = "v_FeeCost";
	numInOnePager = 10;		
   }
  
  
  public int loadAttr(){
    try{
	slipId = getRsString(rs,"slipId");
	feeId = rs.getInt("feeId");
	feeName = getRsString(rs,"feeName");
	feeMoney = rs.getFloat("feeMoney");
	proposer = getRsString(rs,"proposer");
	deptId = getRsString(rs,"deptId");
        feeDate = rs.getTimestamp("feeDate");

     } catch(SQLException e) {
   	 e.printStackTrace();
   	 System.out.println("query failed!");
   	 return -1;
      }
      return 1;
    }  
    
 
  public int insert(){
  	String sql= "insert into FeeCost (slipId,feeId,feeMoney) values (?,?,?)";
	try{
	     PreparedStatement updStmt = conn.prepareStatement(sql);
  	     setStmtString(updStmt, 1, slipId);
	     updStmt.setInt(2, feeId);
	     updStmt.setFloat(3,feeMoney);
	     updStmt.executeUpdate();	
	     updStmt.close(); 
             return 1;	
   	
   	}catch(SQLException e){
   	     System.out.println(e.getMessage());
   		e.printStackTrace();
   		return -1;
   		}	
     }


 public int update(){
   	String sql = "update FeeCost set feeMoney=? where slipId='"
   			+ slipId + "' and feeId =" + feeId;
   	try{
   		PreparedStatement updStmt = conn.prepareStatement(sql);
	     	updStmt.setFloat(1,feeMoney);
	 	print("sql== " + sql );
	 	updStmt.executeUpdate();
   		updStmt.close(); 
   		return 0;
   	}catch(SQLException e){
   		 System.out.println(e.getMessage());
   		e.printStackTrace();
   		return -1;
   		}		
   }	   		 


     
   /**
* Access method for the accountId property.
*
* @return   the current value of the accountId property
   */
   public String getSlipId() 
   {
      return slipId;
   }
   
   /**
* Sets the value of the accountId property.
*
* @param aAccountId the new value of the accountId property
   */
   public void setSlipId(String aSlipId) 
   {
      slipId = setChnString(aSlipId);
   }
   
   /**
* Access method for the feeName property.
*
* @return   the current value of the feeName property
   */
   public int getFeeId() 
   {
      return feeId;
   }
   
   /**
* Sets the value of the feeName property.
*
* @param afeeName the new value of the feeName property
   */
   public void setFeeId(int aFeeId) 
   {
      feeId = aFeeId;
   }
   
   /**
* Access method for the feeMoney property.
*
* @return   the current value of the feeMoney property
   */
   public float getFeeMoney() 
   {
      return feeMoney;
   }
   
   /**
* Sets the value of the feeMoney property.
*
* @param aFeeMoney the new value of the feeMoney property
   */
   public void setFeeMoney(float aFeeMoney) 
   {
      feeMoney = aFeeMoney;
   }
   
   /**
* Access method for the feeName property.
*
* @return   the current value of the feeName property
   */
   public String getFeeName() 
   {
      return feeName;
   }
   
   /**
* Sets the value of the feeName property.
*
* @param aFeeName the new value of the feeName property
   */
   public void setFeeName(String aFeeName) 
   {
      feeName = setChnString(aFeeName);
   }
   
   /**
* Access method for the proposer property.
*
* @return   the current value of the proposer property
   */
   public String getProposer() 
   {
      return proposer;
   }
   
   /**
* Sets the value of the proposer property.
*
* @param aProposer the new value of the proposer property
   */
   public void setProposer(String aProposer) 
   {
      proposer = setChnString(aProposer);
   }
   
   /**
* 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);
   }
   
   public Timestamp getFeeDate() {
      return feeDate;
   }
   

}

⌨️ 快捷键说明

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