@Override public boolean upsanpinshenpi(Sanpinshenpi s) throws Exception { // TODO Auto-generated method stub String sql = "UPDATE sanpinshenpi SET tijiaouserid=tijiaouserid+1-1"; StringBuffer sb = new StringBuffer(sql); List l = new ArrayList(); s.setShenpizhuangtai(2); if (s.getShenpizhuangtai() != 0) { sb.append(",shenpizhuangtai=?"); l.add(s.getShenpizhuangtai()); } if (s.getShenpijieguo() != 0) { sb.append(",shenpijieguo=?"); l.add(s.getShenpijieguo()); } if (s.getShenpiyijian() != null && !"".equals(s.getShenpiyijian())) { sb.append(",shenpiyijian=?"); l.add(s.getShenpiyijian()); } if (s.getShenpiuserid() != 0) { sb.append(",shenpiuserid=?"); l.add(s.getShenpiuserid()); } sb.append(",shenpitime=?"); s.setShenpishijian(new Date()); l.add(s.getShenpishijian()); sb.append(" where id=?"); l.add(s.getId()); int num = this.update(sb.toString(), l.toArray()); return num > 0; }
@Override public boolean Addsanpinshenpi(Sanpinshenpi s) throws Exception { // TODO Auto-generated method stub s.setTijiaotime(new Date()); s.setShenpizhuangtai(1); String sql = "insert into sanpinshenpi(tuanNo,tijiaouserid,beizhu,tijiaotime,shenpizhuangtai,shenpijieguo,shenpiyijian,shenpiuserid,shenpitime) values(?,?,?,?,?,?,?,?,?)"; int num = this.update( sql, s.getTuanNo(), s.getTijiaouserid(), s.getBeizhu(), s.getTijiaotime(), s.getShenpizhuangtai(), s.getShenpijieguo(), s.getShenpiyijian(), s.getShenpiuserid(), s.getShenpishijian()); return num > 0; }