mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-06-02 07:57:38 +08:00
Add count and description to category and tag dropdown
This commit is contained in:
@@ -274,4 +274,12 @@ public class PostService {
|
||||
public java.util.List<Post> getPostsByIds(java.util.List<Long> ids) {
|
||||
return postRepository.findAllById(ids);
|
||||
}
|
||||
|
||||
public long countPostsByCategory(Long categoryId) {
|
||||
return postRepository.countByCategory_Id(categoryId);
|
||||
}
|
||||
|
||||
public long countPostsByTag(Long tagId) {
|
||||
return postRepository.countDistinctByTags_Id(tagId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,4 +54,11 @@ public class TagService {
|
||||
public List<Tag> listTags() {
|
||||
return tagRepository.findAll();
|
||||
}
|
||||
|
||||
public List<Tag> searchTags(String keyword) {
|
||||
if (keyword == null || keyword.isBlank()) {
|
||||
return tagRepository.findAll();
|
||||
}
|
||||
return tagRepository.findByNameContainingIgnoreCase(keyword);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user