feename.java
来自「(Java+SQL)-大型企业JAVA的ERP系统」· Java 代码 · 共 119 行
JAVA
119 行
package src.wuyang;
import src.com.*;
import java.sql.*;
import java.io.*;
public class FeeName extends ShangObject
{
/**
费用编号
*/
private int feeId;
/**
费用名称
*/
private String feeName;
public FeeName()
{
primarykey1Name = "feeId";
primarykey1Type = 0;
tableName = "FeeName";
viewName = "FeeName";
numInOnePager = 10;
}
public int loadAttr(){
try{
feeId = rs.getInt("feeId");
feeName = getRsString(rs,"feeName");
} catch(SQLException e) {
e.printStackTrace();
System.out.println("query failed!");
return -1;
}
return 1;
}
public int insert(){
String sql ="insert into FeeName (feeId,feeName) values (?,?)";
try{
PreparedStatement updStmt = conn.prepareStatement(sql);
updStmt.setInt(1,feeId);
setStmtString(updStmt,2,feeName);
updStmt.executeUpdate();
updStmt.close();
return 0;
}catch(SQLException e){
System.out.println(e.getMessage());
e.printStackTrace();
return -1;
}
}
public int update(){
String sql = "update FeeName set feeName=? where feeId="
+ feeId;
try{
PreparedStatement updStmt = conn.prepareStatement(sql);
setStmtString(updStmt,1,feeName);
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 feeId property.
*
* @return the current value of the feeId property
*/
public int getFeeId()
{
return feeId;
}
/**
* Sets the value of the feeId property.
*
* @param aFeeId the new value of the feeId property
*/
public void setFeeId(int aFeeId)
{
feeId = aFeeId;
}
/**
* 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);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?