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) voiddeletePost(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) voidincrementLikeCount(Long postId) voidincrementViewCount(Long postId) private StringprepareKeyword(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:
createPostin interfacePostService
-
updatePost
@CacheEvict(value="posts", key="#postId") @Transactional public PostEntity updatePost(Long postId, String title, String content) - Specified by:
updatePostin interfacePostService
-
deletePost
- Specified by:
deletePostin interfacePostService
-
getPost
- Specified by:
getPostin interfacePostService
-
getPosts
public org.springframework.data.domain.Page<PostEntity> getPosts(org.springframework.data.domain.Pageable pageable) - Specified by:
getPostsin interfacePostService
-
getPostsByCategory
public org.springframework.data.domain.Page<PostEntity> getPostsByCategory(Long categoryId, org.springframework.data.domain.Pageable pageable) - Specified by:
getPostsByCategoryin interfacePostService
-
getPostsByUser
public org.springframework.data.domain.Page<PostEntity> getPostsByUser(Long userId, org.springframework.data.domain.Pageable pageable) - Specified by:
getPostsByUserin interfacePostService
-
incrementViewCount
- Specified by:
incrementViewCountin interfacePostService
-
incrementLikeCount
- Specified by:
incrementLikeCountin interfacePostService
-
searchPosts
public org.springframework.data.domain.Page<PostEntity> searchPosts(PostSearchCriteria criteria, org.springframework.data.domain.Pageable pageable) - Specified by:
searchPostsin interfacePostService
-
fullTextSearch
public org.springframework.data.domain.Page<PostEntity> fullTextSearch(String keyword, org.springframework.data.domain.Pageable pageable) - Specified by:
fullTextSearchin interfacePostService
-
fullTextSearchByCategory
public org.springframework.data.domain.Page<PostEntity> fullTextSearchByCategory(String keyword, Long categoryId, org.springframework.data.domain.Pageable pageable) - Specified by:
fullTextSearchByCategoryin interfacePostService
-
prepareKeyword
-