📄 financeinfotra.java
字号:
package src.wuyang;
import src.com.*;
import java.sql.*;
import java.io.*;
public class FinanceInfoTra extends ShangObject
{
/**
凭证编号
*/
private String receiptId;
/**
凭证类型
*/
private int receiptType;
private int state;
private int infoId;
public FinanceInfoTra()
{
primarykey1Name = "infoId";
primarykey1Type = 0;
tableName = "FinanceInfoTra";
viewName = "FinanceInfoTra";
numInOnePager = 10;
}
public int loadAttr(){
try{
infoId = rs.getInt("infoId");
receiptId = getRsString(rs,"receiptId");
receiptType = rs.getInt("receiptType");
state = rs.getInt("state");
} catch(SQLException e) {
e.printStackTrace();
System.out.println("query failed!");
return -1;
}
return 1;
}
public int insert(){
String sql ="insert into FinanceInfoTra (receiptId,receiptType,state) values (?,?,?)";
try{
PreparedStatement updStmt = conn.prepareStatement(sql);
setStmtString(updStmt,1,receiptId);
updStmt.setInt(2,receiptType);
updStmt.setInt(3,state);
updStmt.executeUpdate();
updStmt.close();
return 0;
}catch(SQLException e){
System.out.println(e.getMessage());
e.printStackTrace();
return -1;
}
}
public int update(){
String sql = "update FinanceInfoTra set receiptId=?,receiptType = ?, state = ? where infoId="
+ infoId;
try{
PreparedStatement updStmt = conn.prepareStatement(sql);
setStmtString(updStmt,1,receiptId);
updStmt.setInt(2,receiptType);
updStmt.setInt(3,state);
print("sql== " + sql );
updStmt.executeUpdate();
updStmt.close();
return 0;
}catch(SQLException e){
System.out.println(e.getMessage());
e.printStackTrace();
return -1;
}
}
public int delUnitCostRec(){
String sql = "delete from FinanceInfoTra where receiptId='"+getReceiptId()+"' and state=4";
try{
PreparedStatement updStmt = conn.prepareStatement(sql);
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 receiptId property.
*
* @return the current value of the receiptId property
*/
public String getReceiptId() {
return receiptId;}
/**
* Sets the value of the receiptId property.
*
* @param aReceiptId the new value of the receiptId property
*/
public void setReceiptId(String aReceiptId) {
receiptId = setChnString(aReceiptId);}
/**
* Access method for the receiptType property.
*
* @return the current value of the receiptType property
*/
public int getReceiptType() {
return receiptType;}
/**
* Sets the value of the receiptType property.
*
* @param aReceiptType the new value of the receiptType property
*/
public void setReceiptType(int aReceiptType) {
receiptType = aReceiptType;}
/**
* Access method for the state property.
*
* @return the current value of the state property
*/
public int getState() {
return state;}
/**
* Sets the value of the state property.
*
* @param aState the new value of the state property
*/
public void setState(int aState) {
state = aState;}
public int getInfoId() {
return infoId;}
public void setInfoId(int aInfoId) {
infoId = aInfoId;}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -