package com.wgh.dao; import commerce.goods; import com.wgh.DB.chStr; import com.wgh.DB.connDB; public class GoodsDaoImpl implements GoodsDao { connDB conn = new connDB(); chStr chStr = new chStr(); public int insert(goods g) { int ret = -1; try { String sql = "Insert into tb_goods (TypeID,GoodsName,Introduce,Price,nowPrice,picture,newgoods,sale) values(" + g.getTypeID() + ",'" + chStr.chStr(g.getGoodsName()) + "','" + chStr.chStr(g.getIntroduce()) + "'," + g.getPrice() + "," + g.getPrice() + ",'" + chStr.chStr(g.getPicture()) + "'," + g.getNewGoods() + "," + g.getSale() + ")"; ret = conn.executeUpdate(sql); } catch (Exception e) { ret = 0; } conn.close(); return ret; } public int update(goods g) { int ret = -1; try { String sql = "update tb_Goods set TypeID=" +g.getTypeID() + ",GoodsName='" + chStr.chStr(g.getGoodsName()) + "',introduce='" + chStr.chStr(g.getIntroduce()) + "',price=" + g.getPrice() + ",nowprice=" + g.getNowPrice() +",picture='" + chStr.chStr(g.getPicture())+ "',newgoods=" + g.getNewGoods() + ",sale=" + g.getSale() + " where ID=" + g.getID(); ret = conn.executeUpdate(sql); } catch (Exception e) { ret = 0; } conn.close(); return ret; } public int delete(goods g) { int ret=-1; try{ String sql="Delete from tb_goods where ID="+g.getID(); ret=conn.executeUpdate(sql); }catch(Exception e){ ret=0; } conn.close(); return ret; } }

kingwjay LV2
5月21日
lawyer12321 LV1
3月21日
moyune1 LV2
2024年12月27日
84126415 LV2
2024年12月10日
yuanyuan927 LV1
2024年11月22日
微信网友_7222576034680832 LV2
2024年10月23日
colecole LV3
2024年10月8日
hlFDGd LV1
2024年6月11日
微信网友_7026079165190144 LV1
2024年6月6日
1234567tian LV2
2024年6月1日

denliv_hui LV14
7月31日
kingwjay LV2
5月21日
lawyer12321 LV1
3月21日
moyune1 LV2
2024年12月27日
ma406805131 LV19
2024年12月18日
WenMeng LV9
2024年12月16日
565236523
2024年12月10日
暂无贡献等级
9632148963 LV1
2024年12月10日
84126415 LV2
2024年12月10日
yuanyuan927 LV1
2024年11月22日