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

📄 goodsinfodao.java

📁 老牌java开发的物流管理系统 详细的我也没有怎么看 好像是恒基的
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
		db.openDB();
		try {
			db.ps = db.conn.prepareStatement(sql);
			db.ps.setInt(1, goodsSupplyId);
			rs = db.ps.executeQuery();
			while (rs.next()) {
				int id = rs.getInt("Id");
				String goodsId = rs.getString("GoodsId");
				String goodsName = rs.getString("GoodsName");
				int goodsCateId = rs.getInt("GoodsCateId");
				goodsSupplyId = rs.getInt("GoodsSupplyId");
				String goodsABC = rs.getString("GoodsABC");
				String goodsProvince = rs.getString("GoodsProvince");
				String goodsCity = rs.getString("GoodsCity");
				int goodsStockId = rs.getInt("GoodsStockId");
				float goodsPrice = rs.getFloat("GoodsPrice");
				int goodsStockNumber = rs.getInt("GoodsStockNumber");
				String goodsOrderDate = rs.getString("GoodsOrderDate");
				String goodsStockInDate = rs.getString("GoodsStockInDate");
				String goodsUnit = rs.getString("GoodsUnit");
			int typeId = rs.getInt("TypeId");
				GoodsInfo goodsinfo = new GoodsInfo(id, goodsId, goodsName,
						goodsCateId, goodsSupplyId, goodsABC, goodsProvince,
						goodsCity, goodsStockId, goodsPrice, goodsStockNumber,
						goodsOrderDate, goodsStockInDate, goodsUnit,
						typeId);
				list.add(goodsinfo);
			}
		} catch (SQLException e) {
			e.printStackTrace();
			System.out.println("数据库连接失败!");
		} finally {
			db.closeDB();
		}
		return list;
	}

	/**
	 * 根据商品ABC分类查询商品信息方法
	 * 
	 * @param goodsABC
	 * @return list
	 */
	// ----------------------根据商品ABC分类查询商品信息方法-------------------------------
	public List<GoodsInfo> selectGoodsInfoByGoodsABC(String goodsABC) {
		List<GoodsInfo> list = new ArrayList<GoodsInfo>();
		String sql = "select * from goodsinfotable where GoodsABC=?";
		db.openDB();
		try {
			db.ps = db.conn.prepareStatement(sql);
			db.ps.setString(1, goodsABC);
			rs = db.ps.executeQuery();
			while (rs.next()) {
				int id = rs.getInt("Id");
				String goodsId = rs.getString("GoodsId");
				String goodsName = rs.getString("GoodsName");
				int goodsCateId = rs.getInt("GoodsCateId");
				int goodsSupplyId = rs.getInt("GoodsSupplyId");
				goodsABC = rs.getString("GoodsABC");
				String goodsProvince = rs.getString("GoodsProvince");
				String goodsCity = rs.getString("GoodsCity");
				int goodsStockId = rs.getInt("GoodsStockId");
				float goodsPrice = rs.getFloat("GoodsPrice");
				int goodsStockNumber = rs.getInt("GoodsStockNumber");
				String goodsOrderDate = rs.getString("GoodsOrderDate");
				String goodsStockInDate = rs.getString("GoodsStockInDate");
				String goodsUnit = rs.getString("GoodsUnit");
				int typeId = rs.getInt("TypeId");
				GoodsInfo goodsinfo = new GoodsInfo(id, goodsId, goodsName,
						goodsCateId, goodsSupplyId, goodsABC, goodsProvince,
						goodsCity, goodsStockId, goodsPrice, goodsStockNumber,
						goodsOrderDate, goodsStockInDate, goodsUnit,
						typeId);
				list.add(goodsinfo);
			}
		} catch (SQLException e) {
			e.printStackTrace();
			System.out.println("数据库连接失败!");
		} finally {
			db.closeDB();
		}
		return list;
	}

	/**
	 * 根据商品产地省查询商品信息方法
	 * 
	 * @param goodsProvince
	 * @return list
	 */
	// ----------------------根据商品产地省查询商品信息方法-------------------------------
	public List<GoodsInfo> selectGoodsInfoByGoodsProvince(String goodsProvince) {
		List<GoodsInfo> list = new ArrayList<GoodsInfo>();
		String sql = "select * from goodsinfotable where GoodsProvince=?";
		db.openDB();
		try {
			db.ps = db.conn.prepareStatement(sql);
			db.ps.setString(1, goodsProvince);
			rs = db.ps.executeQuery();
			while (rs.next()) {
				int id = rs.getInt("Id");
				String goodsId = rs.getString("GoodsId");
				String goodsName = rs.getString("GoodsName");
				int goodsCateId = rs.getInt("GoodsCateId");
				int goodsSupplyId = rs.getInt("GoodsSupplyId");
				String goodsABC = rs.getString("GoodsABC");
				goodsProvince = rs.getString("GoodsProvince");
				String goodsCity = rs.getString("GoodsCity");
				int goodsStockId = rs.getInt("GoodsStockId");
				float goodsPrice = rs.getFloat("GoodsPrice");
				int goodsStockNumber = rs.getInt("GoodsStockNumber");
				String goodsOrderDate = rs.getString("GoodsOrderDate");
				String goodsStockInDate = rs.getString("GoodsStockInDate");
				String goodsUnit = rs.getString("GoodsUnit");
				int typeId = rs.getInt("TypeId");
				GoodsInfo goodsinfo = new GoodsInfo(id, goodsId, goodsName,
						goodsCateId, goodsSupplyId, goodsABC, goodsProvince,
						goodsCity, goodsStockId, goodsPrice, goodsStockNumber,
						goodsOrderDate, goodsStockInDate, goodsUnit,
						typeId);
				list.add(goodsinfo);
			}
		} catch (SQLException e) {
			e.printStackTrace();
			System.out.println("数据库连接失败!");
		} finally {
			db.closeDB();
		}
		return list;
	}

	/**
	 * 根据商品定购日期查询商品信息方法
	 * 
	 * @param goodsOrderDate
	 * @return list
	 */
	// ----------------------根据商品定购日期查询商品信息方法-------------------------------
	public List<GoodsInfo> selectGoodsInfoByOrderDate(String goodsOrderDate) {
		List<GoodsInfo> list = new ArrayList<GoodsInfo>();
		String sql = "select * from goodsinfotable where GoodsOrderDate=?";
		db.openDB();
		try {
			db.ps = db.conn.prepareStatement(sql);
			db.ps.setString(1, goodsOrderDate);
			rs = db.ps.executeQuery();
			while (rs.next()) {
				int id = rs.getInt("Id");
				String goodsId = rs.getString("GoodsId");
				String goodsName = rs.getString("GoodsName");
				int goodsCateId = rs.getInt("GoodsCateId");
				int goodsSupplyId = rs.getInt("GoodsSupplyId");
				String goodsABC = rs.getString("GoodsABC");
				String goodsProvince = rs.getString("GoodsProvince");
				String goodsCity = rs.getString("GoodsCity");
				int goodsStockId = rs.getInt("GoodsStockId");
				float goodsPrice = rs.getFloat("GoodsPrice");
				int goodsStockNumber = rs.getInt("GoodsStockNumber");
				goodsOrderDate = rs.getString("GoodsOrderDate");
				String goodsStockInDate = rs.getString("GoodsStockInDate");
				String goodsUnit = rs.getString("GoodsUnit");
				int typeId = rs.getInt("TypeId");
				GoodsInfo goodsinfo = new GoodsInfo(id, goodsId, goodsName,
						goodsCateId, goodsSupplyId, goodsABC, goodsProvince,
						goodsCity, goodsStockId, goodsPrice, goodsStockNumber,
						goodsOrderDate, goodsStockInDate, goodsUnit,
						typeId);
				list.add(goodsinfo);
			}
		} catch (SQLException e) {
			e.printStackTrace();
			System.out.println("数据库连接失败!");
		} finally {
			db.closeDB();
		}
		return list;
	}

	/**
	 * 根据商品产地市查询商品信息方法
	 * 
	 * @param goodsCity
	 * @return list
	 */
	// ----------------------根据商品产地市查询商品信息方法-------------------------------
	public List<GoodsInfo> selectGoodsInfoByGoodsCity(String goodsCity) {
		List<GoodsInfo> list = new ArrayList<GoodsInfo>();
		String sql = "select * from goodsinfotable where GoodsCity=?";
		db.openDB();
		try {
			db.ps = db.conn.prepareStatement(sql);
			db.ps.setString(1, goodsCity);
			rs = db.ps.executeQuery();
			while (rs.next()) {
				int id = rs.getInt("Id");
				String goodsId = rs.getString("GoodsId");
				String goodsName = rs.getString("GoodsName");
				int goodsCateId = rs.getInt("GoodsCateId");
				int goodsSupplyId = rs.getInt("GoodsSupplyId");
				String goodsABC = rs.getString("GoodsABC");
				String goodsProvince = rs.getString("GoodsProvince");
				goodsCity = rs.getString("GoodsCity");
				int goodsStockId = rs.getInt("GoodsStockId");
				float goodsPrice = rs.getFloat("GoodsPrice");
				int goodsStockNumber = rs.getInt("GoodsStockNumber");
				String goodsOrderDate = rs.getString("GoodsOrderDate");
				String goodsStockInDate = rs.getString("GoodsStockInDate");
				String goodsUnit = rs.getString("GoodsUnit");
				int typeId = rs.getInt("TypeId");
				GoodsInfo goodsinfo = new GoodsInfo(id, goodsId, goodsName,
						goodsCateId, goodsSupplyId, goodsABC, goodsProvince,
						goodsCity, goodsStockId, goodsPrice, goodsStockNumber,
						goodsOrderDate, goodsStockInDate, goodsUnit,
						typeId);
				list.add(goodsinfo);
			}
		} catch (SQLException e) {
			e.printStackTrace();
			System.out.println("数据库连接失败!");
		} finally {
			db.closeDB();
		}
		return list;
	}

	/**
	 * 根据商品入库日期查询商品信息方法
	 * 
	 * @param goodsStockInDate
	 * @return list
	 */
	// ----------------------根据商品入库日期查询商品信息方法-------------------------------
	public List<GoodsInfo> selectGoodsInfoByStockInDate(String goodsStockInDate) {
		List<GoodsInfo> list = new ArrayList<GoodsInfo>();
		String sql = "select * from goodsinfotable where GoodsStockInDate=?";
		db.openDB();
		try {
			db.ps = db.conn.prepareStatement(sql);
			db.ps.setString(1, goodsStockInDate);
			rs = db.ps.executeQuery();
			while (rs.next()) {
				int id = rs.getInt("Id");
				String goodsId = rs.getString("GoodsId");
				String goodsName = rs.getString("GoodsName");
				int goodsCateId = rs.getInt("GoodsCateId");
				int goodsSupplyId = rs.getInt("GoodsSupplyId");
				String goodsABC = rs.getString("GoodsABC");
				String goodsProvince = rs.getString("GoodsProvince");
				String goodsCity = rs.getString("GoodsCity");
				int goodsStockId = rs.getInt("GoodsStockId");
				float goodsPrice = rs.getFloat("GoodsPrice");
				int goodsStockNumber = rs.getInt("GoodsStockNumber");
				String goodsOrderDate = rs.getString("GoodsOrderDate");
				goodsStockInDate = rs.getString("GoodsStockInDate");
				String goodsUnit = rs.getString("GoodsUnit");
				int typeId = rs.getInt("TypeId");
				GoodsInfo goodsinfo = new GoodsInfo(id, goodsId, goodsName,
						goodsCateId, goodsSupplyId, goodsABC, goodsProvince,
						goodsCity, goodsStockId, goodsPrice, goodsStockNumber,
						goodsOrderDate, goodsStockInDate, goodsUnit,
						typeId);
				list.add(goodsinfo);
			}
		} catch (SQLException e) {
			e.printStackTrace();
			System.out.println("数据库连接失败!");
		} finally {
			db.closeDB();
		}
		return list;
	}

	/**
	 * 根据商品在库中位置编号查询商品信息方法
	 * 
	 * @param stockRegionId
	 * @return list
	 */
	// ----------------------根据商品在库中位置编号查询商品信息方法-------------------------------
	public List<GoodsInfo> selectGoodsInfoBystockRegionId(int stockRegionId) {
		List<GoodsInfo> list = new ArrayList<GoodsInfo>();
		String sql = "select * from goodsinfotable where StockRegionId=?";
		db.openDB();
		try {
			db.ps = db.conn.prepareStatement(sql);
			db.ps.setInt(1, stockRegionId);
			rs = db.ps.executeQuery();
			while (rs.next()) {
				int id = rs.getInt("Id");
				String goodsId = rs.getString("GoodsId");
				String goodsName = rs.getString("GoodsName");
				int goodsCateId = rs.getInt("GoodsCateId");
				int goodsSupplyId = rs.getInt("GoodsSupplyId");
				String goodsABC = rs.getString("GoodsABC");
				String goodsProvince = rs.getString("GoodsProvince");
				String goodsCity = rs.getString("GoodsCity");
				int goodsStockId = rs.getInt("GoodsStockId");
				float goodsPrice = rs.getFloat("GoodsPrice");
				int goodsStockNumber = rs.getInt("GoodsStockNumber");
				String goodsOrderDate = rs.getString("GoodsOrderDate");
				String goodsStockInDate = rs.getString("GoodsStockInDate");
				String goodsUnit = rs.getString("GoodsUnit");
				stockRegionId = rs.getInt("StockRegionId");
				int typeId = rs.getInt("TypeId");
				GoodsInfo goodsinfo = new GoodsInfo(id, goodsId, goodsName,
						goodsCateId, goodsSupplyId, goodsABC, goodsProvince,
						goodsCity, goodsStockId, goodsPrice, goodsStockNumber,
						goodsOrderDate, goodsStockInDate, goodsUnit,
						typeId);
				list.add(goodsinfo);
			}
		} catch (SQLException e) {
			e.printStackTrace();
			System.out.println("数据库连接失败!");
		} finally {
			db.closeDB();
		}
		return list;
	}

	/**
	 * 根据商品型号Id查询商品信息方法
	 * 
	 * @param typeId
	 * @return list
	 */
	// ----------------------根据商品型号Id查询商品信息方法-------------------------------
	public List<GoodsInfo> selectGoodsInfoByTypeId(int typeId) {
		List<GoodsInfo> list = new ArrayList<GoodsInfo>();
		String sql = "select * from goodsinfotable where TypeId=?";
		db.openDB();
		try {
			db.ps = db.conn.prepareStatement(sql);
			db.ps.setInt(1, typeId);
			rs = db.ps.executeQuery();
			while (rs.next()) {
				int id = rs.getInt("Id");
				String goodsId = rs.getString("GoodsId");
				String goodsName = rs.getString("GoodsName");
				int goodsCateId = rs.getInt("GoodsCateId");
				int goodsSupplyId = rs.getInt("GoodsSupplyId");
				String goodsABC = rs.getString("GoodsABC");
				String goodsProvince = rs.getString("GoodsProvince");
				String goodsCity = rs.getString("GoodsCity");
				int goodsStockId = rs.getInt("GoodsStockId");
				float goodsPrice = rs.getFloat("GoodsPrice");
				int goodsStockNumber = rs.getInt("GoodsStockNumber");

⌨️ 快捷键说明

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