📄 bankcredit.java
字号:
//Source file: D:\tomcat\webapps\wuyang\WEB-INF\classes\src\wuyang\BankCredit.java
package src.wuyang;
import src.com.*;
import java.sql.*;
import java.io.*;
public class BankCredit extends ShangObject
{
/**
记录时间
*/
private Timestamp noteTime;
/**
摘要
*/
private String comment;
/**
借
*/
private float debit;
/**
袋
*/
private float loan;
/**
结余
private float balance;
*/
private int bankCreditId;
public BankCredit()
{
primarykey1Name = "bankCreditId";
primarykey1Type = 0;
tableName = "BankCredit";
viewName = "BankCredit";
numInOnePager = 10;
}
public int loadAttr(){
try{
bankCreditId = rs.getInt("bankCreditId");
noteTime = rs.getTimestamp("noteTime");
comment = getRsString(rs,"comment");
debit = rs.getFloat("debit");
loan = rs.getFloat("loan");
//balance = rs.getFloat("balance");
} catch(SQLException e) {
e.printStackTrace();
System.out.println("query failed!");
return -1;
}
return 1;
}
public int insert(){
String sql ="{?=call sp_InsertBankCredit(?,?,?,?)}";
try{
CallableStatement updStmt=conn.prepareCall(sql);
updStmt.registerOutParameter(1, java.sql.Types.INTEGER);
updStmt.setTimestamp(2,noteTime);
setStmtString(updStmt,3,comment);
updStmt.setFloat(4,debit);
updStmt.setFloat(5,loan);
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 = "update BankCredit set noteTime=?,comment=?,debit=?,loan=? where bankCreditId="
+ bankCreditId;
try{
PreparedStatement updStmt = conn.prepareStatement(sql);
updStmt.setTimestamp(1,noteTime);
setStmtString(updStmt,2,comment);
updStmt.setFloat(3,debit);
updStmt.setFloat(4,loan);
updStmt.executeUpdate();
updStmt.close();
return 0;
}catch(SQLException e){
System.out.println(e.getMessage());
e.printStackTrace();
return -1;
}
}
public int delete(){
String sql ="delete BankCredit where bankCreditId=" + bankCreditId;
try{
PreparedStatement updStmt = conn.prepareStatement(sql);
updStmt.executeUpdate();
updStmt.close();
return 1;
}catch(SQLException e){
e.printStackTrace();
return -1;
}
}
/**
* Access method for the noteTime property.
*
* @return the current value of the noteTime property
*/
public Timestamp getNoteTime()
{
return noteTime;
}
/**
* Sets the value of the noteTime property.
*
* @param aNoteTime the new value of the noteTime property
*/
public void setNoteTime(Timestamp aNoteTime)
{
noteTime = aNoteTime;
}
/**
* Access method for the comment property.
*
* @return the current value of the comment property
*/
public String getComment()
{
return comment;
}
/**
* Sets the value of the comment property.
*
* @param aComment the new value of the comment property
*/
public void setComment(String aComment)
{
comment = setChnString(aComment);
}
/**
* Access method for the debit property.
*
* @return the current value of the debit property
*/
public float getDebit()
{
return debit;
}
/**
* Sets the value of the debit property.
*
* @param aDebit the new value of the debit property
*/
public void setDebit(float aDebit)
{
debit = aDebit;
}
/**
* Access method for the loan property.
*
* @return the current value of the loan property
*/
public float getLoan()
{
return loan;
}
/**
* Sets the value of the loan property.
*
* @param aLoan the new value of the loan property
*/
public void setLoan(float aLoan)
{
loan = aLoan;
}
/**
* Access method for the balance property.
*
* @return the current value of the balance property
public float getBalance()
{
return balance;
}
/**
* Sets the value of the balance property.
*
* @param aBalance the new value of the balance property
public void setBalance(float aBalance)
{
balance = aBalance;
}
*/
public int getBankCreditId()
{
return bankCreditId;
}
public void setBankCreditId(int aBankCreditId)
{
bankCreditId = aBankCreditId;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -