Esempio n. 1
0
 /**
  * 判断用户是否收藏过该内容
  *
  * @param uname
  * @param columnId
  * @param contentId
  * @return
  */
 public boolean hasStow(String uname, Long columnId, String contentId) {
   UserFavor userFav = userFavorDao.getUserFavor(uname, columnId, contentId);
   if (userFav == null) {
     return false;
   } else {
     return true;
   }
 }
Esempio n. 2
0
 /**
  * 收藏内容
  *
  * @param uname 用户名
  * @param columnId 栏目id
  * @param contentId 内容id
  * @return
  */
 public boolean stowContent(String uname, Long columnId, String contentId) {
   User user = userDao.getUserInfo(uname);
   if (user == null || columnId == null || contentId == null) {
     return false;
   }
   UserFavor userFav = userFavorDao.getUserFavor(uname, columnId, contentId);
   if (userFav != null) {
     return true;
   } else {
     userFav = new UserFavor();
     userFav.setUserId(user.getId());
     userFav.setUname(user.getUname());
     userFav.setColumnId(columnId);
     userFav.setContentId(contentId);
     userFav.setStowTime(new Date());
     return userFavorDao.storeUserFavor(userFav);
   }
 }
Esempio n. 3
0
 /**
  * 取消收藏
  *
  * @param uname
  * @param columnId
  * @param contentId
  * @return
  */
 public boolean deleteStow(String uname, Long columnId, String contentId) {
   return userFavorDao.deleteStow(uname, columnId, contentId);
 }