📄 dbjavabean.java
字号:
package com.smmis;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.ArrayList;
import java.util.List;
class DBPurchaseTable {
private int receiptId;
private String goodsId;
private float purPrice;
private int purQuantity;
private String purDate;
private String supplier;
public int getReceiptId() {
return receiptId;
}
public void setReceiptId(int receiptId) {
this.receiptId = receiptId;
}
public String getMedicineId() {
return goodsId;
}
public void setMedicineId(String goodsId) {
this.goodsId = goodsId;
}
public Float getPurPrice() {
return purPrice;
}
public void setPurPrice(float purPrice) {
this.purPrice = purPrice;
}
public int getPurQuantity() {
return purQuantity;
}
public void setPurQuantity(int purQuantity) {
this.purQuantity = purQuantity;
}
public String getSupplier() {
return supplier;
}
public void setSupplier(String supplier) {
this.supplier = supplier;
}
public String getPurDate() {
return purDate;
}
public void setPurDate(String purDate) {
this.purDate = purDate;
}
}
class DBSellTable {
private int customerId;
private String goodsId;
private int sellQuantity;
private String sellDate;
private float sellPrice;
public int getCustomerId() {
return customerId;
}
public void setCustomerId(int customerId) {
this.customerId = customerId;
}
public String getMedicineId() {
return goodsId;
}
public void setMedicineId(String goodsId) {
this.goodsId = goodsId;
}
public Float getSellPrice() {
return sellPrice;
}
public void setSellPrice(float sellPrice) {
this.sellPrice = sellPrice;
}
public int getSellQuantity() {
return sellQuantity;
}
public void setSellQuantity(int sellQuantity) {
this.sellQuantity = sellQuantity;
}
public String getSellDate() {
return sellDate;
}
public void setSellDate(String sellDate) {
this.sellDate = sellDate;
}
}
class DBStock {
private String goodsId;
private String goodsName;
private int stocks;
private String manufacturer;
private String standard;
private double retailPrice;
public String getMedicineId() {
return goodsId;
}
public void setMedicineID(String goodsId) {
this.goodsId = goodsId;
}
public String getMedName () {
return this.goodsName;
}
public void setMedName(String goodsName) {
this.goodsName = goodsName;
}
public int getStocks() {
return this.stocks;
}
public void setStocks(int stocks) {
this.stocks = stocks;
}
public String getManufacturer() {
return this.manufacturer;
}
public void setManfacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public String getStandard() {
return this.standard;
}
public void setStandard(String standard) {
this.standard = standard;
}
public double getRetailPrice() {
return this.retailPrice;
}
public void setRetailPrice(double retailPrice) {
this.retailPrice = retailPrice;
}
}
class DBConnection {
private static Connection con = null;
private static String classForName = "org.gjt.mm.mysql.Driver";
private static String serverAndDB = "jdbc:mysql://localhost/SuperMarket";
private static String user = "root";
private static String pwd = "123456";
public DBConnection() {
}
public static Connection getDBConnection() {
try {
if(con == null || con.isClosed()) {
Class.forName(classForName);
con = DriverManager.getConnection(serverAndDB,user,pwd);
}
}
catch (Exception e) {
e.printStackTrace();
}
return con;
}
public static void closeDBConnection() throws Exception{
if(!con.isClosed()) {
con.close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -