public int addGoods(Goods goods) { String sql = "insert into Goods values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; Object[] objects = new Object[] { goods.getGoodsId(), goods.getGoodsName(), goods.getSupplierId(), goods.getGoodsLargeClassId(), goods.getGoodsSmallClassId(), goods.getGoodsCode(), goods.getGoodsSize(), goods.getBarCode1(), goods.getBarCode2(), goods.getBarCode3(), goods.getUnit(), goods.getWholeSalePrice(), goods.getRetailPrice(), goods.getMemberprice() }; int result = DbOperation.executeUpdate(sql, objects); return result; }
public int updateGoods(Goods goods) { String sql = "update Goods set goodsName = ?, supplierId = ?," + "goodsLargeClassId = ?, goodsSmallClassId = ?," + "goodsCode = ?, goodsSize = ?," + "barCode1 = ?, barCode2 = ?," + "barCode3 = ?, unit = ?," + "wholeSalePrice = ?, retailPrice = ?," + "memberPrice = ? where goodsId = '" + goods.getGoodsId() + "'"; Object[] objects = new Object[] { goods.getGoodsName(), goods.getSupplierId(), goods.getGoodsLargeClassId(), goods.getGoodsSmallClassId(), goods.getGoodsCode(), goods.getGoodsSize(), goods.getBarCode1(), goods.getBarCode2(), goods.getBarCode3(), goods.getUnit(), goods.getWholeSalePrice(), goods.getRetailPrice(), goods.getMemberprice() }; int result = DbOperation.executeUpdate(sql, objects); return result; }