Exemplo n.º 1
0
 /**
  * 功能描述:用户操作新申请为好友的数据时设置统计表的新好友字段值减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;
 }