src/com/bar/db/Goods.java
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.bar.db;
import java.sql.*;
/**
*
* @author asus
*/
public class Goods extends ExecuteDB {
//定义类成员变量
private long goodsid;
private int buynumber;
private long userid;
private float price;
private long goodinfoid;
private String strSql;
public Goods(){
this.goodsid=0;
this.buynumber=0;
this.userid=0;
this.price=0;
this.goodinfoid=0;
this.strSql="";
}
//向GOODS中添加一条新记录
public boolean add()
{
this.strSql="insert into goods ";
this.strSql=this.strSql + "(buynumber,userid,price,goodinfoid)";
this.strSql=this.strSql + "values('" + this.buynumber + "','" + this.userid + "','" + this.price + "','" + this.goodinfoid + "')";
boolean isAdd = super.exeSql(this.strSql);
return isAdd;
}
//删除成员变量中GOODSID对应的商品信息
public boolean delete()
{
this.strSql = "delete from goods where goodsid = ";
this.strSql = this.strSql + this.goodsid;
boolean isDelete = super.exeSql(this.strSql);
return isDelete;
}
public boolean delete(String sgoodsid)
{
this.strSql = "delete from goods where goodsid in ( ";
this.strSql = this.strSql + sgoodsid +")";
boolean isDelete = super.exeSql(this.strSql);
return isDelete;
}
//验证Goodsid和userid是否匹配
public boolean valid()
{
this.strSql = "select * from `goods`";
this.strSql = this.strSql + " where userid = ' " + this.userid + "'";
this.strSql = this.strSql + " and goodsid = ' " + this.goodsid + "'";
后面还有 114 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。