src/org/bs/dao/impl/SupplierDaoImpl.java
(开头部分) 4KB这里只显示每个文件的开头 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.SupplierDao;
import org.bs.model.Supplier;
import org.bs.utils.ConnContext;
import org.bs.utils.DB;
import org.bs.utils.PageContext;
public class SupplierDaoImpl extends BaseDao implements SupplierDao {
public void save(Supplier supplier) {
Connection conn = ConnContext.getConn();
PreparedStatement pstmt = null;
String sql = "insert into t_supplier (name,incharge,tel,descp) values(?,?,?,?)";
try {
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supplier.getName());
pstmt.setString(2, supplier.getIncharge());
pstmt.setString(3, supplier.getTel());
pstmt.setString(4, supplier.getDescp());
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_supplier 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(Supplier supplier) {
Connection conn = ConnContext.getConn();
PreparedStatement pstmt = null;
String sql = "update t_supplier set name=?,incharge=?,tel=?,descp=?"
+ " where id = ?";
try {
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supplier.getName());
pstmt.setString(2, supplier.getIncharge());
pstmt.setString(3, supplier.getTel());
pstmt.setString(4, supplier.getDescp());
pstmt.setInt(5, supplier.getId());
pstmt.executeUpdate();
后面还有 94 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
