@Override public int deleteBill(Bill bill) throws Exception { int rowAffects = 0; con = BaseDao.getConnection(); String sql = "delete from t_bill where bill_id=?"; pstmt = con.prepareStatement(sql); pstmt.setInt(1, bill.getBill_id()); rowAffects = pstmt.executeUpdate(); BaseDao.closeAll(null, pstmt, con); return rowAffects; }
@Override public int updateBill(Bill bill) throws Exception { int rowAffects = 0; con = BaseDao.getConnection(); String sql = "update t_bill set productname = ?,suppliername=?,amount=?,price=?,pay=?,billtime=?,saleworker=? where bill_id=?"; pstmt = con.prepareStatement(sql); pstmt.setString(1, bill.getproductName()); pstmt.setString(2, bill.getsupplierName()); pstmt.setInt(3, bill.getAmount()); pstmt.setFloat(4, bill.getPrice()); pstmt.setFloat(5, bill.getPay()); pstmt.setString(6, bill.getBilltime()); pstmt.setString(7, bill.getsaleworker()); pstmt.setInt(8, bill.getBill_id()); rowAffects = pstmt.executeUpdate(); BaseDao.closeAll(null, pstmt, con); return rowAffects; }