文件名称:java仓库管理
文件大小:130KB
文件格式:RAR
更新时间:2015-07-16 12:54:43
java
货架仓库管理package real.action.dao;
import java.io.PrintStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.ComboBoxModel;
import real.action.data.SupplierData;
import real.action.sql.ConnectionFactory;
public class SupplierDao
{
private Connection conn;
private Statement statement;
private PreparedStatement preparedStatement;//SQL 语句被预编译并存储在 PreparedStatement 对象中。然后可以使用此对象多次高效地执行该语句。
private ResultSet resultSet;//结果集
public boolean addSupplier(SupplierData s)//添加供应商
{
String sql = "insert into suppliers values(?,?,?,?,?,?,?,?)";
try
{
this.conn = ConnectionFactory.getConnection();
this.preparedStatement = this.conn.prepareStatement(sql);
this.preparedStatement.setInt(1, s.getSupplierId());
this.preparedStatement.setString(2, s.getSupplierName());
this.preparedStatement.setString(3, s.getSupplierAddress());
this.preparedStatement.setString(4, s.getPostCode());
this.preparedStatement.setString(5, s.getSupplierTelephone());
this.preparedStatement.setString(6, s.getSupplierFax());
this.preparedStatement.setString(7, s.getSupplierRelationer());
this.preparedStatement.setString(8, s.getSupplierEmail());
int flag = this.preparedStatement.executeUpdate();
if (flag > 0) {
return true;
}
}
catch (Exception e)
{
e.printStackTrace();
}
return false;
}
public boolean isExistSupplierData()
{
boolean flag = true;
int row = 0;
String sql = "select count(sup_id) as count from suppliers";
try {
this.conn = ConnectionFactory.getConnection();
this.statement = this.conn.createStatement();
this.resultSet = this.statement.executeQuery(sql);
if (this.resultSet.next()) {
row = this.resultSet.getInt("count");
}
if (row == 0) {
return false;
}
}
catch (Exception e)
{
e.printStackTrace();
}
return flag;
}
public boolean isExistSupplierById(int number)//ID已存在
{
boolean flag = false;
String sql = "select sup_id from suppliers";
try
{
this.conn = ConnectionFactory.getConnection();
this.statement = this.conn.createStatement();
this.resultSet = this.statement.executeQuery(sql);
while (this.resultSet.next()) {
SupplierData supplierData = new SupplierData();
supplierData.setSupplierId(this.resultSet.getInt(1));//设置ID
if (supplierData.getSupplierId() == number) {//比较ID
flag = true;
break;
}
}
}
catch (Exception e) {
e.printStackTrace();
}
return flag;
}
public List<Object> getFindAllSupplierId()//获取所有供应商id
{
List listsupplierId = new ArrayList();//滚动列表
String sql = "select sup_id from suppliers ";
try
{
this.conn = ConnectionFactory.getConnection();
this.statement = this.conn.createStatement();
this.resultSet = this.statement.executeQuery(sql);
while (this.resultSet.next())
listsupplierId.add(Integer.valueOf(this.resultSet.getInt(1)));
}
catch (Exception e) {
e.printStackTrace();
}
return listsupplierId;
}
public SupplierData getSupplierbySupplierName(String name) {
SupplierData supplierData = null;
String sql = "select * from suppliers where sup_name = ?";
try
{
this.conn = ConnectionFactory.getConnection();
this.preparedStatement = this.conn.prepareStatement(sql);
this.preparedStatement.setString(1, name);
this.resultSet = this.preparedStatement.executeQuery();
if (this.resultSet.next()) {
supplierData = new SupplierData();
supplierData.setSupplierId(this.resultSet.getInt(1));
supplierData.setSupplierName(this.resultSet.getString(2));
supplierData.setSupplierAddress(this.resultSet.getString(3));
supplierData.setPostCode(this.resultSet.getString(4));
supplierData.setSupplierTelephone(this.resultSet.getString(5));
supplierData.setSupplierFax(this.resultSet.getString(6));
supplierData.setSupplierRelationer(this.resultSet.getString(7));
supplierData.setSupplierEmail(this.resultSet.getString(8));
}
}
catch (Exception e) {
e.printStackTrace();
}
return supplierData;
}
public Map
【文件预览】:
仓库管理
----CheckSupplierPanel.java(5KB)
----ProductDao.java(11KB)
----LoginPanel.java(640B)
----SupplierDao.java(11KB)
----RemoveOperatorPanel.java(3KB)
----ConnectionFactory.java(1KB)
----UserDao.java(4KB)
----CheckProductPanel.java(9KB)
----TimeDemo.java(1005B)
----ProductManagePanel.java(599B)
----MySupplierTable.java(1KB)
----UserLogin.java(3KB)
----ModifyProductPanel.java(14KB)
----SupplierData.java(2KB)
----ImportProductPanel.java(4KB)
----ModifySupplierPanel.java(11KB)
----AddOperatorPanel.java(3KB)
----Storage.java(4KB)
----AddSupplierPanel.java(5KB)
----InputKeyListener.java(361B)
----ProductIO.java(3KB)
----UserData.java(1KB)
----ProductData.java(1KB)
----MyTable.java(1KB)
----LoginDao.java(1KB)
----report()
----compiledFile()
--------MyTable.class(2KB)
--------AddSupplierPanel$1.class(1KB)
--------ImportProductPanel$HeShiActionListener.class(2KB)
--------SupplierData.class(2KB)
--------ImportProductPanel.class(6KB)
--------LoginPanel.class(1KB)
--------CheckProductPanel$1.class(3KB)
--------OutportProductPanel$1.class(969B)
--------UserData.class(1KB)
--------UserDao.class(4KB)
--------AddProductPanel$1.class(1KB)
--------ModifyProductPanel.class(6KB)
--------UserLogin$1.class(2KB)
--------ModifySupplierPanel$ModifyActionListener.class(3KB)
--------RemoveOperatorPanel$2.class(997B)
--------ModifyProductPanel$RemoveActionlistener.class(2KB)
--------AddOperatorPanel.class(2KB)
--------AddSupplierPanel.class(3KB)
--------ImportProductPanel$ComboBoxListener.class(1KB)
--------AddOperatorPanel$1.class(2KB)
--------RemoveOperatorPanel.class(2KB)
--------CheckProductPanel$2.class(1KB)
--------ModifyProductPanel$ModifyActionListener.class(4KB)
--------OutportProductPanel$ChuHuoActionListenr.class(2KB)
--------ModifyUserPasswordPanel.class(3KB)
--------ModifySupplierPanel.class(8KB)
--------RemoveOperatorPanel$1.class(2KB)
--------TimeDemo.class(2KB)
--------ModifyProductPanel$ComboBoxListener.class(2KB)
--------ModifyUserPasswordPanel$2.class(3KB)
--------MySupplierTable.class(2KB)
--------ProductData.class(2KB)
--------CheckSupplierPanel.class(5KB)
--------ProductIO.class(4KB)
--------CheckProductPanel$OutputProductListener.class(1KB)
--------LoginDao.class(2KB)
--------OutportProductPanel.class(6KB)
--------UserLogin$2.class(983B)
--------CheckProductPanel$ImprotProduct.class(1KB)
--------ModifySupplierPanel$RemoveActionListener.class(4KB)
--------AddSupplierPanel$2.class(3KB)
--------CheckSupplierPanel$CheckSupplierById.class(2KB)
--------SupplierManagePanel.class(1KB)
--------OutportProductPanel$HeShiActionListener.class(2KB)
--------Storage.class(5KB)
--------ModifyUserPasswordPanel$1.class(1KB)
--------ModifySupplierPanel$ResetModifyListener.class(2KB)
--------ProductManagePanel.class(1KB)
--------CheckSupplierPanel$AllSupplierCheck.class(2KB)
--------AddProductPanel$ProductListener.class(5KB)
--------InputKeyListener.class(713B)
--------ProductDao.class(9KB)
--------OutportProductPanel$ComboBoxListener.class(1KB)
--------AddOperatorPanel$2.class(1KB)
--------AddProductPanel.class(6KB)
--------SupplierDao.class(8KB)
--------ModifySupplierPanel$CheckSupplierListener.class(3KB)
--------OperatorManage.class(1KB)
--------CheckProductPanel.class(6KB)
--------ConnectionFactory.class(2KB)
--------ImportProductPanel$1.class(962B)
--------ModifyProductPanel$checkModifyActionListener.class(4KB)
--------ImportProductPanel$JinHuoActionListenr.class(2KB)
--------ModifySupplierPanel$ComboBoxListener.class(1KB)
--------ModifyProductPanel$ResetmodifyActionListener.class(2KB)
--------CheckSupplierPanel$ComboBoxListener.class(2KB)
--------UserLogin.class(3KB)
----ModifyUserPasswordPanel.java(4KB)
----SupplierManagePanel.java(614B)
----OutportProductPanel.java(5KB)
----OperatorManage.java(641B)
----AddProductPanel.java(9KB)