📄 customerbean.java
字号:
package Model_Customer;
import DataBase.ConDataBase;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Types;
public class CustomerBean
{
public CustomerBean()
{
}
public String InsertCustomer(Customer cm)
{
Connection con=ConDataBase.getConnection();
try{
CallableStatement cmst=con.prepareCall("{call INSERTCUSTOMER(?,?,?,?,?,?,?,?,?,?,?)}");
cmst.setString(1,cm.getCustomerID());
cmst.setString(2,cm.getCustomerName());
cmst.setString(3,cm.getCustomerSex());
cmst.setString(4,cm.getCustomerIdentityCard());
cmst.setString(5,cm.getCustomerProvince());
cmst.setString(6,cm.getCustomerCity());
cmst.setString(7,cm.getCustomerAddress());
cmst.setString(8,cm.getCustomerZipCode());
cmst.setString(9,cm.getCustomerEmail());
cmst.setString(10,cm.getCustomerTel());
cmst.registerOutParameter(11,Types.VARCHAR);
cmst.execute();
String re=cmst.getString(11);
return re;
}
catch(Exception e)
{
System.out.println(e.getMessage());
return e.getMessage();
}
}
public String UpdateCustomer(Customer cm)
{
Connection con=ConDataBase.getConnection();
try{
CallableStatement cmst=con.prepareCall("{call UPDATECUSTOMER(?,?,?,?,?,?,?,?,?,?,?)}");
cmst.setString(1,cm.getCustomerID());
cmst.setString(2,cm.getCustomerName());
cmst.setString(3,cm.getCustomerSex());
cmst.setString(4,cm.getCustomerIdentityCard());
cmst.setString(5,cm.getCustomerProvince());
cmst.setString(6,cm.getCustomerCity());
cmst.setString(7,cm.getCustomerAddress());
cmst.setString(8,cm.getCustomerZipCode());
cmst.setString(9,cm.getCustomerEmail());
cmst.setString(10,cm.getCustomerTel());
cmst.registerOutParameter(11,Types.VARCHAR);
cmst.execute();
String re=cmst.getString(11);
return re;
}
catch(Exception e)
{
System.out.println(e.getMessage());
return e.getMessage();
}
}
public String DeleteCustomer(String customerid)
{
Connection con=ConDataBase.getConnection();
try{
CallableStatement cmst=con.prepareCall("{call DELETECUSTOMER(?,?)}");
cmst.setString(1,customerid);
cmst.registerOutParameter(2,Types.VARCHAR);
cmst.execute();
String re=cmst.getString(2);
return re;
}
catch(Exception e)
{
System.out.println(e.getMessage());
return e.getMessage();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -