?? moneyflow.java
字號:
package src.wuyang;
import src.com.*;
import java.sql.*;
import java.io.*;
public class MoneyFlow extends ShangObject
{
/**
發(fā)票編號
*/
private String invoiceId;
/**
收付款日
*/
private Timestamp lmDate;
/**
收款人簽名
*/
private String accountId;
/**
銀行憑證編號
*/
private String pinId;
/**
備注
*/
private String comment;
/**
收付金額
*/
private float lmMoney;
private int flowId;
public MoneyFlow()
{
primarykey1Name = "flowId";
primarykey1Type = 0;
tableName = "MoneyFlow";
viewName = "MoneyFlow";
numInOnePager = 10;
}
public int loadAttr(){
try{
flowId = rs.getInt("flowId");
invoiceId = getRsString(rs,"invoiceId");
lmDate = rs.getTimestamp("lmDate");
accountId = getRsString(rs,"accountId");
pinId = getRsString(rs,"pinId");
comment = getRsString(rs,"comment");
lmMoney = rs.getFloat("lmMoney");
} catch(SQLException e) {
e.printStackTrace();
System.out.println("query failed!");
return -1;
}
return 1;
}
/**
@invoiceId varchar(20)
,@lmDate datetime
,@lmMoney float
,@accountId varchar(20)
,@pinId varchar(20)
,@comment varchar(100)
*/
public int insert(){
String sql= "{?=call sp_InsertMoneyFlow(?,?,?,?,?,?)}";
try{
CallableStatement updStmt=conn.prepareCall(sql);
updStmt.registerOutParameter(1, java.sql.Types.INTEGER);
setStmtString(updStmt, 2, invoiceId);
updStmt.setTimestamp(3,lmDate);
updStmt.setFloat(4,lmMoney);
setStmtString(updStmt, 5, accountId);
setStmtString(updStmt, 6, pinId);
setStmtString(updStmt, 7, comment);
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 = "{?=call sp_UpdateMoneyFlow(?,?,?,?,?,?)}";
try{
CallableStatement updStmt=conn.prepareCall(sql);
updStmt.registerOutParameter(1, java.sql.Types.INTEGER);
setStmtString(updStmt, 2, invoiceId);
updStmt.setTimestamp(3,lmDate);
updStmt.setFloat(4,lmMoney);
setStmtString(updStmt, 5, pinId);
setStmtString(updStmt, 6, comment);
updStmt.setInt(7,flowId);
updStmt.executeUpdate();
int rtcode = updStmt.getInt(1);
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, "invoiceId", "=", "'", request.getParameter("invoiceId"));
whereClause = addWhereClause(whereClause, "pinId", "=", "'", request.getParameter("pinId"));
break;
case 2:
whereClause = addWhereClause(whereClause,"flowId","=","'",request.getParameter("flowId"));
break;
}
return whereClause;
}
/**
* Access method for the invoiceId property.
*
* @return the current value of the invoiceId property
*/
public String getInvoiceId() {
return invoiceId;}
/**
* Sets the value of the invoiceId property.
*
* @param aInvoiceId the new value of the invoiceId property
*/
public void setInvoiceId(String aInvoiceId) {
invoiceId = setChnString(aInvoiceId);}
/**
* Access method for the lmDate property.
*
* @return the current value of the lmDate property
*/
public Timestamp getLmDate() {
return lmDate;}
/**
* Sets the value of the lmDate property.
*
* @param aLmDate the new value of the lmDate property
*/
public void setLmDate(Timestamp aLmDate) {
lmDate = aLmDate;}
/**
* 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 pinId property.
*
* @return the current value of the pinId property
*/
public String getPinId() {
return pinId;}
/**
* Sets the value of the pinId property.
*
* @param aPinId the new value of the pinId property
*/
public void setPinId(String aPinId) {
pinId = setChnString(aPinId);}
/**
* 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 lmMoney property.
*
* @return the current value of the lmMoney property
*/
public float getLmMoney() {
return lmMoney;}
/**
* Sets the value of the lmMoney property.
*
* @param aLmMoney the new value of the lmMoney property
*/
public void setLmMoney(float aLmMoney) {
lmMoney = aLmMoney;}
public int getFlowId() {
return flowId;}
public void setFlowId(int aFlowId) {
flowId = aFlowId;}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -