📄 goods.java
字号:
package dlut;
import java.sql.*;
public class Goods extends ExecuteDB
{
private long goodsID;
private int buyNumber;
private long userID;
private long bookID;
private String createTime;
private String strSql;
public Goods()
{
this.goodsID=0;
this.userID=0;
this.buyNumber=0;
this.bookID=0;
this.strSql="";
}
public boolean add_goods()
{
this.strSql="insert into goods ";
this.strSql=this.strSql + "(";
this.strSql=this.strSql + "BuyNumber,";
this.strSql=this.strSql + "UserID,";
this.strSql=this.strSql + "BookID,";
this.strSql=this.strSql + "CreateTime";
this.strSql=this.strSql + ") ";
this.strSql=this.strSql + "values(";
this.strSql=this.strSql + "'" + this.buyNumber + "',";
this.strSql=this.strSql + "'" + this.userID + "',";
this.strSql=this.strSql + "'" + this.bookID + "',";
this.strSql=this.strSql + " sysdate";
this.strSql=this.strSql + ")";
boolean isAdd = super.exeSql(this.strSql);
System.out.println("add_goods " + this.strSql);
System.out.println(isAdd);
return isAdd;
}
public boolean deleteGoods()
{
this.strSql="delete from goods where GoodsID =";
this.strSql=this.strSql + this.goodsID;
boolean isDelete = super.exeSql(this.strSql);
return isDelete;
}
public boolean deleteGoods(String deleteGoodsID)
{
this.strSql="delete from goods where GoodsID in (";
this.strSql=this.strSql + deleteGoodsID + ")";
boolean isDelete = super.exeSql(this.strSql);
return isDelete;
}
public ResultSet showGoods()
{
this.strSql="select * from goods where UserID=" + this.userID;
System.out.println(strSql);
ResultSet rs = null;
try
{
rs = super.exeSqlQuery(this.strSql);
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
return rs;
}
public void setGoodsID(long GoodsID)
{
this.goodsID = GoodsID;
}
public long getGoodsID()
{
return this.goodsID;
}
public void setUserID(long UserID)
{
this.userID = UserID;
}
public long getUserID()
{
return this.userID;
}
public void setBookID(long BookID)
{
this.bookID = BookID;
}
public long getBookID()
{
return this.bookID;
}
public void setBuyNumber(int BuyNumber)
{
this.buyNumber = BuyNumber;
}
public int getBuyNumber()
{
return this.buyNumber;
}
public void setCreateTime(String CreateTime)
{
this.createTime = CreateTime;
}
public String getCreateTime()
{
return this.createTime;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -