@RequestMapping(value = "/tweet/comment", method = RequestMethod.POST) public void comment(@RequestBody Message message) { Tweet tweet = tweetRepo.findOne(message.getTid()); tweet.setCommentCount(tweet.getCommentCount() + 1); tweetRepo.saveAndFlush(tweet); // 保存评论 UserTweet userTweet = new UserTweet(); userTweet.setUid(message.getUid()); userTweet.setTid(message.getTid()); userTweet.setUserTweetType(UserTweet.UserTweetType.COMMENT); userTweetRepo.saveAndFlush(userTweet); message.setMessageType(Message.MessageType.COMMENT); message.setTime(Utils.getTime()); message.setDate(System.currentTimeMillis()); Utils.message(messageRepo.saveAndFlush(message)); }