@Service
public class detailService {
@Transactional
public void likeImpl(Integer userId,String articleId) {
try {
ILikeTheArticle iLikeTheArticle = new ILikeTheArticle();
iLikeTheArticle.setUserId(userId);
iLikeTheArticle.setArticleId(Integer.parseInt(articleId));
iLikeTheArticle.save();
String sql2 = "select id,praise from forum_posts where id="+articleId;
ForumPosts forumPosts = ForumPosts.dao.findFirst(sql2);
Integer praise = forumPosts.getPraise();
praise++;
forumPosts.setPraise(praise);
ForumPosts.dao.update();
} catch (Exception e) {
throw e;
}
}
}
项目:JFinal