🎨 优化代码结构

This commit is contained in:
ronger 2021-12-14 11:09:49 +08:00
parent bb9c20997f
commit b8f892fe8e

View File

@ -61,7 +61,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
} else { } else {
list = articleMapper.selectArticles(searchDTO.getSearchText(), searchDTO.getTag(), searchDTO.getTopicUri()); list = articleMapper.selectArticles(searchDTO.getSearchText(), searchDTO.getTag(), searchDTO.getTopicUri());
} }
list.forEach(articleDTO -> genArticle(articleDTO,0)); list.forEach(articleDTO -> genArticle(articleDTO, 0));
return list; return list;
} }
@ -78,7 +78,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
@Override @Override
public List<ArticleDTO> findArticlesByTopicUri(String name) { public List<ArticleDTO> findArticlesByTopicUri(String name) {
List<ArticleDTO> list = articleMapper.selectArticlesByTopicUri(name); List<ArticleDTO> list = articleMapper.selectArticlesByTopicUri(name);
list.forEach(articleDTO -> genArticle(articleDTO,0)); list.forEach(articleDTO -> genArticle(articleDTO, 0));
return list; return list;
} }
@ -90,7 +90,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
@Override @Override
public List<ArticleDTO> findUserArticlesByIdUser(Integer idUser) { public List<ArticleDTO> findUserArticlesByIdUser(Integer idUser) {
List<ArticleDTO> list = articleMapper.selectUserArticles(idUser); List<ArticleDTO> list = articleMapper.selectUserArticles(idUser);
list.forEach(articleDTO -> genArticle(articleDTO,0)); list.forEach(articleDTO -> genArticle(articleDTO, 0));
return list; return list;
} }
@ -306,21 +306,21 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
throw new BaseApiException(ErrorCode.INVALID_TOKEN); throw new BaseApiException(ErrorCode.INVALID_TOKEN);
} }
List<ArticleDTO> list = articleMapper.selectDrafts(user.getIdUser()); List<ArticleDTO> list = articleMapper.selectDrafts(user.getIdUser());
list.forEach(articleDTO -> genArticle(articleDTO,0)); list.forEach(articleDTO -> genArticle(articleDTO, 0));
return list; return list;
} }
@Override @Override
public List<ArticleDTO> findArticlesByIdPortfolio(Integer idPortfolio) { public List<ArticleDTO> findArticlesByIdPortfolio(Integer idPortfolio) {
List<ArticleDTO> list = articleMapper.selectArticlesByIdPortfolio(idPortfolio); List<ArticleDTO> list = articleMapper.selectArticlesByIdPortfolio(idPortfolio);
list.forEach(articleDTO -> genArticle(articleDTO,0)); list.forEach(articleDTO -> genArticle(articleDTO, 0));
return list; return list;
} }
@Override @Override
public List<ArticleDTO> selectUnbindArticles(Integer idPortfolio, String searchText, Integer idUser) { public List<ArticleDTO> selectUnbindArticles(Integer idPortfolio, String searchText, Integer idUser) {
List<ArticleDTO> list = articleMapper.selectUnbindArticlesByIdPortfolio(idPortfolio, searchText, idUser); List<ArticleDTO> list = articleMapper.selectUnbindArticlesByIdPortfolio(idPortfolio, searchText, idUser);
list.forEach(articleDTO -> genArticle(articleDTO,0)); list.forEach(articleDTO -> genArticle(articleDTO, 0));
return list; return list;
} }
@ -357,7 +357,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
@Override @Override
public List<ArticleDTO> findAnnouncements() { public List<ArticleDTO> findAnnouncements() {
List<ArticleDTO> list = articleMapper.selectAnnouncements(); List<ArticleDTO> list = articleMapper.selectAnnouncements();
list.forEach(articleDTO -> genArticle(articleDTO,0)); list.forEach(articleDTO -> genArticle(articleDTO, 0));
return list; return list;
} }