/** * 功能描述:为formBean赋初值 * * @param dataCount * @param formBean */ public void setFormBean(DataCount dataCount, DefaultForm formBean) throws DBException, LogicException { if (dataCount != null) { formBean.setNewFriend(dataCount.getNewFriend().toString()); formBean.setNewSalutation(dataCount.getNewSalutation().toString()); formBean.setNewShortMessage(dataCount.getNewShortMessage().toString()); formBean.setNewTeacherAppraise(dataCount.getNewTeacherAppraise().toString()); } }
/** * 功能描述:用户操作新申请为好友的数据时设置统计表的新好友字段值减1 * * @param userId * @return * @throws DBException */ public boolean minusNewFriend(Long userId) throws DBException { DataCount dataCount = findDataCountByUserId(userId); // 判断是否存在这样的用户统计实体 if (dataCount != null) { Long newFriend = dataCount.getNewFriend(); if (newFriend != null && newFriend.longValue() > 0) { dataCount.setNewFriend(new Long(newFriend.longValue() - 1)); dataCountDao.update(dataCount); return true; } } return false; }