📄 customeroperation.java
字号:
package operation;
import dataBase.DataBase;
import java.util.ArrayList;
import java.util.Collection;
import entity.*;
import java.sql.*;
public class CustomerOperation
{
public CustomerOperation()
{
db = new DataBase();
}
//获得客户编号
public int addCustomerId()
{
try
{
sql1 = "select * from CustomerInfo";
rs = db.getResult(sql1);
rs.last();
customerID = rs.getRow()+1;
}
catch(SQLException e)
{
e.printStackTrace();
}
return customerID;
}
//录入客户信息
public void addCustomerInfo(boolean flag,int customerID,String customerNickName,String customerPassword,String customerName,String customerTax,String customerTel,String customerConn,String customerAddress,String customerBank,String customerAccount,String customerNotice)
{
if (flag == true)
{
sql2 = "insert into CustomerInfo values('"+customerID+"','"+customerNickName+"','"+customerPassword+"','"+customerName+"','"+customerTax+"','"+customerTel+"','"+customerConn+"','"+customerAddress+"','"+customerBank+"','"+customerAccount+"','"+customerNotice+"')";
db.ExeQuery(sql2);
}
}
public void modifyCustomerInfo(boolean flag,int customerID,String customerNickName,String customerPassword,String customerName,String customerTax,String customerTel,String customerConn,String customerAddress,String customerBank,String customerAccount,String customerNotice)
{
if(flag=true)
{
sql="update CustomerInfo set CustomerName='"+customerName+"',CustomerNickName='"+customerNickName+"',customerPassword='"+customerPassword+"',customerTax='"+customerTax+"',customerTel='"+customerTax+"',customerTel='"+customerTel+"',customerConn='"+customerConn+"',customerAddress='"+customerAddress+"',customerBank='"+customerBank+"',customerAccount='"+customerAccount+"',customerNotice='"+customerNotice+"'where customerID="+customerID;
db.ExeQuery(sql);
}
}
//关闭连接
public void close()
{
db.close();
}
public void shut()
{
db.shut();
}
private DataBase db = null;
private String sql1 = "";
private String sql2 = "";
private String sql="";
private ResultSet rs = null;
private int customerID = 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -