Package com.bytedesk.forum.post
Class PostServiceImpl
java.lang.Object
com.bytedesk.forum.post.PostServiceImpl
- All Implemented Interfaces:
PostService
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreatePost
(String title, String content, Long userId, CategoryEntity category) void
deletePost
(Long postId) org.springframework.data.domain.Page<PostEntity>
fullTextSearch
(String keyword, org.springframework.data.domain.Pageable pageable) org.springframework.data.domain.Page<PostEntity>
fullTextSearchByCategory
(String keyword, Long categoryId, org.springframework.data.domain.Pageable pageable) org.springframework.data.domain.Page<PostEntity>
getPosts
(org.springframework.data.domain.Pageable pageable) org.springframework.data.domain.Page<PostEntity>
getPostsByCategory
(Long categoryId, org.springframework.data.domain.Pageable pageable) org.springframework.data.domain.Page<PostEntity>
getPostsByUser
(Long userId, org.springframework.data.domain.Pageable pageable) void
incrementLikeCount
(Long postId) void
incrementViewCount
(Long postId) private String
prepareKeyword
(String keyword) org.springframework.data.domain.Page<PostEntity>
searchPosts
(PostSearchCriteria criteria, org.springframework.data.domain.Pageable pageable) updatePost
(Long postId, String title, String content)
-
Field Details
-
postRepository
-
categoryRepository
-
-
Constructor Details
-
PostServiceImpl
public PostServiceImpl()
-
-
Method Details
-
createPost
@Transactional public PostEntity createPost(String title, String content, Long userId, CategoryEntity category) - Specified by:
createPost
in interfacePostService
-
updatePost
@CacheEvict(value="posts", key="#postId") @Transactional public PostEntity updatePost(Long postId, String title, String content) - Specified by:
updatePost
in interfacePostService
-
deletePost
- Specified by:
deletePost
in interfacePostService
-
getPost
- Specified by:
getPost
in interfacePostService
-
getPosts
public org.springframework.data.domain.Page<PostEntity> getPosts(org.springframework.data.domain.Pageable pageable) - Specified by:
getPosts
in interfacePostService
-
getPostsByCategory
public org.springframework.data.domain.Page<PostEntity> getPostsByCategory(Long categoryId, org.springframework.data.domain.Pageable pageable) - Specified by:
getPostsByCategory
in interfacePostService
-
getPostsByUser
public org.springframework.data.domain.Page<PostEntity> getPostsByUser(Long userId, org.springframework.data.domain.Pageable pageable) - Specified by:
getPostsByUser
in interfacePostService
-
incrementViewCount
- Specified by:
incrementViewCount
in interfacePostService
-
incrementLikeCount
- Specified by:
incrementLikeCount
in interfacePostService
-
searchPosts
public org.springframework.data.domain.Page<PostEntity> searchPosts(PostSearchCriteria criteria, org.springframework.data.domain.Pageable pageable) - Specified by:
searchPosts
in interfacePostService
-
fullTextSearch
public org.springframework.data.domain.Page<PostEntity> fullTextSearch(String keyword, org.springframework.data.domain.Pageable pageable) - Specified by:
fullTextSearch
in interfacePostService
-
fullTextSearchByCategory
public org.springframework.data.domain.Page<PostEntity> fullTextSearchByCategory(String keyword, Long categoryId, org.springframework.data.domain.Pageable pageable) - Specified by:
fullTextSearchByCategory
in interfacePostService
-
prepareKeyword
-