/** * 功能描述:得到用户id为userId的数据统计对象,未找到时返回null * * @param userId * @return * @throws DBException */ public DataCount findDataCountByUserId(Long userId) throws DBException { DataCount dataCount = dataCountDao.getDataCountByUserId(userId); if (dataCount == null) { DataCount newDataCount = new DataCount(); newDataCount.setUserId(userId); this.save(newDataCount); dataCount = newDataCount; } return dataCount; }
/** * Function: 根据用户ID加回复数</br> * * <p>Produce describe: * * @param userId * @throws DBException * @author: You 2008-4-17 */ public void addCircleReplyTotalByUserId(long userId) throws DBException { // TODO Auto-generated method stub DataCount dc = this.findDataCountByUserId(userId); if (dc != null) { if (dc.getCircleReplyTotal() != null) // 加1 dc.setCircleReplyTotal(dc.getCircleReplyTotal() + 1); else dc.setCircleReplyTotal(new Long(1)); } else { DataCount tt = new DataCount(); tt.setUserId(userId); dc.setCircleReplyTotal(new Long(1)); this.save(tt); } }
/** * Function: 根据用户ID加发帖数</br> * * <p>Produce describe: * * @param userId * @throws DBException * @author: You 2008-4-17 */ public void addCircleTopicTotalByUserId(long userId) throws DBException { // TODO Auto-generated method stub DataCount dc = this.findDataCountByUserId(userId); if (dc != null) { // 加1 if (dc.getCircleTopicTopTotal() == null) { dc.setCircleTopicTotal(new Long(1)); } else { dc.setCircleTopicTotal(dc.getCircleTopicTotal() + 1); } this.update(dc); } else { DataCount tt = new DataCount(); tt.setUserId(userId); tt.setCircleTopicTopTotal(new Long(1)); this.save(tt); } }