/** 修改 */ public boolean update(BaseVo baseVo) { Knowledgebase vo = (Knowledgebase) baseVo; StringBuffer sql = new StringBuffer(); sql.append("update system_knowledgebase set category='"); sql.append(vo.getCategory()); sql.append("',entity='"); sql.append(vo.getEntity()); sql.append("',subentity='"); sql.append(vo.getSubentity()); sql.append("',titles='"); sql.append(vo.getTitles()); sql.append("',contents='"); sql.append(vo.getContents()); sql.append("',bak='"); sql.append(vo.getBak()); sql.append("',attachfiles='"); sql.append(vo.getAttachfiles()); sql.append("' where id="); sql.append(vo.getId()); return saveOrUpdate(sql.toString()); }
/** 保存 */ public boolean save(BaseVo baseVo) { Knowledgebase vo = (Knowledgebase) baseVo; StringBuffer sql = new StringBuffer(); sql.append( "insert into system_knowledgebase(category,entity,subentity,titles,contents,bak,attachfiles,userid)values("); sql.append("'"); sql.append(vo.getCategory()); sql.append("','"); sql.append(vo.getEntity()); sql.append("','"); sql.append(vo.getSubentity()); sql.append("','"); sql.append(vo.getTitles()); sql.append("','"); sql.append(vo.getContents()); sql.append("','"); sql.append(vo.getBak()); sql.append("','"); sql.append(vo.getAttachfiles()); sql.append("','"); sql.append(vo.getUserid()); sql.append("');"); return saveOrUpdate(sql.toString()); }
public BaseVo loadFromRS(ResultSet rs) { Knowledgebase vo = new Knowledgebase(); try { vo.setId(rs.getInt("id")); vo.setCategory(rs.getString("category")); vo.setEntity(rs.getString("entity")); vo.setSubentity(rs.getString("subentity")); vo.setTitles(rs.getString("titles")); vo.setContents(rs.getString("contents")); vo.setBak(rs.getString("bak")); vo.setAttachfiles(rs.getString("attachfiles")); vo.setUserid(rs.getString("userid")); vo.setKtime(rs.getString("ktime")); } catch (Exception e) { e.printStackTrace(); vo = null; } return vo; }