| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- package com.happy.service.impl;
- import com.happy.Model.*;
- import com.happy.dao.ArticleTweetDao;
- import com.happy.dto.IPage;
- import com.happy.service.ArticleTweetService;
- import com.happy.vo.*;
- import org.springframework.stereotype.Service;
- import javax.annotation.Resource;
- import java.util.ArrayList;
- import java.util.List;
- @Service("ArticleTweetService")
- public class ArticleTweetImplService implements ArticleTweetService {
- @Resource
- public ArticleTweetDao articleTweetDao;
- @Override
- public ArticleTweet queryArticleById(String id, Integer userId) {
- ArticleTweet num = articleTweetDao.queryArticleById(id, userId);
- return num;
- }
- @Override
- public int insert(ArticleTweet articleTweet) {
- int num = articleTweetDao.insert(articleTweet);
- return num;
- }
- @Override
- public int updateArticleApprove(ArticleTweet articleTweet) {
- int num = articleTweetDao.updateArticleApprove(articleTweet);
- return num;
- }
- @Override
- public int insertArticleFileBatch(List<ArticleFileInfo> articleFileInfos) {
- int num = articleTweetDao.insertArticleFileBatch(articleFileInfos);
- return num;
- }
- @Override
- public IPage<HotelVo> queryHotelPage(String sqlx, int page, int rows) {
- IPage<HotelVo> iPage = new IPage();
- List<HotelVo> hotelList = articleTweetDao.queryHotelPage(sqlx, page, rows);
- int total = articleTweetDao.queryHotelTotal(sqlx);
- iPage.setPageList(hotelList == null ? new ArrayList<>() : hotelList);
- iPage.setPage(page);
- iPage.setTotalPage((int) Math.ceil((double) total / rows));
- iPage.setRows(rows);
- iPage.setTotal(total);
- return iPage;
- }
- @Override
- public List<HotelVo> queryHotels(String sqlx) {
- List<HotelVo> hotels = articleTweetDao.queryHotels(sqlx);
- return hotels;
- }
- @Override
- public IPage<HotelVo> queryHotelPageByHotleId(String sqlx, int page, int rows) {
- IPage<HotelVo> iPage = new IPage();
- List<HotelVo> hotelList = articleTweetDao.queryHotelPageByHotleId(sqlx, page, rows);
- int total = articleTweetDao.queryHotelTotalByHotleId(sqlx);
- iPage.setPageList(hotelList == null ? new ArrayList<>() : hotelList);
- iPage.setPage(page);
- iPage.setTotalPage((int) Math.ceil((double) total / rows));
- iPage.setRows(rows);
- iPage.setTotal(total);
- return iPage;
- }
- @Override
- public List<FileInfo> queryList(String sqlx) {
- List<FileInfo> result = articleTweetDao.queryList(sqlx);
- return result;
- }
- @Override
- public UserCollect queryUserCollect(Integer parentId, Integer userId) {
- UserCollect result = articleTweetDao.queryUserCollect(parentId, userId);
- return result;
- }
- @Override
- public List<LikeListVo> queryArticleLikes(Integer articleId) {
- List<LikeListVo> result = articleTweetDao.queryArticleLikes(articleId);
- return result;
- }
- @Override
- public List<ArticleCommentVo> queryArticleComment(Integer articleId) {
- List<ArticleCommentVo> result = articleTweetDao.queryArticleComment(articleId);
- return result;
- }
- @Override
- public int queryArticleCommentTotal(Integer articleId) {
- int result = articleTweetDao.queryArticleCommentTotal(articleId);
- return result;
- }
- @Override
- public IPage<ArticleCommentVo> queryCommentPageByArticle(Integer articleId, int page, int rows) {
- IPage<ArticleCommentVo> iPage = new IPage();
- List<ArticleCommentVo> commentList = articleTweetDao.queryCommentPageByArticle(articleId, page, rows);
- int total = articleTweetDao.queryCommentTotalByArticle(articleId);
- iPage.setPageList(commentList == null ? new ArrayList<>() : commentList);
- iPage.setPage(page);
- iPage.setTotalPage((int) Math.ceil((double) total / rows));
- iPage.setRows(rows);
- iPage.setTotal(total);
- return iPage;
- }
- @Override
- public List<ArticleCommentVo> queryCommentsByArticle(Integer articleId) {
- List<ArticleCommentVo> result = articleTweetDao.queryCommentsByArticle(articleId);
- return result;
- }
- @Override
- public articleUserVo queryUserInfo(Integer userId) {
- articleUserVo result = articleTweetDao.queryUserInfo(userId);
- return result;
- }
- @Override
- public IPage<OwnerArticleVo> queryOwnerArticlePage(Integer userId, String sqlWhere, int page, int rows) {
- IPage<OwnerArticleVo> iPage = new IPage();
- List<OwnerArticleVo> commentList = articleTweetDao.queryOwnerArticlePage(userId, sqlWhere, page, rows);
- int total = articleTweetDao.queryOwnerArticleTotal(userId, sqlWhere);
- iPage.setPageList(commentList == null ? new ArrayList<>() : commentList);
- iPage.setPage(page);
- iPage.setTotalPage((int) Math.ceil((double) total / rows));
- iPage.setRows(rows);
- iPage.setTotal(total);
- return iPage;
- }
- @Override
- public IPage<ArticleListVo> queryArticlesPage(String keyWord, String townId, Integer userId, Integer type, int page, int rows) {
- IPage<ArticleListVo> iPage = new IPage();
- List<ArticleListVo> commentList = articleTweetDao.queryArticlesPage(keyWord, townId, userId, type, page, rows);
- int total = articleTweetDao.queryArticlesTotal(keyWord, townId, userId, type);
- iPage.setPageList(commentList == null ? new ArrayList<>() : commentList);
- iPage.setPage(page);
- iPage.setTotalPage((int) Math.ceil((double) total / rows));
- iPage.setRows(rows);
- iPage.setTotal(total);
- return iPage;
- }
- @Override
- public IPage<ArticleListVo> relatedTweetPage(Integer userId, String townId, Integer articleId, int page, int rows) {
- IPage<ArticleListVo> iPage = new IPage();
- List<ArticleListVo> commentList = articleTweetDao.relatedTweetPage(userId, townId, articleId, page, rows);
- int total = articleTweetDao.relatedTweetTotal(townId, articleId);
- iPage.setPageList(commentList == null ? new ArrayList<>() : commentList);
- iPage.setPage(page);
- iPage.setTotalPage((int) Math.ceil((double) total / rows));
- iPage.setRows(rows);
- iPage.setTotal(total);
- return iPage;
- }
- @Override
- public ArticleCollect queryArticleCollect(Integer articleId, Integer userId) {
- ArticleCollect result = articleTweetDao.queryArticleCollect(articleId, userId);
- return result;
- }
- @Override
- public int updateArticleCollect(ArticleCollect articleCollect) {
- int result = articleTweetDao.updateArticleCollect(articleCollect);
- return result;
- }
- ;
- @Override
- public int insertArticleComment(ArticleComment articleComment) {
- int result = articleTweetDao.insertArticleComment(articleComment);
- return result;
- }
- /**
- * 查询用户关注记录数据
- *
- * @param authorId
- * @param userId
- * @return
- */
- public UserCollect queryUserCollectNoLose(Integer authorId, Integer userId) {
- UserCollect result = articleTweetDao.queryUserCollectNoLose(authorId, userId);
- return result;
- }
- /**
- * 关注或取消关注操作
- *
- * @param userCollect
- * @return
- */
- public int updateUserCollect(UserCollect userCollect) {
- int result = articleTweetDao.updateUserCollect(userCollect);
- return result;
- }
- /**
- * 查询用户点赞记录数据
- *
- * @param articleId
- * @param userId
- * @return
- */
- public ArticleLikes queryArticleLike(Integer articleId, Integer userId) {
- ArticleLikes result = articleTweetDao.queryArticleLike(articleId, userId);
- return result;
- }
- /**
- * 点赞文章
- *
- * @param articleLikes
- * @return
- */
- public int updateArticleLike(ArticleLikes articleLikes) {
- int num = articleTweetDao.updateArticleLike(articleLikes);
- return num;
- }
- /**
- * 更新用户简介
- *
- * @param authorId
- * @param descript
- * @return
- */
- public int updateDescript(Integer authorId, String descript) {
- int num = articleTweetDao.updateDescript(authorId, descript);
- return num;
- }
- @Override
- public IPage<LikeListVo> queryLikesPage(Integer articleId, int page, int rows) {
- IPage<LikeListVo> iPage = new IPage();
- List<LikeListVo> commentList = articleTweetDao.queryLikesPage(articleId, page, rows);
- int total = articleTweetDao.queryLikesTotal(articleId);
- iPage.setPageList(commentList == null ? new ArrayList<>() : commentList);
- iPage.setPage(page);
- iPage.setTotalPage((int) Math.ceil((double) total / rows));
- iPage.setRows(rows);
- iPage.setTotal(total);
- return iPage;
- }
- @Override
- public ArticleLikeMaxVo queryMaxArticleLike() {
- ArticleLikeMaxVo result = articleTweetDao.queryMaxArticleLike();
- return result;
- }
- @Override
- public IPage<WalkthroughVo> walkthroughPage(String strSql, Integer page, Integer rows) {
- IPage<WalkthroughVo> iPage = new IPage();
- List<WalkthroughVo> commentList = articleTweetDao.walkthroughPage(strSql, page, rows);
- int total = articleTweetDao.walkthroughTotal(strSql);
- iPage.setPageList(commentList == null ? new ArrayList<>() : commentList);
- iPage.setPage(page);
- iPage.setTotalPage((int) Math.ceil((double) total / rows));
- iPage.setRows(rows);
- iPage.setTotal(total);
- return iPage;
- }
- @Override
- public List<ArticleLikeMaxVo> queryTop3ArticleLike() {
- List<ArticleLikeMaxVo> result = articleTweetDao.queryTop3ArticleLike();
- return result;
- }
- }
|