src/org/bs/dao/impl/WarehouseDaoImpl.java

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package org.bs.dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import org.bs.dao.WarehouseDao;
import org.bs.model.Warehouse;
import org.bs.utils.ConnContext;
import org.bs.utils.DB;
import org.bs.utils.PageContext;

public class WarehouseDaoImpl extends BaseDao implements WarehouseDao {
	public void save(Warehouse warehouse) {
		Connection conn = ConnContext.getConn();
		PreparedStatement pstmt = null;
		String sql = "insert into t_warehouse (no,name,address,capacity,descp,max,min) values(?,?,?,?,?,?,?)";
		try {
			pstmt = conn.prepareStatement(sql);
			pstmt.setString(1, warehouse.getNo());
			pstmt.setString(2, warehouse.getName());
			pstmt.setString(3, warehouse.getAddress());
			pstmt.setString(4, warehouse.getCapacity());
			pstmt.setString(5, warehouse.getDescp());
			pstmt.setInt(6, warehouse.getMax());
			pstmt.setInt(7, warehouse.getMin());
			pstmt.executeUpdate();
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			DB.close(pstmt);
		}
	}

	public void delete(int id) {
		Connection conn = ConnContext.getConn();
		PreparedStatement pstmt = null;
		String sql = "delete from t_warehouse where id =?";
		try {
			pstmt = conn.prepareStatement(sql);
			pstmt.setInt(1, id);
			pstmt.executeUpdate();
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			DB.close(pstmt);
		}
	}

	public void update(Warehouse warehouse) {
		Connection conn = ConnContext.getConn();
		PreparedStatement pstmt = null;
		String sql = "update t_warehouse set no=?,name=?,address=?,capacity=?,descp=?,max=?,min=?"
				+ " where id = ?";
		try {
			pstmt = conn.prepareStatement(sql);
			pstmt.setString(1, warehouse.getNo());
			pstmt.setString(2, warehouse.getName());
			pstmt.setString(3, warehouse.getAddress());
后面还有 109 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。