📄 harddisk.java
字号:
package informationsystem.information;
import informationsystem.database.DBHandler;
import java.sql.*;
public class HardDisk {
public HardDisk() {
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
private String Price;
private String Capacity;
private String Factory;
private String belong_interface;
private String DetailContent;
private String ApplyType;
private DBHandler db = new DBHandler();
public HardDisk(String Price) {
ResultSet rs = db.getHardDisk(Price);
try {
while (rs.next()) {
this.Price= Price;
this.Capacity = rs.getString("Capacity");
this.Factory= rs.getString("Factory");
this.belong_interface = rs.getString("InterfaceType");
this.DetailContent=rs.getString("DetailContent");
this.ApplyType=rs.getString("ApplyType");//****************************
}
}
catch (SQLException ex) {
ex.printStackTrace();
}
finally {
try {
rs.close();
}
catch (SQLException ex) {
ex.printStackTrace();
}
}
}
public HardDisk(String price, String Capacity, String Factory,
String belong_interface,String ApplyType,String DetailContent) {
this.Price= price;
this.Capacity=Capacity;
this.Factory = Factory;
this.belong_interface = belong_interface;
this.DetailContent=DetailContent;
this.ApplyType=ApplyType;
}
/**
*
* 以下四个方法用来获取硬盘的基本信息。
*/
public String getPrice() {
return this.Price;
}
public String getCapacity() {
return this.Capacity;
}
public String getFactory() {
return this.Factory;
}
public String getBelongInterface() {
return this.belong_interface;
}
public String getDetailContent() { //***************************
return this.DetailContent;
}
public String getApplyType() {
return this.ApplyType;
}
/**
* 以下四个方法用来设置硬盘的一些信息;
* @param name String
*/
public void setPrice(String Price) { ///设置硬盘价格
this.Price= Price;
}
public void setCapacity(String Capacity) {//设置硬盘容量
this.Capacity= Capacity;
}
public void setFactory(String Factory) {//设置生产厂家
this.Factory= Factory;
}
public void setInterfaceType(String InterfaceType) {//设置接口类型
this.belong_interface= InterfaceType;
}
public void setApplyType(String ApplyType) {//设置用户类型
this.ApplyType= ApplyType;
}
public void setDetailContent(String DetailContent) {//设置详细信息
this.DetailContent= DetailContent;
}
/**
* update()用来修改硬盘信息;
*/
public boolean update() {
return db.updateHardDisk(this.Price, this.Capacity, this.Factory,
this.belong_interface,this.ApplyType);//*********************
}
/**
* 添加硬盘;
* @param HardDiskPrice String
* @param name String
* @param Factory String
* @param InterfaceType String
* @return boolean
*/
public static boolean addHardDisk(String Price, String Capacity,
String Factory,String InterfaceType,String ApplyType) {
return new DBHandler().addHardDisk(ApplyType,Capacity,Factory,Price,InterfaceType);
//(Price, Capacity, Factory, InterfaceType,ApplyType);
}
public static boolean deleteHardDisk(String number) {
return new DBHandler().deleteHardDisk(number);
}
private void jbInit() throws Exception {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -