?? countlist.java
字號:
//Source file: D:\work\五洋\javaBean\src\CountList.java
package src.wuyang;
import src.com.*;
import java.sql.*;
import java.io.*;
public class CountList extends ShangObject
{
/**
嘜單序號
*/
private int markNo;
/**
嘜單編號
*/
private int markId;
/**
嘜頭
*/
private String mark;
/**
數量
*/
private float quantity;
public CountList()
{
this.primarykey1Name = "markId";
this.primarykey1Type = 0;
this.primarykey2Name = "markNo";
this.primarykey2Type = 0;
this.tableName = "CountList";
this.viewName = "CountList";
this.numInOnePager = 10;
}
public int loadAttr(){
try{
markId = rs.getInt("markId");
mark = getRsString(rs,"mark");
quantity = rs.getFloat("quantity");
markNo = rs.getInt("markNo");
return 1;
}catch(SQLException e){
e.printStackTrace();
System.out.println("querry failed !");
return -1;
}
}
public int getMaxMarkId() {
try
{
Statement countStmt = conn.createStatement();
String sqlStmt;
sqlStmt = "select max(markId) as maxMarkId from " + viewName ;
ResultSet lRs=countStmt.executeQuery(sqlStmt);
lRs.next() ;
int maxId = lRs.getInt("maxMarkId");
lRs.close();
return maxId;
}
catch(SQLException e)
{
e.printStackTrace();
return -1;
}
}
/* 新增
@loginName varchar(30)
,@ip varchar(20)
,@machineName varchar(30)
,@markNo int
,@mark varchar(10)
,@quantity float
*/
public int insert() {
String sql= "{?=call sp_InsertCountList(?,?,?,?,?,?)}";
try{
CallableStatement updStmt=conn.prepareCall(sql);
updStmt.registerOutParameter(1, java.sql.Types.INTEGER);/** 注冊OUT參數 */
setStmtString(updStmt, 2, theGlobal.loginName);
setStmtString(updStmt, 3, theGlobal.ip);
setStmtString(updStmt, 4, theGlobal.machineName);
updStmt.setInt(5,markId);
setStmtString(updStmt,6,mark);
updStmt.setFloat(7,quantity);
updStmt.executeUpdate();
int rtcode = updStmt.getInt(1);
updStmt.close();
return rtcode;
}catch(SQLException E){
System.out.println(E.getMessage());
return -102;
}
}
/* 修改1
@loginName varchar(30)
,@ip varchar(20)
,@machineName varchar(30)
,@markId int
,@quantity float
*/
public int update() {
String sql= "{?=call sp_UpdateCountList(?,?,?,?,?,?)}";
try{
CallableStatement updStmt=conn.prepareCall(sql);
updStmt.registerOutParameter(1, java.sql.Types.INTEGER);/** 注冊OUT參數 */
setStmtString(updStmt, 2, theGlobal.loginName);
setStmtString(updStmt, 3, theGlobal.ip);
setStmtString(updStmt, 4, theGlobal.machineName);
updStmt.setInt(5,markNo);
setStmtString(updStmt,6,mark);
updStmt.setFloat(7,quantity);
updStmt.executeUpdate();
int rtcode = updStmt.getInt(1);
updStmt.close();
return rtcode;
}catch(SQLException E){
System.out.println(E.getMessage());
return -102;
}
}
/* 修改2
*/
public int update(String strMarkNo,String quantity) {
String sql ="update CountList set quantity="+quantity+"where markNo = "+strMarkNo;
System.out.println("update sql "+sql);
try {
Statement stmt=conn.createStatement();
stmt.execute(sql);
return 1;
}
catch(SQLException E)
{
System.out.println(E.getMessage());
return -102;
}
}
/* 刪除
*/
public int delete() {
String sql ="delete from CountList where markNo = "+getMarkNo();
System.out.println("delete sql "+sql);
try {
Statement stmt=conn.createStatement();
stmt.execute(sql);
return 1;
}
catch(SQLException E)
{
System.out.println(E.getMessage());
return -102;
}
}
/**
* Access method for the markNo property.
*
* @return the current value of the markNo property
*/
public int getMarkNo()
{
return markNo;
}
/**
* Sets the value of the markNo property.
*
* @param aMarkId the new value of the markNo property
*/
public void setMarkNo(int aMarkNo)
{
markNo = aMarkNo;
}
/**
* Access method for the markId property.
*
* @return the current value of the markId property
*/
public int getMarkId()
{
return markId;
}
/**
* Sets the value of the markId property.
*
* @param aMarkId the new value of the markId property
*/
public void setMarkId(int aMarkId)
{
markId = aMarkId;
}
/**
* Access method for the mark property.
*
* @return the current value of the mark property
*/
public String getMark()
{
return mark;
}
/**
* Sets the value of the mark property.
*
* @param aMark the new value of the mark property
*/
public void setMark(String aMark)
{
mark = setChnString(aMark);
}
/**
* Access method for the quantity property.
*
* @return the current value of the quantity property
*/
public float getQuantity()
{
return quantity;
}
/**
* Sets the value of the quantity property.
*
* @param aQuantity the new value of the quantity property
*/
public void setQuantity(float aQuantity)
{
quantity = aQuantity;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -