public void addOneComment(DocComment docComment) throws DocCommentManagerException { // TODO Auto-generated method stub PreparedDBUtil preparedDB = new PreparedDBUtil(); DBUtil dbUitl = new DBUtil(); String sql = "insert into td_cms_doc_comment(comment_id, doc_id,doc_comment,user_name,comtime,user_ip,src_comment_id,status) values(?, ?,?,?,?,?,?,?)"; try { int id = (Integer) dbUitl.executeSelectForObject(executor.getSql("getCommentNextId"), Integer.class); preparedDB.preparedInsert(sql); preparedDB.setInt(1, id); preparedDB.setInt(2, docComment.getDocId()); preparedDB.setClob(3, docComment.getDocComment(), "doc_comment"); preparedDB.setString(4, docComment.getUserName()); preparedDB.setTimestamp(5, new Timestamp(new Date().getTime())); preparedDB.setString(6, docComment.getUserIP()); if (docComment.getSrcCommentId() == 0) preparedDB.setNull(7, Types.NUMERIC); else preparedDB.setInt(7, docComment.getSrcCommentId()); preparedDB.setInt(8, docComment.getStatus()); preparedDB.executePrepared(); } catch (SQLException e) { e.printStackTrace(); throw new DocCommentManagerException("新评论插入失败!" + e.getMessage()); } finally { preparedDB.resetPrepare(); } }
/* * (non-Javadoc) * * @see com.frameworkset.platform.cms.docCommentManager.DocCommentManager# * getChannelCommentAduitSwitch(int) */ @Override public Integer getChannelCommentAduitSwitch(int channelId) throws SQLException { Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("channelId", channelId); return executor.queryObjectBean(Integer.class, "getChannelCommentAduitSwitch", paramMap); }
public int getTotalCommnet(int docId) throws SQLException { Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("docId", docId); return executor.queryObjectBean(int.class, "getTotalCommnet", paramMap); }
/** * 获取频道评论 前n条数据 * * @param n * @return * @throws SQLException */ public NComentList getChannelCommnetList(String channel, int n) throws Exception { Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("channel", channel); paramMap.put("n", n + 1); TransactionManager tm = new TransactionManager(); try { tm.begin(tm.RW_TRANSACTION); NComentList nComentList = new NComentList(); nComentList.setComments( executor.queryListBean(DocComment.class, "getChannelCommnetNList", paramMap)); // Container container = new ContainerImpl(); // container.in /* if (!CollectionUtils.isEmpty(nComentList.getComments())) { for (DocComment docComment : nComentList.getComments()) { String documentUrl= container.getPublishedDocumentUrl(new Integer(docComment.getDocId()).toString()); docComment.setDocUrl(documentUrl); } }*/ nComentList.setTotal(getChannelCommentPublishedCount(channel)); return nComentList; } catch (SQLException e) { throw e; } catch (Exception e) { throw e; } finally { tm.releasenolog(); } }
/* * (non-Javadoc) * * @see com.frameworkset.platform.cms.docCommentManager.DocCommentManager# * switchDocCommentAudit(int, int) */ @Override public void switchDocCommentAudit(int channelId, int switchFlag) throws SQLException { Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("channelId", channelId); paramMap.put("switchFlag", switchFlag); executor.updateBean("switchDocCommentAudit", paramMap); }
public ListInfo getCommnetList(int docId, int offset, int maxItem) throws SQLException { // TODO Auto-generated method stub // throw new DocCommentManagerException("未实现!"); Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("docId", docId); return executor.queryListInfoBean( DocComment.class, "getCommnetList", offset, maxItem, paramMap); }
/** * 获取站点评论 前n条数据 * * @param n * @return * @throws SQLException */ public NComentList getSiteCommnetList(int n) throws Exception { Map<String, Object> paramMap = new HashMap<String, Object>(); // paramMap.put("docId", docId); paramMap.put("n", n + 1); TransactionManager tm = new TransactionManager(); try { tm.begin(tm.RW_TRANSACTION); NComentList nComentList = new NComentList(); nComentList.setComments( executor.queryListBean(DocComment.class, "getSiteCommnetNList", paramMap)); nComentList.setTotal(getSiteCommentPublishedCount()); return nComentList; } catch (SQLException e) { throw e; } catch (Exception e) { throw e; } finally { tm.releasenolog(); } }
public NComentList getCommnetList(int docId, int n) throws Exception { // TODO Auto-generated method stub // throw new DocCommentManagerException("未实现!"); Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("docId", docId); paramMap.put("n", n + 1); TransactionManager tm = new TransactionManager(); try { tm.begin(tm.RW_TRANSACTION); NComentList nComentList = new NComentList(); nComentList.setComments( executor.queryListBean(DocComment.class, "getCommnetNList", paramMap)); nComentList.setTotal(getTotalCommnet(docId)); return nComentList; } catch (SQLException e) { throw e; } catch (Exception e) { throw e; } finally { tm.releasenolog(); } }