?? operatefee.java
字號:
package src.wuyang;
import src.com.*;
import java.sql.*;
import java.io.*;
public class OperateFee extends ShangObject
{
/**
帳號編號
*/
private String accountId;
/**
費用編號
*/
private int feeId;
/**
費用數量
*/
private float feeMoney;
/**
費用時間
*/
private Timestamp feeDate;
/**
憑證號
*/
private String receiptId;
private int operateFeeId;
public OperateFee()
{
primarykey1Name = "operateFeeId";
primarykey1Type = 0;
tableName = "OperateFee";
viewName = "OperateFee";
numInOnePager = 10;
}
public int loadAttr(){
try{
operateFeeId = rs.getInt("operateFeeId");
accountId = getRsString(rs,"accountId");
feeId = rs.getInt("feeId");
feeMoney = rs.getFloat("feeMoney");
feeDate = rs.getTimestamp("feeDate");
receiptId = getRsString(rs,"receiptId");
} catch(SQLException e) {
e.printStackTrace();
System.out.println("query failed!");
return -1;
}
return 1;
}
/**
@accountId varchar(20)
,@feeName varchar(30)
,@feeMoney float
,@feeDate datetime
,@receiptId varchar(20)
*/
public int insert(){
String sql= "{?=call sp_InsertOperateFee(?,?,?,?,?)}";
try{
CallableStatement updStmt=conn.prepareCall(sql);
updStmt.registerOutParameter(1, java.sql.Types.INTEGER);
setStmtString(updStmt, 2, accountId);
updStmt.setInt(3, feeId);
updStmt.setFloat(4,feeMoney);
updStmt.setTimestamp(5,feeDate);
setStmtString(updStmt, 6, receiptId);
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 OperateFee set accountId=?,feeId=?,feeMoney=?,feeDate=?,receiptId=? where operateFeeId="
+ operateFeeId;
try{
PreparedStatement updStmt = conn.prepareStatement(sql);
setStmtString(updStmt, 1, accountId);
updStmt.setInt(2, feeId);
updStmt.setFloat(3,feeMoney);
updStmt.setTimestamp(4,feeDate);
setStmtString(updStmt, 5, receiptId);
print("sql== " + sql );
updStmt.executeUpdate();
updStmt.close();
return 0;
}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, "feeId", "=", "", request.getParameter("feeName"));
whereClause = addWhereClause(whereClause, "accountId", "=", "", request.getParameter("accountId"));
whereClause = addWhereClause(whereClause, "receiptId", "=", "'", request.getParameter("receiptId"));
break;
case 2:
whereClause = addWhereClause(whereClause,"operateFeeId","=","'",request.getParameter("operateFeeId"));
break;
}
return whereClause;
}
/**
* Access method for the accountId property.
*
* @return the current value of the accountId property
*/
public String getAccountId()
{
return accountId;
}
/**
* Sets the value of the accountId property.
*
* @param aAccountId the new value of the accountId property
*/
public void setAccountId(String aAccountId)
{
accountId = setChnString(aAccountId);
}
/**
* 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 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 feeDate property.
*
* @return the current value of the feeDate property
*/
public Timestamp getFeeDate()
{
return feeDate;
}
/**
* Sets the value of the feeDate property.
*
* @param aFeeDate the new value of the feeDate property
*/
public void setFeeDate(Timestamp aFeeDate)
{
feeDate = aFeeDate;
}
/**
* 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);
}
public int getOperateFeeId()
{
return operateFeeId;
}
public void setOperateFeeId(int aOperateFeeId)
{
operateFeeId = aOperateFeeId;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -