⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 goods.java

📁 一个货物管理系
💻 JAVA
字号:
package good;

import java.sql.ResultSet;
import java.util.Vector;





public class Goods {

	/**
	 * @param args
	 */
	private String goodId;
	private String goodName;
	private String goodNumber;
	private String goodPrice;
	public String getGoodId() {
		return goodId;
	}
	public void setGoodId(String goodId) {
		this.goodId = goodId;
	}
	public String getGoodName() {
		return goodName;
	}
	public void setGoodName(String goodName) {
		this.goodName = goodName;
	}
	public String getGoodNumber() {
		return goodNumber;
	}
	public void setGoodNumber(String goodNumber) {
		this.goodNumber = goodNumber;
	}
	public String getGoodPrice() {
		return goodPrice;
	}
	public void setGoodPrice(String goodPrice) {
		this.goodPrice = goodPrice;
	}
	
	public boolean goodsAdd()
	{
		DataConn storCon = new DataConn();
		String addSql = null;
		storCon.dataConnDerectForMySql();
		addSql="Insert into goods(goodId,goodName,goodNumber,goodPrice) values('"+goodId
		+"','"+goodName+"','"+goodNumber+"','"+goodPrice+"')";
		storCon.executeDerectUpdate(addSql);
		return true;
	}
	public boolean goodsModi()
	{
		DataConn storCon = new DataConn();
		String addSql = null;
		storCon.dataConnDerectForMySql();
		addSql="update goods set goodName='"+goodName+"',"+
		"goodNumber='"+goodNumber+"',goodPrice='"+goodPrice+
		"' where goodId='"+goodId+"'";
		storCon.executeDerectUpdate(addSql);
		return true;
	}
	public Vector GetAllGoodId() {
		String quy;
		String temp;
		int i = 0;
		DataConn storCon = new DataConn();
		Vector list = new Vector();
		storCon.dataConnDerectForMySql();
		ResultSet rs = null;
		quy = "select goodid from goods order by goodId";
		try {
			rs = storCon.executeDerectQuery(quy);

			while (rs.next()) {
				
				temp=rs.getString(1);
				System.out.println(temp);
				list.add(temp==null? "":temp.trim());

			}
		} catch (Exception e) {
			e.printStackTrace();

		}
		return list;

	}
	public void resultData() {
		String quy;
		DataConn storCon = new DataConn();
		String addSql = null;
		ResultSet rs = null;
		storCon.dataConnDerectForMySql();
		quy = "select * from goods where goodId='" + this.getGoodId() +"'";
		try {
			rs = storCon.executeDerectQuery(quy);
			if (rs.next()) {
				this.setGoodName(rs.getString("goodName"));
				this.setGoodNumber(rs.getString("GoodNumber"));
				this.setGoodPrice(rs.getString("GoodPrice"));
			} else {

			}
			rs.close();
		} catch (Exception e) {
			e.printStackTrace();

		}
	}
	public boolean checkData() {
		String quy;
		DataConn storCon = new DataConn();
		ResultSet rs = null;
		storCon.dataConnDerectForMySql();
		quy = "select * from goods where goodId='" + this.getGoodId() + "'";
		try {
			rs = storCon.executeDerectQuery(quy);
			if (rs.next()) {
				return false;
			} else {
				return true;
			}
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}

	}
	public boolean checkExist(String id) {
		String quy;
		DataConn storCon = new DataConn();
		ResultSet rs = null;
		storCon.dataConnDerectForMySql();
		quy = "select * from goods where goodId='" + id + "'";
		try {
			rs = storCon.executeDerectQuery(quy);
			if (rs.next()) {
				return false;
			} else {
				return true;
			}
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}

	}
	private void goodName(String string) {
		// TODO Auto-generated method stub
		
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -